| Alternative 1 | |
|---|---|
| Error | 13.8 |
| Cost | 96461 |
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ h l) (* (pow (/ (* M D) (* d 2.0)) 2.0) -0.5))))
(t_1 (sqrt (/ d l)))
(t_2 (pow (/ d h) 0.5))
(t_3 (* (* t_2 (pow (/ d l) 0.5)) t_0)))
(if (<= t_3 (- INFINITY))
(*
(sqrt (/ d h))
(* t_1 (/ (* D (/ M d)) (/ (* l -8.0) (* (/ M d) (* h D))))))
(if (or (<= t_3 -1e-247) (and (not (<= t_3 1e-151)) (<= t_3 4e+280)))
(* t_0 (* t_2 t_1))
(fabs (* d (pow (* h l) -0.5)))))))double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + ((h / l) * (pow(((M * D) / (d * 2.0)), 2.0) * -0.5));
double t_1 = sqrt((d / l));
double t_2 = pow((d / h), 0.5);
double t_3 = (t_2 * pow((d / l), 0.5)) * t_0;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = sqrt((d / h)) * (t_1 * ((D * (M / d)) / ((l * -8.0) / ((M / d) * (h * D)))));
} else if ((t_3 <= -1e-247) || (!(t_3 <= 1e-151) && (t_3 <= 4e+280))) {
tmp = t_0 * (t_2 * t_1);
} else {
tmp = fabs((d * pow((h * l), -0.5)));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + ((h / l) * (Math.pow(((M * D) / (d * 2.0)), 2.0) * -0.5));
double t_1 = Math.sqrt((d / l));
double t_2 = Math.pow((d / h), 0.5);
double t_3 = (t_2 * Math.pow((d / l), 0.5)) * t_0;
double tmp;
if (t_3 <= -Double.POSITIVE_INFINITY) {
tmp = Math.sqrt((d / h)) * (t_1 * ((D * (M / d)) / ((l * -8.0) / ((M / d) * (h * D)))));
} else if ((t_3 <= -1e-247) || (!(t_3 <= 1e-151) && (t_3 <= 4e+280))) {
tmp = t_0 * (t_2 * t_1);
} else {
tmp = Math.abs((d * Math.pow((h * l), -0.5)));
}
return tmp;
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
def code(d, h, l, M, D): t_0 = 1.0 + ((h / l) * (math.pow(((M * D) / (d * 2.0)), 2.0) * -0.5)) t_1 = math.sqrt((d / l)) t_2 = math.pow((d / h), 0.5) t_3 = (t_2 * math.pow((d / l), 0.5)) * t_0 tmp = 0 if t_3 <= -math.inf: tmp = math.sqrt((d / h)) * (t_1 * ((D * (M / d)) / ((l * -8.0) / ((M / d) * (h * D))))) elif (t_3 <= -1e-247) or (not (t_3 <= 1e-151) and (t_3 <= 4e+280)): tmp = t_0 * (t_2 * t_1) else: tmp = math.fabs((d * math.pow((h * l), -0.5))) return tmp
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function code(d, h, l, M, D) t_0 = Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * -0.5))) t_1 = sqrt(Float64(d / l)) t_2 = Float64(d / h) ^ 0.5 t_3 = Float64(Float64(t_2 * (Float64(d / l) ^ 0.5)) * t_0) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_1 * Float64(Float64(D * Float64(M / d)) / Float64(Float64(l * -8.0) / Float64(Float64(M / d) * Float64(h * D)))))); elseif ((t_3 <= -1e-247) || (!(t_3 <= 1e-151) && (t_3 <= 4e+280))) tmp = Float64(t_0 * Float64(t_2 * t_1)); else tmp = abs(Float64(d * (Float64(h * l) ^ -0.5))); end return tmp end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
function tmp_2 = code(d, h, l, M, D) t_0 = 1.0 + ((h / l) * ((((M * D) / (d * 2.0)) ^ 2.0) * -0.5)); t_1 = sqrt((d / l)); t_2 = (d / h) ^ 0.5; t_3 = (t_2 * ((d / l) ^ 0.5)) * t_0; tmp = 0.0; if (t_3 <= -Inf) tmp = sqrt((d / h)) * (t_1 * ((D * (M / d)) / ((l * -8.0) / ((M / d) * (h * D))))); elseif ((t_3 <= -1e-247) || (~((t_3 <= 1e-151)) && (t_3 <= 4e+280))) tmp = t_0 * (t_2 * t_1); else tmp = abs((d * ((h * l) ^ -0.5))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$2 * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision] / N[(N[(l * -8.0), $MachinePrecision] / N[(N[(M / d), $MachinePrecision] * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$3, -1e-247], And[N[Not[LessEqual[t$95$3, 1e-151]], $MachinePrecision], LessEqual[t$95$3, 4e+280]]], N[(t$95$0 * N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision], N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\begin{array}{l}
t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := {\left(\frac{d}{h}\right)}^{0.5}\\
t_3 := \left(t_2 \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot t_0\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_1 \cdot \frac{D \cdot \frac{M}{d}}{\frac{\ell \cdot -8}{\frac{M}{d} \cdot \left(h \cdot D\right)}}\right)\\
\mathbf{elif}\;t_3 \leq -1 \cdot 10^{-247} \lor \neg \left(t_3 \leq 10^{-151}\right) \land t_3 \leq 4 \cdot 10^{+280}:\\
\;\;\;\;t_0 \cdot \left(t_2 \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
\end{array}
Results
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -inf.0Initial program 64.0
Simplified62.0
[Start]64.0 | \[ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\] |
|---|---|
associate-*l* [=>]64.0 | \[ \color{blue}{{\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)}
\] |
metadata-eval [=>]64.0 | \[ {\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)
\] |
unpow1/2 [=>]64.0 | \[ \color{blue}{\sqrt{\frac{d}{h}}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)
\] |
metadata-eval [=>]64.0 | \[ \sqrt{\frac{d}{h}} \cdot \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)
\] |
unpow1/2 [=>]64.0 | \[ \sqrt{\frac{d}{h}} \cdot \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\right)
\] |
cancel-sign-sub-inv [=>]64.0 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(1 + \left(-\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)}\right)
\] |
+-commutative [=>]64.0 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\left(-\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell} + 1\right)}\right)
\] |
*-commutative [=>]64.0 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(-\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}}\right) \cdot \frac{h}{\ell} + 1\right)\right)
\] |
distribute-rgt-neg-in [=>]64.0 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(-\frac{1}{2}\right)\right)} \cdot \frac{h}{\ell} + 1\right)\right)
\] |
associate-*l* [=>]64.0 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\left(-\frac{1}{2}\right) \cdot \frac{h}{\ell}\right)} + 1\right)\right)
\] |
fma-def [=>]64.0 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\mathsf{fma}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}, \left(-\frac{1}{2}\right) \cdot \frac{h}{\ell}, 1\right)}\right)
\] |
Taylor expanded in M around inf 59.9
Simplified58.9
[Start]59.9 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)\right)
\] |
|---|---|
*-commutative [=>]59.9 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot -0.125\right)}\right)
\] |
associate-*l/ [=>]59.9 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{\left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right) \cdot -0.125}{{d}^{2} \cdot \ell}}\right)
\] |
times-frac [=>]60.8 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}} \cdot \frac{-0.125}{\ell}\right)}\right)
\] |
associate-*r* [=>]61.1 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2}} \cdot \frac{-0.125}{\ell}\right)\right)
\] |
associate-/l* [=>]61.0 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{\frac{{D}^{2} \cdot {M}^{2}}{\frac{{d}^{2}}{h}}} \cdot \frac{-0.125}{\ell}\right)\right)
\] |
associate-/r/ [=>]63.1 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot h\right)} \cdot \frac{-0.125}{\ell}\right)\right)
\] |
unpow2 [=>]63.1 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{{D}^{2} \cdot {M}^{2}}{\color{blue}{d \cdot d}} \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
*-commutative [=>]63.1 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{\color{blue}{{M}^{2} \cdot {D}^{2}}}{d \cdot d} \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
unpow2 [=>]63.1 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}}{d \cdot d} \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
unpow2 [=>]63.1 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}}{d \cdot d} \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
swap-sqr [<=]61.3 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\frac{\color{blue}{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}}{d \cdot d} \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
times-frac [=>]59.6 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}\right)} \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
associate-/l* [=>]59.7 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot \frac{M \cdot D}{d}\right) \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
associate-/r/ [=>]59.6 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\left(\color{blue}{\left(\frac{M}{d} \cdot D\right)} \cdot \frac{M \cdot D}{d}\right) \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
*-commutative [=>]59.6 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\left(\color{blue}{\left(D \cdot \frac{M}{d}\right)} \cdot \frac{M \cdot D}{d}\right) \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
associate-/l* [=>]59.1 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\left(\left(D \cdot \frac{M}{d}\right) \cdot \color{blue}{\frac{M}{\frac{d}{D}}}\right) \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
associate-/r/ [=>]58.9 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\left(\left(D \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(\frac{M}{d} \cdot D\right)}\right) \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
*-commutative [=>]58.9 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\left(\left(D \cdot \frac{M}{d}\right) \cdot \color{blue}{\left(D \cdot \frac{M}{d}\right)}\right) \cdot h\right) \cdot \frac{-0.125}{\ell}\right)\right)
\] |
Applied egg-rr43.8
if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -1e-247 or 9.9999999999999994e-152 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 4.0000000000000001e280Initial program 0.8
Applied egg-rr29.0
Simplified0.8
[Start]29.0 | \[ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\frac{d}{\ell}}\right)} - 1\right)\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\] |
|---|---|
expm1-def [=>]2.9 | \[ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{\ell}}\right)\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\] |
expm1-log1p [=>]0.8 | \[ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\] |
if -1e-247 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 9.9999999999999994e-152 or 4.0000000000000001e280 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 51.9
Simplified52.1
[Start]51.9 | \[ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\] |
|---|---|
metadata-eval [=>]51.9 | \[ \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\] |
unpow1/2 [=>]51.9 | \[ \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\] |
metadata-eval [=>]51.9 | \[ \left(\sqrt{\frac{d}{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\] |
unpow1/2 [=>]51.9 | \[ \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\] |
associate-*l* [=>]51.9 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{\frac{1}{2} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)
\] |
metadata-eval [=>]51.9 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \color{blue}{0.5} \cdot \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)
\] |
times-frac [=>]52.1 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{M}{2} \cdot \frac{D}{d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right)
\] |
Taylor expanded in d around inf 41.3
Simplified41.2
[Start]41.3 | \[ \sqrt{\frac{1}{\ell \cdot h}} \cdot d
\] |
|---|---|
*-commutative [=>]41.3 | \[ \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}}
\] |
associate-/r* [=>]41.2 | \[ d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}
\] |
Applied egg-rr45.1
Taylor expanded in l around 0 48.5
Simplified45.1
[Start]48.5 | \[ d \cdot {\left(e^{1.5 \cdot \left(-1 \cdot \log \ell + \log \left(\frac{1}{h}\right)\right)}\right)}^{0.3333333333333333}
\] |
|---|---|
distribute-lft-in [=>]48.5 | \[ d \cdot {\left(e^{\color{blue}{1.5 \cdot \left(-1 \cdot \log \ell\right) + 1.5 \cdot \log \left(\frac{1}{h}\right)}}\right)}^{0.3333333333333333}
\] |
associate-*r* [=>]48.5 | \[ d \cdot {\left(e^{\color{blue}{\left(1.5 \cdot -1\right) \cdot \log \ell} + 1.5 \cdot \log \left(\frac{1}{h}\right)}\right)}^{0.3333333333333333}
\] |
metadata-eval [=>]48.5 | \[ d \cdot {\left(e^{\color{blue}{-1.5} \cdot \log \ell + 1.5 \cdot \log \left(\frac{1}{h}\right)}\right)}^{0.3333333333333333}
\] |
log-rec [=>]48.5 | \[ d \cdot {\left(e^{-1.5 \cdot \log \ell + 1.5 \cdot \color{blue}{\left(-\log h\right)}}\right)}^{0.3333333333333333}
\] |
mul-1-neg [<=]48.5 | \[ d \cdot {\left(e^{-1.5 \cdot \log \ell + 1.5 \cdot \color{blue}{\left(-1 \cdot \log h\right)}}\right)}^{0.3333333333333333}
\] |
associate-*r* [=>]48.5 | \[ d \cdot {\left(e^{-1.5 \cdot \log \ell + \color{blue}{\left(1.5 \cdot -1\right) \cdot \log h}}\right)}^{0.3333333333333333}
\] |
metadata-eval [=>]48.5 | \[ d \cdot {\left(e^{-1.5 \cdot \log \ell + \color{blue}{-1.5} \cdot \log h}\right)}^{0.3333333333333333}
\] |
distribute-lft-in [<=]48.5 | \[ d \cdot {\left(e^{\color{blue}{-1.5 \cdot \left(\log \ell + \log h\right)}}\right)}^{0.3333333333333333}
\] |
log-prod [<=]45.1 | \[ d \cdot {\left(e^{-1.5 \cdot \color{blue}{\log \left(\ell \cdot h\right)}}\right)}^{0.3333333333333333}
\] |
log-pow [<=]45.0 | \[ d \cdot {\left(e^{\color{blue}{\log \left({\left(\ell \cdot h\right)}^{-1.5}\right)}}\right)}^{0.3333333333333333}
\] |
rem-exp-log [=>]45.1 | \[ d \cdot {\color{blue}{\left({\left(\ell \cdot h\right)}^{-1.5}\right)}}^{0.3333333333333333}
\] |
Applied egg-rr23.9
Final simplification13.7
| Alternative 1 | |
|---|---|
| Error | 13.8 |
| Cost | 96461 |
| Alternative 2 | |
|---|---|
| Error | 21.5 |
| Cost | 21665 |
| Alternative 3 | |
|---|---|
| Error | 21.5 |
| Cost | 21665 |
| Alternative 4 | |
|---|---|
| Error | 22.6 |
| Cost | 21533 |
| Alternative 5 | |
|---|---|
| Error | 21.2 |
| Cost | 21533 |
| Alternative 6 | |
|---|---|
| Error | 21.0 |
| Cost | 21533 |
| Alternative 7 | |
|---|---|
| Error | 21.7 |
| Cost | 21532 |
| Alternative 8 | |
|---|---|
| Error | 24.1 |
| Cost | 14736 |
| Alternative 9 | |
|---|---|
| Error | 23.6 |
| Cost | 13644 |
| Alternative 10 | |
|---|---|
| Error | 23.6 |
| Cost | 13580 |
| Alternative 11 | |
|---|---|
| Error | 23.7 |
| Cost | 13516 |
| Alternative 12 | |
|---|---|
| Error | 27.4 |
| Cost | 7308 |
| Alternative 13 | |
|---|---|
| Error | 33.6 |
| Cost | 6980 |
| Alternative 14 | |
|---|---|
| Error | 33.6 |
| Cost | 6980 |
| Alternative 15 | |
|---|---|
| Error | 44.5 |
| Cost | 6784 |
| Alternative 16 | |
|---|---|
| Error | 44.5 |
| Cost | 6720 |
| Alternative 17 | |
|---|---|
| Error | 61.5 |
| Cost | 64 |
herbie shell --seed 2023066
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))