Average Error: 20.2 → 18.6
Time: 30.3s
Precision: 64
$\left(\left(\left(-4\right) + \left(3 \cdot dt\right) \cdot \left(1 + k\right)\right) - \left(\left(dt \cdot dt\right) \cdot \left(1 + k\right)\right) \cdot \left(1 + k\right)\right) + e^{\left(-dt\right) \cdot \left(1 + k\right)} \cdot \left(4 + dt \cdot \left(1 + k\right)\right)$
$\left(-4 + \left(3 - \left(1 + k\right) \cdot dt\right) \cdot \left(\left(1 + k\right) \cdot dt\right)\right) + \frac{\sqrt{4 + \left(1 + k\right) \cdot dt}}{\frac{e^{\left(1 + k\right) \cdot dt}}{\sqrt{4 + \left(1 + k\right) \cdot dt}}}$
\left(\left(\left(-4\right) + \left(3 \cdot dt\right) \cdot \left(1 + k\right)\right) - \left(\left(dt \cdot dt\right) \cdot \left(1 + k\right)\right) \cdot \left(1 + k\right)\right) + e^{\left(-dt\right) \cdot \left(1 + k\right)} \cdot \left(4 + dt \cdot \left(1 + k\right)\right)
\left(-4 + \left(3 - \left(1 + k\right) \cdot dt\right) \cdot \left(\left(1 + k\right) \cdot dt\right)\right) + \frac{\sqrt{4 + \left(1 + k\right) \cdot dt}}{\frac{e^{\left(1 + k\right) \cdot dt}}{\sqrt{4 + \left(1 + k\right) \cdot dt}}}
double f(double dt, double k) {
double r26285016 = 4.0;
double r26285017 = -r26285016;
double r26285018 = 3.0;
double r26285019 = dt;
double r26285020 = r26285018 * r26285019;
double r26285021 = 1.0;
double r26285022 = k;
double r26285023 = r26285021 + r26285022;
double r26285024 = r26285020 * r26285023;
double r26285025 = r26285017 + r26285024;
double r26285026 = r26285019 * r26285019;
double r26285027 = r26285026 * r26285023;
double r26285028 = r26285027 * r26285023;
double r26285029 = r26285025 - r26285028;
double r26285030 = -r26285019;
double r26285031 = r26285030 * r26285023;
double r26285032 = exp(r26285031);
double r26285033 = r26285019 * r26285023;
double r26285034 = r26285016 + r26285033;
double r26285035 = r26285032 * r26285034;
double r26285036 = r26285029 + r26285035;
return r26285036;
}


double f(double dt, double k) {
double r26285037 = -4.0;
double r26285038 = 3.0;
double r26285039 = 1.0;
double r26285040 = k;
double r26285041 = r26285039 + r26285040;
double r26285042 = dt;
double r26285043 = r26285041 * r26285042;
double r26285044 = r26285038 - r26285043;
double r26285045 = r26285044 * r26285043;
double r26285046 = r26285037 + r26285045;
double r26285047 = 4.0;
double r26285048 = r26285047 + r26285043;
double r26285049 = sqrt(r26285048);
double r26285050 = exp(r26285043);
double r26285051 = r26285050 / r26285049;
double r26285052 = r26285049 / r26285051;
double r26285053 = r26285046 + r26285052;
return r26285053;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 20.2

$\left(\left(\left(-4\right) + \left(3 \cdot dt\right) \cdot \left(1 + k\right)\right) - \left(\left(dt \cdot dt\right) \cdot \left(1 + k\right)\right) \cdot \left(1 + k\right)\right) + e^{\left(-dt\right) \cdot \left(1 + k\right)} \cdot \left(4 + dt \cdot \left(1 + k\right)\right)$
2. Simplified18.4

$\leadsto \color{blue}{\frac{dt \cdot \left(1 + k\right) + 4}{e^{dt \cdot \left(1 + k\right)}} + \left(\left(dt \cdot \left(1 + k\right)\right) \cdot \left(3 - dt \cdot \left(1 + k\right)\right) + -4\right)}$
3. Using strategy rm

$\leadsto \frac{\color{blue}{\sqrt{dt \cdot \left(1 + k\right) + 4} \cdot \sqrt{dt \cdot \left(1 + k\right) + 4}}}{e^{dt \cdot \left(1 + k\right)}} + \left(\left(dt \cdot \left(1 + k\right)\right) \cdot \left(3 - dt \cdot \left(1 + k\right)\right) + -4\right)$
5. Applied associate-/l*18.6

$\leadsto \color{blue}{\frac{\sqrt{dt \cdot \left(1 + k\right) + 4}}{\frac{e^{dt \cdot \left(1 + k\right)}}{\sqrt{dt \cdot \left(1 + k\right) + 4}}}} + \left(\left(dt \cdot \left(1 + k\right)\right) \cdot \left(3 - dt \cdot \left(1 + k\right)\right) + -4\right)$
6. Final simplification18.6

$\leadsto \left(-4 + \left(3 - \left(1 + k\right) \cdot dt\right) \cdot \left(\left(1 + k\right) \cdot dt\right)\right) + \frac{\sqrt{4 + \left(1 + k\right) \cdot dt}}{\frac{e^{\left(1 + k\right) \cdot dt}}{\sqrt{4 + \left(1 + k\right) \cdot dt}}}$

# Reproduce

herbie shell --seed 1
(FPCore (dt k)
:name "-4+3*dt*(1+k)-dt*dt*(1+k)*(1+k)+exp(-dt*(1+k))*(4+dt*(1+k))"
(+ (- (+ (- 4) (* (* 3 dt) (+ 1 k))) (* (* (* dt dt) (+ 1 k)) (+ 1 k))) (* (exp (* (- dt) (+ 1 k))) (+ 4 (* dt (+ 1 k))))))