Average Error: 47.0 → 14.7
Time: 51.0s
Precision: 64
• ## could not determine a ground truth for program body (more)

1. k = 1.3100436170095023e+65
2. x = -7.418868410425896e-99
$\frac{e^{k - k \cdot x}}{e^{k} - e^{-k}} - \frac{e^{k \cdot x - x}}{e^{k} - e^{-k}}$
$\begin{array}{l} \mathbf{if}\;k \le -0.00014190167200148313:\\ \;\;\;\;\left(e^{k - k \cdot x} - e^{k \cdot x - x}\right) \cdot \frac{1}{e^{k} - e^{-k}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{4} \cdot \left(\left(k \cdot \left(k \cdot \frac{1}{4}\right)\right) \cdot \left(k \cdot \left(k \cdot \frac{1}{4}\right)\right)\right) + \left(k \cdot \frac{1}{4} + \left(\frac{1}{4} + \left(\frac{-1}{2} + k \cdot \frac{1}{4}\right) \cdot \left(k \cdot \frac{1}{4}\right)\right) \cdot x\right) \cdot \frac{1}{2}}{k \cdot \frac{1}{4} + \left(k \cdot \left(k \cdot \frac{1}{4}\right)\right) \cdot \left(\frac{-1}{2} + k \cdot \frac{1}{4}\right)}\\ \end{array}$
\frac{e^{k - k \cdot x}}{e^{k} - e^{-k}} - \frac{e^{k \cdot x - x}}{e^{k} - e^{-k}}
\begin{array}{l}
\mathbf{if}\;k \le -0.00014190167200148313:\\
\;\;\;\;\left(e^{k - k \cdot x} - e^{k \cdot x - x}\right) \cdot \frac{1}{e^{k} - e^{-k}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{4} \cdot \left(\left(k \cdot \left(k \cdot \frac{1}{4}\right)\right) \cdot \left(k \cdot \left(k \cdot \frac{1}{4}\right)\right)\right) + \left(k \cdot \frac{1}{4} + \left(\frac{1}{4} + \left(\frac{-1}{2} + k \cdot \frac{1}{4}\right) \cdot \left(k \cdot \frac{1}{4}\right)\right) \cdot x\right) \cdot \frac{1}{2}}{k \cdot \frac{1}{4} + \left(k \cdot \left(k \cdot \frac{1}{4}\right)\right) \cdot \left(\frac{-1}{2} + k \cdot \frac{1}{4}\right)}\\

\end{array}
double f(double k, double x) {
double r29704554 = k;
double r29704555 = x;
double r29704556 = r29704554 * r29704555;
double r29704557 = r29704554 - r29704556;
double r29704558 = exp(r29704557);
double r29704559 = exp(r29704554);
double r29704560 = -r29704554;
double r29704561 = exp(r29704560);
double r29704562 = r29704559 - r29704561;
double r29704563 = r29704558 / r29704562;
double r29704564 = r29704556 - r29704555;
double r29704565 = exp(r29704564);
double r29704566 = r29704565 / r29704562;
double r29704567 = r29704563 - r29704566;
return r29704567;
}


double f(double k, double x) {
double r29704568 = k;
double r29704569 = -0.00014190167200148313;
bool r29704570 = r29704568 <= r29704569;
double r29704571 = x;
double r29704572 = r29704568 * r29704571;
double r29704573 = r29704568 - r29704572;
double r29704574 = exp(r29704573);
double r29704575 = r29704572 - r29704571;
double r29704576 = exp(r29704575);
double r29704577 = r29704574 - r29704576;
double r29704578 = 1.0;
double r29704579 = exp(r29704568);
double r29704580 = -r29704568;
double r29704581 = exp(r29704580);
double r29704582 = r29704579 - r29704581;
double r29704583 = r29704578 / r29704582;
double r29704584 = r29704577 * r29704583;
double r29704585 = 0.25;
double r29704586 = r29704568 * r29704585;
double r29704587 = r29704568 * r29704586;
double r29704588 = r29704587 * r29704587;
double r29704589 = r29704585 * r29704588;
double r29704590 = -0.5;
double r29704591 = r29704590 + r29704586;
double r29704592 = r29704591 * r29704586;
double r29704593 = r29704585 + r29704592;
double r29704594 = r29704593 * r29704571;
double r29704595 = r29704586 + r29704594;
double r29704596 = 0.5;
double r29704597 = r29704595 * r29704596;
double r29704598 = r29704589 + r29704597;
double r29704599 = r29704587 * r29704591;
double r29704600 = r29704586 + r29704599;
double r29704601 = r29704598 / r29704600;
double r29704602 = r29704570 ? r29704584 : r29704601;
return r29704602;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if k < -0.00014190167200148313

1. Initial program 0.8

$\frac{e^{k - k \cdot x}}{e^{k} - e^{-k}} - \frac{e^{k \cdot x - x}}{e^{k} - e^{-k}}$
2. Using strategy rm
3. Applied div-inv0.8

$\leadsto \frac{e^{k - k \cdot x}}{e^{k} - e^{-k}} - \color{blue}{e^{k \cdot x - x} \cdot \frac{1}{e^{k} - e^{-k}}}$
4. Applied div-inv0.7

$\leadsto \color{blue}{e^{k - k \cdot x} \cdot \frac{1}{e^{k} - e^{-k}}} - e^{k \cdot x - x} \cdot \frac{1}{e^{k} - e^{-k}}$
5. Applied distribute-rgt-out--0.7

$\leadsto \color{blue}{\frac{1}{e^{k} - e^{-k}} \cdot \left(e^{k - k \cdot x} - e^{k \cdot x - x}\right)}$

## if -0.00014190167200148313 < k

1. Initial program 59.8

$\frac{e^{k - k \cdot x}}{e^{k} - e^{-k}} - \frac{e^{k \cdot x - x}}{e^{k} - e^{-k}}$
2. Taylor expanded around 0 18.5

$\leadsto \color{blue}{\frac{1}{2} \cdot \frac{x}{k} + \left(\frac{1}{2} + \frac{1}{4} \cdot k\right)}$
3. Using strategy rm
4. Applied flip3-+18.5

$\leadsto \frac{1}{2} \cdot \frac{x}{k} + \color{blue}{\frac{{\frac{1}{2}}^{3} + {\left(\frac{1}{4} \cdot k\right)}^{3}}{\frac{1}{2} \cdot \frac{1}{2} + \left(\left(\frac{1}{4} \cdot k\right) \cdot \left(\frac{1}{4} \cdot k\right) - \frac{1}{2} \cdot \left(\frac{1}{4} \cdot k\right)\right)}}$
5. Applied associate-*r/18.5

$\leadsto \color{blue}{\frac{\frac{1}{2} \cdot x}{k}} + \frac{{\frac{1}{2}}^{3} + {\left(\frac{1}{4} \cdot k\right)}^{3}}{\frac{1}{2} \cdot \frac{1}{2} + \left(\left(\frac{1}{4} \cdot k\right) \cdot \left(\frac{1}{4} \cdot k\right) - \frac{1}{2} \cdot \left(\frac{1}{4} \cdot k\right)\right)}$

$\leadsto \color{blue}{\frac{\left(\frac{1}{2} \cdot x\right) \cdot \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(\frac{1}{4} \cdot k\right) \cdot \left(\frac{1}{4} \cdot k\right) - \frac{1}{2} \cdot \left(\frac{1}{4} \cdot k\right)\right)\right) + k \cdot \left({\frac{1}{2}}^{3} + {\left(\frac{1}{4} \cdot k\right)}^{3}\right)}{k \cdot \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(\frac{1}{4} \cdot k\right) \cdot \left(\frac{1}{4} \cdot k\right) - \frac{1}{2} \cdot \left(\frac{1}{4} \cdot k\right)\right)\right)}}$
7. Simplified18.6

$\leadsto \frac{\color{blue}{\frac{1}{2} \cdot \left(x \cdot \left(\frac{1}{4} + \left(k \cdot \frac{1}{4}\right) \cdot \left(k \cdot \frac{1}{4} + \frac{-1}{2}\right)\right) + k \cdot \frac{1}{4}\right) + \left(\left(\left(k \cdot \frac{1}{4}\right) \cdot k\right) \cdot \left(\left(k \cdot \frac{1}{4}\right) \cdot k\right)\right) \cdot \frac{1}{4}}}{k \cdot \left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(\frac{1}{4} \cdot k\right) \cdot \left(\frac{1}{4} \cdot k\right) - \frac{1}{2} \cdot \left(\frac{1}{4} \cdot k\right)\right)\right)}$
8. Simplified18.6

$\leadsto \frac{\frac{1}{2} \cdot \left(x \cdot \left(\frac{1}{4} + \left(k \cdot \frac{1}{4}\right) \cdot \left(k \cdot \frac{1}{4} + \frac{-1}{2}\right)\right) + k \cdot \frac{1}{4}\right) + \left(\left(\left(k \cdot \frac{1}{4}\right) \cdot k\right) \cdot \left(\left(k \cdot \frac{1}{4}\right) \cdot k\right)\right) \cdot \frac{1}{4}}{\color{blue}{\left(\left(k \cdot \frac{1}{4}\right) \cdot k\right) \cdot \left(k \cdot \frac{1}{4} + \frac{-1}{2}\right) + k \cdot \frac{1}{4}}}$
3. Recombined 2 regimes into one program.
4. Final simplification14.7

$\leadsto \begin{array}{l} \mathbf{if}\;k \le -0.00014190167200148313:\\ \;\;\;\;\left(e^{k - k \cdot x} - e^{k \cdot x - x}\right) \cdot \frac{1}{e^{k} - e^{-k}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{4} \cdot \left(\left(k \cdot \left(k \cdot \frac{1}{4}\right)\right) \cdot \left(k \cdot \left(k \cdot \frac{1}{4}\right)\right)\right) + \left(k \cdot \frac{1}{4} + \left(\frac{1}{4} + \left(\frac{-1}{2} + k \cdot \frac{1}{4}\right) \cdot \left(k \cdot \frac{1}{4}\right)\right) \cdot x\right) \cdot \frac{1}{2}}{k \cdot \frac{1}{4} + \left(k \cdot \left(k \cdot \frac{1}{4}\right)\right) \cdot \left(\frac{-1}{2} + k \cdot \frac{1}{4}\right)}\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (k x)
:name "exp(k - k * x) / (exp(k) - exp(-k)) - exp(k * x - x) / (exp(k) - exp(-k))"
(- (/ (exp (- k (* k x))) (- (exp k) (exp (- k)))) (/ (exp (- (* k x) x)) (- (exp k) (exp (- k))))))