Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.3% → 89.2%
Time: 18.0s
Alternatives: 6
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 6 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.3% 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: 89.2% accurate, 1.8× speedup?

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - {\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}} \]
    2. un-div-inv76.5%

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{{\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2}}{\frac{\ell}{h}}} \]
    7. metadata-eval76.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}}{\ell}} \]
    2. add-sqr-sqrt41.8%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{\sqrt{\ell} \cdot \sqrt{\ell}}}} \]
    3. times-frac42.5%

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \color{blue}{\frac{\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)}{\sqrt{\ell} \cdot \sqrt{\ell}}}} \]
    3. add-sqr-sqrt84.4%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{\ell}}} \]
    4. *-un-lft-identity84.4%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{1 \cdot \ell}}} \]
    5. frac-times86.2%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto w0 \cdot \sqrt{1 - h \cdot \color{blue}{\frac{D \cdot \left(M \cdot \frac{0.5}{d}\right)}{\frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}}} \]
  14. Step-by-step derivation
    1. div-inv86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 71.9% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{D \cdot M}{d}\\ \mathbf{if}\;D \leq 1.12 \cdot 10^{+132}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.125, \left(t\_0 \cdot t\_0\right) \cdot \frac{w0 \cdot h}{\ell}, w0\right)\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (/ (* D M) d)))
   (if (<= D 1.12e+132) w0 (fma -0.125 (* (* t_0 t_0) (/ (* w0 h) l)) w0))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = (D * M) / d;
	double tmp;
	if (D <= 1.12e+132) {
		tmp = w0;
	} else {
		tmp = fma(-0.125, ((t_0 * t_0) * ((w0 * h) / l)), w0);
	}
	return tmp;
}
function code(w0, M, D, h, l, d)
	t_0 = Float64(Float64(D * M) / d)
	tmp = 0.0
	if (D <= 1.12e+132)
		tmp = w0;
	else
		tmp = fma(-0.125, Float64(Float64(t_0 * t_0) * Float64(Float64(w0 * h) / l)), w0);
	end
	return tmp
end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[D, 1.12e+132], w0, N[(-0.125 * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(N[(w0 * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{D \cdot M}{d}\\
\mathbf{if}\;D \leq 1.12 \cdot 10^{+132}:\\
\;\;\;\;w0\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.125, \left(t\_0 \cdot t\_0\right) \cdot \frac{w0 \cdot h}{\ell}, w0\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 1.12e132

    1. Initial program 78.5%

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

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

      \[\leadsto \color{blue}{w0} \]

    if 1.12e132 < D

    1. Initial program 65.9%

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

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

      \[\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}} \]
    5. Step-by-step derivation
      1. +-commutative37.1%

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

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

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot \left(h \cdot w0\right)}}{{d}^{2} \cdot \ell}, w0\right) \]
      4. unpow233.3%

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

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{\left(\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}, w0\right) \]
      6. swap-sqr53.8%

        \[\leadsto \mathsf{fma}\left(-0.125, \frac{\color{blue}{\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}, w0\right) \]
      7. unpow253.8%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.125, \frac{{\left(D \cdot M\right)}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}, w0\right)} \]
    7. Step-by-step derivation
      1. times-frac57.0%

        \[\leadsto \mathsf{fma}\left(-0.125, \color{blue}{\frac{{\left(D \cdot M\right)}^{2}}{{d}^{2}} \cdot \frac{h \cdot w0}{\ell}}, w0\right) \]
    8. Applied egg-rr57.0%

      \[\leadsto \mathsf{fma}\left(-0.125, \color{blue}{\frac{{\left(D \cdot M\right)}^{2}}{{d}^{2}} \cdot \frac{h \cdot w0}{\ell}}, w0\right) \]
    9. Step-by-step derivation
      1. add-sqr-sqrt57.0%

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

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

        \[\leadsto \mathsf{fma}\left(-0.125, \left(\frac{\color{blue}{{\left(D \cdot M\right)}^{\left(\frac{2}{2}\right)}}}{\sqrt{{d}^{2}}} \cdot \sqrt{\frac{{\left(D \cdot M\right)}^{2}}{{d}^{2}}}\right) \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
      4. metadata-eval36.9%

        \[\leadsto \mathsf{fma}\left(-0.125, \left(\frac{{\left(D \cdot M\right)}^{\color{blue}{1}}}{\sqrt{{d}^{2}}} \cdot \sqrt{\frac{{\left(D \cdot M\right)}^{2}}{{d}^{2}}}\right) \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
      5. pow136.9%

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

        \[\leadsto \mathsf{fma}\left(-0.125, \left(\frac{D \cdot M}{\color{blue}{{d}^{\left(\frac{2}{2}\right)}}} \cdot \sqrt{\frac{{\left(D \cdot M\right)}^{2}}{{d}^{2}}}\right) \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
      7. metadata-eval44.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(-0.125, \left(\frac{D \cdot M}{d} \cdot \frac{\color{blue}{{\left(D \cdot M\right)}^{\left(\frac{2}{2}\right)}}}{\sqrt{{d}^{2}}}\right) \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
      11. metadata-eval49.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \left(\frac{D \cdot M}{d} \cdot \frac{{\left(D \cdot M\right)}^{\color{blue}{1}}}{\sqrt{{d}^{2}}}\right) \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
      12. pow149.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \left(\frac{D \cdot M}{d} \cdot \frac{\color{blue}{D \cdot M}}{\sqrt{{d}^{2}}}\right) \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
      13. sqrt-pow165.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \left(\frac{D \cdot M}{d} \cdot \frac{D \cdot M}{\color{blue}{{d}^{\left(\frac{2}{2}\right)}}}\right) \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
      14. metadata-eval65.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \left(\frac{D \cdot M}{d} \cdot \frac{D \cdot M}{{d}^{\color{blue}{1}}}\right) \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
      15. pow165.1%

        \[\leadsto \mathsf{fma}\left(-0.125, \left(\frac{D \cdot M}{d} \cdot \frac{D \cdot M}{\color{blue}{d}}\right) \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
    10. Applied egg-rr65.1%

      \[\leadsto \mathsf{fma}\left(-0.125, \color{blue}{\left(\frac{D \cdot M}{d} \cdot \frac{D \cdot M}{d}\right)} \cdot \frac{h \cdot w0}{\ell}, w0\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq 1.12 \cdot 10^{+132}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.125, \left(\frac{D \cdot M}{d} \cdot \frac{D \cdot M}{d}\right) \cdot \frac{w0 \cdot h}{\ell}, w0\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 86.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ w0 \cdot \sqrt{1 - h \cdot \frac{D \cdot \left(\frac{0.5}{d} \cdot M\right)}{\frac{\ell}{0.5 \cdot \frac{D \cdot M}{d}}}} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (*
  w0
  (sqrt (- 1.0 (* h (/ (* D (* (/ 0.5 d) M)) (/ l (* 0.5 (/ (* D M) d)))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 - (h * ((D * ((0.5 / d) * M)) / (l / (0.5 * ((D * M) / d)))))));
}
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 - (h * ((d * ((0.5d0 / d_1) * m)) / (l / (0.5d0 * ((d * m) / d_1)))))))
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 - (h * ((D * ((0.5 / d) * M)) / (l / (0.5 * ((D * M) / d)))))));
}
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 - (h * ((D * ((0.5 / d) * M)) / (l / (0.5 * ((D * M) / d)))))))
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(Float64(D * Float64(Float64(0.5 / d) * M)) / Float64(l / Float64(0.5 * Float64(Float64(D * M) / d))))))))
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - (h * ((D * ((0.5 / d) * M)) / (l / (0.5 * ((D * M) / d)))))));
end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[(D * N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] / N[(l / N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
w0 \cdot \sqrt{1 - h \cdot \frac{D \cdot \left(\frac{0.5}{d} \cdot M\right)}{\frac{\ell}{0.5 \cdot \frac{D \cdot M}{d}}}}
\end{array}
Derivation
  1. Initial program 77.2%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - {\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}} \]
    2. un-div-inv76.5%

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{{\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2}}{\frac{\ell}{h}}} \]
    7. metadata-eval76.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}}{\ell}} \]
    2. add-sqr-sqrt41.8%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{\sqrt{\ell} \cdot \sqrt{\ell}}}} \]
    3. times-frac42.5%

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \color{blue}{\frac{\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)}{\sqrt{\ell} \cdot \sqrt{\ell}}}} \]
    3. add-sqr-sqrt84.4%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{\ell}}} \]
    4. *-un-lft-identity84.4%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{1 \cdot \ell}}} \]
    5. frac-times86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 88.0% accurate, 1.8× speedup?

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - {\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}} \]
    2. un-div-inv76.5%

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{{\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2}}{\frac{\ell}{h}}} \]
    7. metadata-eval76.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}}{\ell}} \]
    2. add-sqr-sqrt41.8%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{\sqrt{\ell} \cdot \sqrt{\ell}}}} \]
    3. times-frac42.5%

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \color{blue}{\frac{\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)}{\sqrt{\ell} \cdot \sqrt{\ell}}}} \]
    3. add-sqr-sqrt84.4%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{\ell}}} \]
    4. *-un-lft-identity84.4%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{1 \cdot \ell}}} \]
    5. frac-times86.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 89.2% accurate, 1.8× speedup?

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - {\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}} \]
    2. un-div-inv76.5%

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{{\left(\color{blue}{\left(M \cdot \frac{1}{2}\right)} \cdot \frac{D}{d}\right)}^{2}}{\frac{\ell}{h}}} \]
    7. metadata-eval76.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}}{\ell}} \]
    2. add-sqr-sqrt41.8%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{\sqrt{\ell} \cdot \sqrt{\ell}}}} \]
    3. times-frac42.5%

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \color{blue}{\frac{\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)}{\sqrt{\ell} \cdot \sqrt{\ell}}}} \]
    3. add-sqr-sqrt84.4%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{\ell}}} \]
    4. *-un-lft-identity84.4%

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \frac{\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)}{\color{blue}{1 \cdot \ell}}} \]
    5. frac-times86.2%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto w0 \cdot \sqrt{1 - h \cdot \color{blue}{\frac{D \cdot \left(M \cdot \frac{0.5}{d}\right)}{\frac{\ell}{D \cdot \left(M \cdot \frac{0.5}{d}\right)}}}} \]
  14. Step-by-step derivation
    1. div-inv86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 68.8% 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 77.2%

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

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

    \[\leadsto \color{blue}{w0} \]
  5. Final simplification68.5%

    \[\leadsto w0 \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024060 
(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))))))