Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.2% → 88.7%
Time: 16.9s
Alternatives: 4
Speedup: 1.8×

Specification

?
\[\begin{array}{l} \\ w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))))
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))));
end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 4 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 81.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))))
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))));
end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}

Alternative 1: 88.7% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(M \cdot D\right) \cdot \frac{0.5}{d}\\ w0 \cdot \sqrt{1 - t_0 \cdot \frac{h}{\frac{\ell}{t_0}}} \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (* (* M D) (/ 0.5 d))))
   (* w0 (sqrt (- 1.0 (* t_0 (/ h (/ l t_0))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = (M * D) * (0.5 / d);
	return w0 * sqrt((1.0 - (t_0 * (h / (l / t_0)))));
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: t_0
    t_0 = (m * d) * (0.5d0 / d_1)
    code = w0 * sqrt((1.0d0 - (t_0 * (h / (l / t_0)))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = (M * D) * (0.5 / d);
	return w0 * Math.sqrt((1.0 - (t_0 * (h / (l / t_0)))));
}
def code(w0, M, D, h, l, d):
	t_0 = (M * D) * (0.5 / d)
	return w0 * math.sqrt((1.0 - (t_0 * (h / (l / t_0)))))
function code(w0, M, D, h, l, d)
	t_0 = Float64(Float64(M * D) * Float64(0.5 / d))
	return Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(h / Float64(l / t_0))))))
end
function tmp = code(w0, M, D, h, l, d)
	t_0 = (M * D) * (0.5 / d);
	tmp = w0 * sqrt((1.0 - (t_0 * (h / (l / t_0)))));
end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(h / N[(l / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(M \cdot D\right) \cdot \frac{0.5}{d}\\
w0 \cdot \sqrt{1 - t_0 \cdot \frac{h}{\frac{\ell}{t_0}}}
\end{array}
\end{array}
Derivation
  1. Initial program 79.6%

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Simplified79.2%

    \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
  3. Step-by-step derivation
    1. frac-times79.6%

      \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    2. *-commutative79.6%

      \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    3. expm1-log1p-u63.3%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
    4. expm1-udef63.3%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)} - 1\right)}} \]
  4. Applied egg-rr79.6%

    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(1 + \frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}\right) - 1\right)}} \]
  5. Step-by-step derivation
    1. add-exp-log63.3%

      \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{e^{\log \left(1 + \frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}\right)}} - 1\right)} \]
    2. log1p-udef63.3%

      \[\leadsto w0 \cdot \sqrt{1 - \left(e^{\color{blue}{\mathsf{log1p}\left(\frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}\right)}} - 1\right)} \]
    3. expm1-udef63.3%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}\right)\right)}} \]
    4. expm1-log1p-u79.6%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}}} \]
    5. associate-*l/84.4%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}}{\ell}}} \]
    6. associate-/l*84.8%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\frac{\ell}{{\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}}}}} \]
    7. associate-*l*84.4%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\ell}{{\color{blue}{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}}^{2}}}} \]
  6. Applied egg-rr84.4%

    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\frac{\ell}{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}}}} \]
  7. Step-by-step derivation
    1. *-un-lft-identity84.4%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\color{blue}{1 \cdot \ell}}{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}}} \]
    2. unpow284.4%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1 \cdot \ell}{\color{blue}{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}}}} \]
    3. times-frac85.2%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\color{blue}{\frac{1}{D \cdot \left(M \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}}} \]
    4. *-commutative85.2%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{\color{blue}{\left(M \cdot \frac{0.5}{d}\right) \cdot D}} \cdot \frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}} \]
    5. associate-*r*83.4%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{\color{blue}{M \cdot \left(\frac{0.5}{d} \cdot D\right)}} \cdot \frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}} \]
    6. *-commutative83.4%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{M \cdot \color{blue}{\left(D \cdot \frac{0.5}{d}\right)}} \cdot \frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}} \]
    7. *-commutative83.4%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{M \cdot \left(D \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{\color{blue}{\left(M \cdot \frac{0.5}{d}\right) \cdot D}}}} \]
    8. associate-*r*84.8%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{M \cdot \left(D \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{\color{blue}{M \cdot \left(\frac{0.5}{d} \cdot D\right)}}}} \]
    9. *-commutative84.8%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{M \cdot \left(D \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{M \cdot \color{blue}{\left(D \cdot \frac{0.5}{d}\right)}}}} \]
  8. Applied egg-rr84.8%

    \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\color{blue}{\frac{1}{M \cdot \left(D \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}}} \]
  9. Step-by-step derivation
    1. associate-*l/84.8%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\color{blue}{\frac{1 \cdot \frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}}} \]
    2. *-lft-identity84.8%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\color{blue}{\frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}} \]
  10. Simplified84.8%

    \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\color{blue}{\frac{\frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}}} \]
  11. Step-by-step derivation
    1. associate-/r/86.3%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}} \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}} \]
    2. associate-*r*84.8%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\ell}{\color{blue}{\left(M \cdot D\right) \cdot \frac{0.5}{d}}}} \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)} \]
    3. associate-*r*87.0%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\ell}{\left(M \cdot D\right) \cdot \frac{0.5}{d}}} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}} \]
  12. Applied egg-rr87.0%

    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\frac{\ell}{\left(M \cdot D\right) \cdot \frac{0.5}{d}}} \cdot \left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}} \]
  13. Final simplification87.0%

    \[\leadsto w0 \cdot \sqrt{1 - \left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right) \cdot \frac{h}{\frac{\ell}{\left(M \cdot D\right) \cdot \frac{0.5}{d}}}} \]

Alternative 2: 86.5% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := M \cdot \left(D \cdot \frac{0.5}{d}\right)\\ \mathbf{if}\;\frac{h}{\ell} \leq -\infty \lor \neg \left(\frac{h}{\ell} \leq -2 \cdot 10^{-238}\right):\\ \;\;\;\;w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - t_0 \cdot \left(\frac{h}{\ell} \cdot t_0\right)}\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (* M (* D (/ 0.5 d)))))
   (if (or (<= (/ h l) (- INFINITY)) (not (<= (/ h l) -2e-238)))
     (+ w0 (* -0.125 (* w0 (/ (* h (pow (/ D (/ d M)) 2.0)) l))))
     (* w0 (sqrt (- 1.0 (* t_0 (* (/ h l) t_0))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = M * (D * (0.5 / d));
	double tmp;
	if (((h / l) <= -((double) INFINITY)) || !((h / l) <= -2e-238)) {
		tmp = w0 + (-0.125 * (w0 * ((h * pow((D / (d / M)), 2.0)) / l)));
	} else {
		tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
	}
	return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = M * (D * (0.5 / d));
	double tmp;
	if (((h / l) <= -Double.POSITIVE_INFINITY) || !((h / l) <= -2e-238)) {
		tmp = w0 + (-0.125 * (w0 * ((h * Math.pow((D / (d / M)), 2.0)) / l)));
	} else {
		tmp = w0 * Math.sqrt((1.0 - (t_0 * ((h / l) * t_0))));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	t_0 = M * (D * (0.5 / d))
	tmp = 0
	if ((h / l) <= -math.inf) or not ((h / l) <= -2e-238):
		tmp = w0 + (-0.125 * (w0 * ((h * math.pow((D / (d / M)), 2.0)) / l)))
	else:
		tmp = w0 * math.sqrt((1.0 - (t_0 * ((h / l) * t_0))))
	return tmp
function code(w0, M, D, h, l, d)
	t_0 = Float64(M * Float64(D * Float64(0.5 / d)))
	tmp = 0.0
	if ((Float64(h / l) <= Float64(-Inf)) || !(Float64(h / l) <= -2e-238))
		tmp = Float64(w0 + Float64(-0.125 * Float64(w0 * Float64(Float64(h * (Float64(D / Float64(d / M)) ^ 2.0)) / l))));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(Float64(h / l) * t_0)))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = M * (D * (0.5 / d));
	tmp = 0.0;
	if (((h / l) <= -Inf) || ~(((h / l) <= -2e-238)))
		tmp = w0 + (-0.125 * (w0 * ((h * ((D / (d / M)) ^ 2.0)) / l)));
	else
		tmp = w0 * sqrt((1.0 - (t_0 * ((h / l) * t_0))));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(h / l), $MachinePrecision], -2e-238]], $MachinePrecision]], N[(w0 + N[(-0.125 * N[(w0 * N[(N[(h * N[Power[N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := M \cdot \left(D \cdot \frac{0.5}{d}\right)\\
\mathbf{if}\;\frac{h}{\ell} \leq -\infty \lor \neg \left(\frac{h}{\ell} \leq -2 \cdot 10^{-238}\right):\\
\;\;\;\;w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}\right)\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t_0 \cdot \left(\frac{h}{\ell} \cdot t_0\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 h l) < -inf.0 or -2e-238 < (/.f64 h l)

    1. Initial program 80.3%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified79.5%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    3. Taylor expanded in D around 0 55.7%

      \[\leadsto \color{blue}{w0 + -0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w0\right)\right)}{{d}^{2} \cdot \ell}} \]
    4. Step-by-step derivation
      1. expm1-log1p-u51.8%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w0\right)\right)}{{d}^{2} \cdot \ell}\right)\right)} \]
      2. expm1-udef51.8%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w0\right)\right)}{{d}^{2} \cdot \ell}\right)} - 1\right)} \]
      3. associate-*r*52.6%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot \left(h \cdot w0\right)}}{{d}^{2} \cdot \ell}\right)} - 1\right) \]
      4. pow-prod-down66.3%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{{\left(D \cdot M\right)}^{2}} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} - 1\right) \]
      5. *-commutative66.3%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot \left(h \cdot w0\right)}{\color{blue}{\ell \cdot {d}^{2}}}\right)} - 1\right) \]
    5. Applied egg-rr66.3%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot \left(h \cdot w0\right)}{\ell \cdot {d}^{2}}\right)} - 1\right)} \]
    6. Step-by-step derivation
      1. expm1-def66.3%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot \left(h \cdot w0\right)}{\ell \cdot {d}^{2}}\right)\right)} \]
      2. expm1-log1p71.0%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\frac{{\left(D \cdot M\right)}^{2} \cdot \left(h \cdot w0\right)}{\ell \cdot {d}^{2}}} \]
      3. associate-*r*74.0%

        \[\leadsto w0 + -0.125 \cdot \frac{\color{blue}{\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot w0}}{\ell \cdot {d}^{2}} \]
      4. *-commutative74.0%

        \[\leadsto w0 + -0.125 \cdot \frac{\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot w0}{\color{blue}{{d}^{2} \cdot \ell}} \]
      5. times-frac71.1%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(\frac{{\left(D \cdot M\right)}^{2} \cdot h}{{d}^{2}} \cdot \frac{w0}{\ell}\right)} \]
      6. associate-/l*71.7%

        \[\leadsto w0 + -0.125 \cdot \left(\color{blue}{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}}} \cdot \frac{w0}{\ell}\right) \]
    7. Simplified71.7%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}} \cdot \frac{w0}{\ell}\right)} \]
    8. Step-by-step derivation
      1. associate-*r/76.8%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\frac{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}} \cdot w0}{\ell}} \]
      2. add-sqr-sqrt66.5%

        \[\leadsto w0 + -0.125 \cdot \frac{\color{blue}{\left(\sqrt{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}}} \cdot \sqrt{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}}}\right)} \cdot w0}{\ell} \]
      3. pow266.5%

        \[\leadsto w0 + -0.125 \cdot \frac{\color{blue}{{\left(\sqrt{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}}}\right)}^{2}} \cdot w0}{\ell} \]
      4. sqrt-div32.0%

        \[\leadsto w0 + -0.125 \cdot \frac{{\color{blue}{\left(\frac{\sqrt{{\left(D \cdot M\right)}^{2}}}{\sqrt{\frac{{d}^{2}}{h}}}\right)}}^{2} \cdot w0}{\ell} \]
      5. unpow232.0%

        \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{\sqrt{\color{blue}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}}}{\sqrt{\frac{{d}^{2}}{h}}}\right)}^{2} \cdot w0}{\ell} \]
      6. sqrt-prod20.3%

        \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{\color{blue}{\sqrt{D \cdot M} \cdot \sqrt{D \cdot M}}}{\sqrt{\frac{{d}^{2}}{h}}}\right)}^{2} \cdot w0}{\ell} \]
      7. add-sqr-sqrt32.8%

        \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{\color{blue}{D \cdot M}}{\sqrt{\frac{{d}^{2}}{h}}}\right)}^{2} \cdot w0}{\ell} \]
      8. sqrt-div32.9%

        \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{D \cdot M}{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h}}}}\right)}^{2} \cdot w0}{\ell} \]
      9. unpow232.9%

        \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{D \cdot M}{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell} \]
      10. sqrt-prod19.2%

        \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{D \cdot M}{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell} \]
      11. add-sqr-sqrt38.0%

        \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{D \cdot M}{\frac{\color{blue}{d}}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell} \]
    9. Applied egg-rr38.0%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\frac{{\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell}} \]
    10. Step-by-step derivation
      1. expm1-log1p-u35.4%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell}\right)\right)} \]
      2. expm1-udef35.4%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{{\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell}\right)} - 1\right)} \]
      3. associate-*r/32.5%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2} \cdot \frac{w0}{\ell}}\right)} - 1\right) \]
      4. *-commutative32.5%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{w0}{\ell} \cdot {\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2}}\right)} - 1\right) \]
      5. associate-/r/32.5%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot {\color{blue}{\left(\frac{D \cdot M}{d} \cdot \sqrt{h}\right)}}^{2}\right)} - 1\right) \]
      6. unpow-prod-down32.5%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \color{blue}{\left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot {\left(\sqrt{h}\right)}^{2}\right)}\right)} - 1\right) \]
      7. *-commutative32.5%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{\color{blue}{M \cdot D}}{d}\right)}^{2} \cdot {\left(\sqrt{h}\right)}^{2}\right)\right)} - 1\right) \]
      8. pow232.5%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot \color{blue}{\left(\sqrt{h} \cdot \sqrt{h}\right)}\right)\right)} - 1\right) \]
      9. add-sqr-sqrt79.3%

        \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot \color{blue}{h}\right)\right)} - 1\right) \]
    11. Applied egg-rr79.3%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right)} - 1\right)} \]
    12. Step-by-step derivation
      1. expm1-def79.3%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right)\right)} \]
      2. expm1-log1p84.2%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right)} \]
      3. associate-*l/88.7%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\frac{w0 \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)}{\ell}} \]
      4. *-rgt-identity88.7%

        \[\leadsto w0 + -0.125 \cdot \frac{\color{blue}{\left(w0 \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right) \cdot 1}}{\ell} \]
      5. associate-*r/88.7%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(\left(w0 \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right) \cdot \frac{1}{\ell}\right)} \]
      6. associate-*l*89.4%

        \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(w0 \cdot \left(\left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right) \cdot \frac{1}{\ell}\right)\right)} \]
      7. associate-*r/89.4%

        \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \color{blue}{\frac{\left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right) \cdot 1}{\ell}}\right) \]
      8. *-rgt-identity89.4%

        \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \frac{\color{blue}{{\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h}}{\ell}\right) \]
      9. *-commutative89.4%

        \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \frac{\color{blue}{h \cdot {\left(\frac{M \cdot D}{d}\right)}^{2}}}{\ell}\right) \]
      10. *-commutative89.4%

        \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2}}{\ell}\right) \]
      11. associate-/l*88.7%

        \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\color{blue}{\left(\frac{D}{\frac{d}{M}}\right)}}^{2}}{\ell}\right) \]
    13. Simplified88.7%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(w0 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}\right)} \]

    if -inf.0 < (/.f64 h l) < -2e-238

    1. Initial program 78.8%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified78.8%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    3. Step-by-step derivation
      1. frac-times78.8%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2} \cdot \frac{h}{\ell}} \]
      2. *-commutative78.8%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
      3. expm1-log1p-u50.4%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
      4. expm1-udef50.4%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(e^{\mathsf{log1p}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)} - 1\right)}} \]
    4. Applied egg-rr78.8%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(1 + \frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}\right) - 1\right)}} \]
    5. Step-by-step derivation
      1. add-exp-log50.4%

        \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{e^{\log \left(1 + \frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}\right)}} - 1\right)} \]
      2. log1p-udef50.4%

        \[\leadsto w0 \cdot \sqrt{1 - \left(e^{\color{blue}{\mathsf{log1p}\left(\frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}\right)}} - 1\right)} \]
      3. expm1-udef50.4%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}\right)\right)}} \]
      4. expm1-log1p-u78.8%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\ell} \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}}} \]
      5. associate-*l/77.1%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h \cdot {\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}}{\ell}}} \]
      6. associate-/l*78.0%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\frac{\ell}{{\left(\left(D \cdot M\right) \cdot \frac{0.5}{d}\right)}^{2}}}}} \]
      7. associate-*l*78.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\ell}{{\color{blue}{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}}^{2}}}} \]
    6. Applied egg-rr78.0%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\frac{\ell}{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity78.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\color{blue}{1 \cdot \ell}}{{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}}}} \]
      2. unpow278.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1 \cdot \ell}{\color{blue}{\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}}}} \]
      3. times-frac78.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\color{blue}{\frac{1}{D \cdot \left(M \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}}} \]
      4. *-commutative78.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{\color{blue}{\left(M \cdot \frac{0.5}{d}\right) \cdot D}} \cdot \frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}} \]
      5. associate-*r*77.4%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{\color{blue}{M \cdot \left(\frac{0.5}{d} \cdot D\right)}} \cdot \frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}} \]
      6. *-commutative77.4%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{M \cdot \color{blue}{\left(D \cdot \frac{0.5}{d}\right)}} \cdot \frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}} \]
      7. *-commutative77.4%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{M \cdot \left(D \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{\color{blue}{\left(M \cdot \frac{0.5}{d}\right) \cdot D}}}} \]
      8. associate-*r*79.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{M \cdot \left(D \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{\color{blue}{M \cdot \left(\frac{0.5}{d} \cdot D\right)}}}} \]
      9. *-commutative79.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{1}{M \cdot \left(D \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{M \cdot \color{blue}{\left(D \cdot \frac{0.5}{d}\right)}}}} \]
    8. Applied egg-rr79.0%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\color{blue}{\frac{1}{M \cdot \left(D \cdot \frac{0.5}{d}\right)} \cdot \frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}}} \]
    9. Step-by-step derivation
      1. associate-*l/79.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\color{blue}{\frac{1 \cdot \frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}}} \]
      2. *-lft-identity79.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\color{blue}{\frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}} \]
    10. Simplified79.0%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\color{blue}{\frac{\frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}}}} \]
    11. Step-by-step derivation
      1. associate-/r/81.4%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\frac{\ell}{M \cdot \left(D \cdot \frac{0.5}{d}\right)}} \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}} \]
      2. associate-*r*79.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\ell}{\color{blue}{\left(M \cdot D\right) \cdot \frac{0.5}{d}}}} \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)} \]
      3. associate-*r*79.6%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\frac{\ell}{\left(M \cdot D\right) \cdot \frac{0.5}{d}}} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}} \]
    12. Applied egg-rr79.6%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\frac{\ell}{\left(M \cdot D\right) \cdot \frac{0.5}{d}}} \cdot \left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}} \]
    13. Step-by-step derivation
      1. *-commutative79.6%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right) \cdot \frac{h}{\frac{\ell}{\left(M \cdot D\right) \cdot \frac{0.5}{d}}}}} \]
      2. associate-*l*79.0%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)} \cdot \frac{h}{\frac{\ell}{\left(M \cdot D\right) \cdot \frac{0.5}{d}}}} \]
      3. associate-/r/79.8%

        \[\leadsto w0 \cdot \sqrt{1 - \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right) \cdot \color{blue}{\left(\frac{h}{\ell} \cdot \left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)\right)}} \]
      4. associate-*l*82.3%

        \[\leadsto w0 \cdot \sqrt{1 - \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right) \cdot \left(\frac{h}{\ell} \cdot \color{blue}{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}\right)} \]
    14. Simplified82.3%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right) \cdot \left(\frac{h}{\ell} \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification85.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -\infty \lor \neg \left(\frac{h}{\ell} \leq -2 \cdot 10^{-238}\right):\\ \;\;\;\;w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right) \cdot \left(\frac{h}{\ell} \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)\right)}\\ \end{array} \]

Alternative 3: 80.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}\right) \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (+ w0 (* -0.125 (* w0 (/ (* h (pow (/ D (/ d M)) 2.0)) l)))))
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 + (-0.125 * (w0 * ((h * pow((D / (d / M)), 2.0)) / l)));
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0 + ((-0.125d0) * (w0 * ((h * ((d / (d_1 / m)) ** 2.0d0)) / l)))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 + (-0.125 * (w0 * ((h * Math.pow((D / (d / M)), 2.0)) / l)));
}
def code(w0, M, D, h, l, d):
	return w0 + (-0.125 * (w0 * ((h * math.pow((D / (d / M)), 2.0)) / l)))
function code(w0, M, D, h, l, d)
	return Float64(w0 + Float64(-0.125 * Float64(w0 * Float64(Float64(h * (Float64(D / Float64(d / M)) ^ 2.0)) / l))))
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 + (-0.125 * (w0 * ((h * ((D / (d / M)) ^ 2.0)) / l)));
end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 + N[(-0.125 * N[(w0 * N[(N[(h * N[Power[N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}\right)
\end{array}
Derivation
  1. Initial program 79.6%

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Simplified79.2%

    \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
  3. Taylor expanded in D around 0 49.4%

    \[\leadsto \color{blue}{w0 + -0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w0\right)\right)}{{d}^{2} \cdot \ell}} \]
  4. Step-by-step derivation
    1. expm1-log1p-u44.0%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w0\right)\right)}{{d}^{2} \cdot \ell}\right)\right)} \]
    2. expm1-udef44.0%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w0\right)\right)}{{d}^{2} \cdot \ell}\right)} - 1\right)} \]
    3. associate-*r*45.1%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot \left(h \cdot w0\right)}}{{d}^{2} \cdot \ell}\right)} - 1\right) \]
    4. pow-prod-down55.4%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{{\left(D \cdot M\right)}^{2}} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} - 1\right) \]
    5. *-commutative55.4%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot \left(h \cdot w0\right)}{\color{blue}{\ell \cdot {d}^{2}}}\right)} - 1\right) \]
  5. Applied egg-rr55.4%

    \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot \left(h \cdot w0\right)}{\ell \cdot {d}^{2}}\right)} - 1\right)} \]
  6. Step-by-step derivation
    1. expm1-def55.4%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot \left(h \cdot w0\right)}{\ell \cdot {d}^{2}}\right)\right)} \]
    2. expm1-log1p62.5%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\frac{{\left(D \cdot M\right)}^{2} \cdot \left(h \cdot w0\right)}{\ell \cdot {d}^{2}}} \]
    3. associate-*r*66.2%

      \[\leadsto w0 + -0.125 \cdot \frac{\color{blue}{\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot w0}}{\ell \cdot {d}^{2}} \]
    4. *-commutative66.2%

      \[\leadsto w0 + -0.125 \cdot \frac{\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot w0}{\color{blue}{{d}^{2} \cdot \ell}} \]
    5. times-frac62.4%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(\frac{{\left(D \cdot M\right)}^{2} \cdot h}{{d}^{2}} \cdot \frac{w0}{\ell}\right)} \]
    6. associate-/l*63.9%

      \[\leadsto w0 + -0.125 \cdot \left(\color{blue}{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}}} \cdot \frac{w0}{\ell}\right) \]
  7. Simplified63.9%

    \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}} \cdot \frac{w0}{\ell}\right)} \]
  8. Step-by-step derivation
    1. associate-*r/69.5%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\frac{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}} \cdot w0}{\ell}} \]
    2. add-sqr-sqrt58.5%

      \[\leadsto w0 + -0.125 \cdot \frac{\color{blue}{\left(\sqrt{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}}} \cdot \sqrt{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}}}\right)} \cdot w0}{\ell} \]
    3. pow258.5%

      \[\leadsto w0 + -0.125 \cdot \frac{\color{blue}{{\left(\sqrt{\frac{{\left(D \cdot M\right)}^{2}}{\frac{{d}^{2}}{h}}}\right)}^{2}} \cdot w0}{\ell} \]
    4. sqrt-div33.0%

      \[\leadsto w0 + -0.125 \cdot \frac{{\color{blue}{\left(\frac{\sqrt{{\left(D \cdot M\right)}^{2}}}{\sqrt{\frac{{d}^{2}}{h}}}\right)}}^{2} \cdot w0}{\ell} \]
    5. unpow233.0%

      \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{\sqrt{\color{blue}{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}}}{\sqrt{\frac{{d}^{2}}{h}}}\right)}^{2} \cdot w0}{\ell} \]
    6. sqrt-prod20.6%

      \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{\color{blue}{\sqrt{D \cdot M} \cdot \sqrt{D \cdot M}}}{\sqrt{\frac{{d}^{2}}{h}}}\right)}^{2} \cdot w0}{\ell} \]
    7. add-sqr-sqrt33.5%

      \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{\color{blue}{D \cdot M}}{\sqrt{\frac{{d}^{2}}{h}}}\right)}^{2} \cdot w0}{\ell} \]
    8. sqrt-div33.6%

      \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{D \cdot M}{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{h}}}}\right)}^{2} \cdot w0}{\ell} \]
    9. unpow233.6%

      \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{D \cdot M}{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell} \]
    10. sqrt-prod19.4%

      \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{D \cdot M}{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell} \]
    11. add-sqr-sqrt38.4%

      \[\leadsto w0 + -0.125 \cdot \frac{{\left(\frac{D \cdot M}{\frac{\color{blue}{d}}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell} \]
  9. Applied egg-rr38.4%

    \[\leadsto w0 + -0.125 \cdot \color{blue}{\frac{{\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell}} \]
  10. Step-by-step derivation
    1. expm1-log1p-u35.2%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell}\right)\right)} \]
    2. expm1-udef35.2%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{{\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2} \cdot w0}{\ell}\right)} - 1\right)} \]
    3. associate-*r/32.0%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{{\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2} \cdot \frac{w0}{\ell}}\right)} - 1\right) \]
    4. *-commutative32.0%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{w0}{\ell} \cdot {\left(\frac{D \cdot M}{\frac{d}{\sqrt{h}}}\right)}^{2}}\right)} - 1\right) \]
    5. associate-/r/32.4%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot {\color{blue}{\left(\frac{D \cdot M}{d} \cdot \sqrt{h}\right)}}^{2}\right)} - 1\right) \]
    6. unpow-prod-down32.3%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \color{blue}{\left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot {\left(\sqrt{h}\right)}^{2}\right)}\right)} - 1\right) \]
    7. *-commutative32.3%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{\color{blue}{M \cdot D}}{d}\right)}^{2} \cdot {\left(\sqrt{h}\right)}^{2}\right)\right)} - 1\right) \]
    8. pow232.3%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot \color{blue}{\left(\sqrt{h} \cdot \sqrt{h}\right)}\right)\right)} - 1\right) \]
    9. add-sqr-sqrt67.4%

      \[\leadsto w0 + -0.125 \cdot \left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot \color{blue}{h}\right)\right)} - 1\right) \]
  11. Applied egg-rr67.4%

    \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right)} - 1\right)} \]
  12. Step-by-step derivation
    1. expm1-def67.6%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right)\right)} \]
    2. expm1-log1p75.3%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(\frac{w0}{\ell} \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right)} \]
    3. associate-*l/80.1%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\frac{w0 \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)}{\ell}} \]
    4. *-rgt-identity80.1%

      \[\leadsto w0 + -0.125 \cdot \frac{\color{blue}{\left(w0 \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right) \cdot 1}}{\ell} \]
    5. associate-*r/80.1%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(\left(w0 \cdot \left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right)\right) \cdot \frac{1}{\ell}\right)} \]
    6. associate-*l*80.8%

      \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(w0 \cdot \left(\left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right) \cdot \frac{1}{\ell}\right)\right)} \]
    7. associate-*r/80.8%

      \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \color{blue}{\frac{\left({\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h\right) \cdot 1}{\ell}}\right) \]
    8. *-rgt-identity80.8%

      \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \frac{\color{blue}{{\left(\frac{M \cdot D}{d}\right)}^{2} \cdot h}}{\ell}\right) \]
    9. *-commutative80.8%

      \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \frac{\color{blue}{h \cdot {\left(\frac{M \cdot D}{d}\right)}^{2}}}{\ell}\right) \]
    10. *-commutative80.8%

      \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2}}{\ell}\right) \]
    11. associate-/l*80.2%

      \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\color{blue}{\left(\frac{D}{\frac{d}{M}}\right)}}^{2}}{\ell}\right) \]
  13. Simplified80.2%

    \[\leadsto w0 + -0.125 \cdot \color{blue}{\left(w0 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}\right)} \]
  14. Final simplification80.2%

    \[\leadsto w0 + -0.125 \cdot \left(w0 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}}{\ell}\right) \]

Alternative 4: 67.7% accurate, 216.0× speedup?

\[\begin{array}{l} \\ w0 \end{array} \]
(FPCore (w0 M D h l d) :precision binary64 w0)
double code(double w0, double M, double D, double h, double l, double d) {
	return w0;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0;
}
def code(w0, M, D, h, l, d):
	return w0
function code(w0, M, D, h, l, d)
	return w0
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0;
end
code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}

\\
w0
\end{array}
Derivation
  1. Initial program 79.6%

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Simplified79.2%

    \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
  3. Taylor expanded in D around 0 67.9%

    \[\leadsto \color{blue}{w0} \]
  4. Final simplification67.9%

    \[\leadsto w0 \]

Reproduce

?
herbie shell --seed 2023332 
(FPCore (w0 M D h l d)
  :name "Henrywood and Agarwal, Equation (9a)"
  :precision binary64
  (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))