| Alternative 1 | |
|---|---|
| Error | 18.6 |
| Cost | 104784 |
(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 (* (/ 0.5 d) (* M D)))
(t_1
(*
(fabs (/ d (sqrt (* h l))))
(+ 1.0 (* -0.5 (* (/ h l) (pow t_0 2.0))))))
(t_2 (* (pow (/ d h) 0.5) (pow (/ d l) 0.5)))
(t_3
(* t_2 (+ 1.0 (* (/ h l) (* (pow (/ (* M D) (* d 2.0)) 2.0) -0.5)))))
(t_4 (sqrt (/ d h))))
(if (<= t_3 -2e-128)
(* t_2 (- 1.0 (pow (* (sqrt (/ h l)) (* t_0 (sqrt 0.5))) 2.0)))
(if (<= t_3 1e-306)
t_1
(if (<= t_3 5e+273)
(*
t_4
(*
(sqrt (/ d l))
(+
1.0
(/ (* D (* M (/ 0.5 d))) (* d (/ (/ l h) (* M (* D -0.25))))))))
(if (<= t_3 INFINITY)
t_1
(*
(* t_4 (/ (sqrt d) (sqrt l)))
(+
1.0
(*
-0.5
(* 0.25 (/ (* (/ h d) (* D (* M D))) (* d (/ l M)))))))))))))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 = (0.5 / d) * (M * D);
double t_1 = fabs((d / sqrt((h * l)))) * (1.0 + (-0.5 * ((h / l) * pow(t_0, 2.0))));
double t_2 = pow((d / h), 0.5) * pow((d / l), 0.5);
double t_3 = t_2 * (1.0 + ((h / l) * (pow(((M * D) / (d * 2.0)), 2.0) * -0.5)));
double t_4 = sqrt((d / h));
double tmp;
if (t_3 <= -2e-128) {
tmp = t_2 * (1.0 - pow((sqrt((h / l)) * (t_0 * sqrt(0.5))), 2.0));
} else if (t_3 <= 1e-306) {
tmp = t_1;
} else if (t_3 <= 5e+273) {
tmp = t_4 * (sqrt((d / l)) * (1.0 + ((D * (M * (0.5 / d))) / (d * ((l / h) / (M * (D * -0.25)))))));
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (t_4 * (sqrt(d) / sqrt(l))) * (1.0 + (-0.5 * (0.25 * (((h / d) * (D * (M * D))) / (d * (l / M))))));
}
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 = (0.5 / d) * (M * D);
double t_1 = Math.abs((d / Math.sqrt((h * l)))) * (1.0 + (-0.5 * ((h / l) * Math.pow(t_0, 2.0))));
double t_2 = Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5);
double t_3 = t_2 * (1.0 + ((h / l) * (Math.pow(((M * D) / (d * 2.0)), 2.0) * -0.5)));
double t_4 = Math.sqrt((d / h));
double tmp;
if (t_3 <= -2e-128) {
tmp = t_2 * (1.0 - Math.pow((Math.sqrt((h / l)) * (t_0 * Math.sqrt(0.5))), 2.0));
} else if (t_3 <= 1e-306) {
tmp = t_1;
} else if (t_3 <= 5e+273) {
tmp = t_4 * (Math.sqrt((d / l)) * (1.0 + ((D * (M * (0.5 / d))) / (d * ((l / h) / (M * (D * -0.25)))))));
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (t_4 * (Math.sqrt(d) / Math.sqrt(l))) * (1.0 + (-0.5 * (0.25 * (((h / d) * (D * (M * D))) / (d * (l / M))))));
}
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 = (0.5 / d) * (M * D) t_1 = math.fabs((d / math.sqrt((h * l)))) * (1.0 + (-0.5 * ((h / l) * math.pow(t_0, 2.0)))) t_2 = math.pow((d / h), 0.5) * math.pow((d / l), 0.5) t_3 = t_2 * (1.0 + ((h / l) * (math.pow(((M * D) / (d * 2.0)), 2.0) * -0.5))) t_4 = math.sqrt((d / h)) tmp = 0 if t_3 <= -2e-128: tmp = t_2 * (1.0 - math.pow((math.sqrt((h / l)) * (t_0 * math.sqrt(0.5))), 2.0)) elif t_3 <= 1e-306: tmp = t_1 elif t_3 <= 5e+273: tmp = t_4 * (math.sqrt((d / l)) * (1.0 + ((D * (M * (0.5 / d))) / (d * ((l / h) / (M * (D * -0.25))))))) elif t_3 <= math.inf: tmp = t_1 else: tmp = (t_4 * (math.sqrt(d) / math.sqrt(l))) * (1.0 + (-0.5 * (0.25 * (((h / d) * (D * (M * D))) / (d * (l / M)))))) 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(Float64(0.5 / d) * Float64(M * D)) t_1 = Float64(abs(Float64(d / sqrt(Float64(h * l)))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (t_0 ^ 2.0))))) t_2 = Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) t_3 = Float64(t_2 * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * -0.5)))) t_4 = sqrt(Float64(d / h)) tmp = 0.0 if (t_3 <= -2e-128) tmp = Float64(t_2 * Float64(1.0 - (Float64(sqrt(Float64(h / l)) * Float64(t_0 * sqrt(0.5))) ^ 2.0))); elseif (t_3 <= 1e-306) tmp = t_1; elseif (t_3 <= 5e+273) tmp = Float64(t_4 * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(D * Float64(M * Float64(0.5 / d))) / Float64(d * Float64(Float64(l / h) / Float64(M * Float64(D * -0.25)))))))); elseif (t_3 <= Inf) tmp = t_1; else tmp = Float64(Float64(t_4 * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 + Float64(-0.5 * Float64(0.25 * Float64(Float64(Float64(h / d) * Float64(D * Float64(M * D))) / Float64(d * Float64(l / M))))))); 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 = (0.5 / d) * (M * D); t_1 = abs((d / sqrt((h * l)))) * (1.0 + (-0.5 * ((h / l) * (t_0 ^ 2.0)))); t_2 = ((d / h) ^ 0.5) * ((d / l) ^ 0.5); t_3 = t_2 * (1.0 + ((h / l) * ((((M * D) / (d * 2.0)) ^ 2.0) * -0.5))); t_4 = sqrt((d / h)); tmp = 0.0; if (t_3 <= -2e-128) tmp = t_2 * (1.0 - ((sqrt((h / l)) * (t_0 * sqrt(0.5))) ^ 2.0)); elseif (t_3 <= 1e-306) tmp = t_1; elseif (t_3 <= 5e+273) tmp = t_4 * (sqrt((d / l)) * (1.0 + ((D * (M * (0.5 / d))) / (d * ((l / h) / (M * (D * -0.25))))))); elseif (t_3 <= Inf) tmp = t_1; else tmp = (t_4 * (sqrt(d) / sqrt(l))) * (1.0 + (-0.5 * (0.25 * (((h / d) * (D * (M * D))) / (d * (l / M)))))); 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[(N[(0.5 / d), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * 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]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$3, -2e-128], N[(t$95$2 * N[(1.0 - N[Power[N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 1e-306], t$95$1, If[LessEqual[t$95$3, 5e+273], N[(t$95$4 * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(N[(l / h), $MachinePrecision] / N[(M * N[(D * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$1, N[(N[(t$95$4 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(0.25 * N[(N[(N[(h / d), $MachinePrecision] * N[(D * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 := \frac{0.5}{d} \cdot \left(M \cdot D\right)\\
t_1 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right| \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {t_0}^{2}\right)\right)\\
t_2 := {\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\\
t_3 := t_2 \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\right)\\
t_4 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t_3 \leq -2 \cdot 10^{-128}:\\
\;\;\;\;t_2 \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(t_0 \cdot \sqrt{0.5}\right)\right)}^{2}\right)\\
\mathbf{elif}\;t_3 \leq 10^{-306}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_3 \leq 5 \cdot 10^{+273}:\\
\;\;\;\;t_4 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{D \cdot \left(M \cdot \frac{0.5}{d}\right)}{d \cdot \frac{\frac{\ell}{h}}{M \cdot \left(D \cdot -0.25\right)}}\right)\right)\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(t_4 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 + -0.5 \cdot \left(0.25 \cdot \frac{\frac{h}{d} \cdot \left(D \cdot \left(M \cdot D\right)\right)}{d \cdot \frac{\ell}{M}}\right)\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)))) < -2.00000000000000011e-128Initial program 27.7
Applied egg-rr19.8
if -2.00000000000000011e-128 < (*.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)))) < 1.00000000000000003e-306 or 4.99999999999999961e273 < (*.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 50.7
Applied egg-rr53.7
Applied egg-rr8.9
if 1.00000000000000003e-306 < (*.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.99999999999999961e273Initial program 1.1
Simplified1.1
[Start]1.1 | \[ \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* [=>]1.1 | \[ \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 [=>]1.1 | \[ {\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 [=>]1.1 | \[ \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 [=>]1.1 | \[ \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 [=>]1.1 | \[ \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 [=>]1.1 | \[ \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 [=>]1.1 | \[ \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 [=>]1.1 | \[ \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 [=>]1.1 | \[ \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* [=>]1.1 | \[ \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 [=>]1.1 | \[ \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)
\] |
Applied egg-rr1.1
Applied egg-rr1.2
Applied egg-rr1.4
Simplified1.4
[Start]1.4 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\left(M \cdot \frac{0.5}{d}\right) \cdot D}{\sqrt{\frac{\ell}{h}} \cdot \left(\frac{\sqrt{\frac{\ell}{h}}}{\left(M \cdot 0.5\right) \cdot \left(D \cdot -0.5\right)} \cdot d\right)} + 1\right)\right)
\] |
|---|---|
associate-*r* [=>]1.4 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\left(M \cdot \frac{0.5}{d}\right) \cdot D}{\color{blue}{\left(\sqrt{\frac{\ell}{h}} \cdot \frac{\sqrt{\frac{\ell}{h}}}{\left(M \cdot 0.5\right) \cdot \left(D \cdot -0.5\right)}\right) \cdot d}} + 1\right)\right)
\] |
*-commutative [=>]1.4 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\left(M \cdot \frac{0.5}{d}\right) \cdot D}{\color{blue}{d \cdot \left(\sqrt{\frac{\ell}{h}} \cdot \frac{\sqrt{\frac{\ell}{h}}}{\left(M \cdot 0.5\right) \cdot \left(D \cdot -0.5\right)}\right)}} + 1\right)\right)
\] |
associate-*r/ [=>]1.4 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\left(M \cdot \frac{0.5}{d}\right) \cdot D}{d \cdot \color{blue}{\frac{\sqrt{\frac{\ell}{h}} \cdot \sqrt{\frac{\ell}{h}}}{\left(M \cdot 0.5\right) \cdot \left(D \cdot -0.5\right)}}} + 1\right)\right)
\] |
rem-square-sqrt [=>]1.4 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\left(M \cdot \frac{0.5}{d}\right) \cdot D}{d \cdot \frac{\color{blue}{\frac{\ell}{h}}}{\left(M \cdot 0.5\right) \cdot \left(D \cdot -0.5\right)}} + 1\right)\right)
\] |
associate-*l* [=>]1.4 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\left(M \cdot \frac{0.5}{d}\right) \cdot D}{d \cdot \frac{\frac{\ell}{h}}{\color{blue}{M \cdot \left(0.5 \cdot \left(D \cdot -0.5\right)\right)}}} + 1\right)\right)
\] |
*-commutative [=>]1.4 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\left(M \cdot \frac{0.5}{d}\right) \cdot D}{d \cdot \frac{\frac{\ell}{h}}{M \cdot \left(0.5 \cdot \color{blue}{\left(-0.5 \cdot D\right)}\right)}} + 1\right)\right)
\] |
associate-*r* [=>]1.4 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\left(M \cdot \frac{0.5}{d}\right) \cdot D}{d \cdot \frac{\frac{\ell}{h}}{M \cdot \color{blue}{\left(\left(0.5 \cdot -0.5\right) \cdot D\right)}}} + 1\right)\right)
\] |
metadata-eval [=>]1.4 | \[ \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\left(M \cdot \frac{0.5}{d}\right) \cdot D}{d \cdot \frac{\frac{\ell}{h}}{M \cdot \left(\color{blue}{-0.25} \cdot D\right)}} + 1\right)\right)
\] |
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)))) Initial program 64.0
Simplified63.9
[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)
\] |
|---|---|
metadata-eval [=>]64.0 | \[ \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 [=>]64.0 | \[ \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 [=>]64.0 | \[ \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 [=>]64.0 | \[ \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* [=>]64.0 | \[ \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 [=>]64.0 | \[ \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 [=>]63.9 | \[ \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 M around 0 58.1
Simplified57.6
[Start]58.1 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)\right)
\] |
|---|---|
associate-/r* [=>]57.2 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \color{blue}{\frac{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}{{d}^{2}}}\right)\right)
\] |
associate-/l/ [=>]58.1 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\right)\right)
\] |
associate-*r* [=>]58.2 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2} \cdot \ell}\right)\right)
\] |
*-commutative [<=]58.2 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{\color{blue}{\ell \cdot {d}^{2}}}\right)\right)
\] |
times-frac [=>]58.0 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{\ell} \cdot \frac{h}{{d}^{2}}\right)}\right)\right)
\] |
unpow2 [=>]58.0 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{{D}^{2} \cdot \color{blue}{\left(M \cdot M\right)}}{\ell} \cdot \frac{h}{{d}^{2}}\right)\right)\right)
\] |
associate-*r* [=>]57.7 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{\color{blue}{\left({D}^{2} \cdot M\right) \cdot M}}{\ell} \cdot \frac{h}{{d}^{2}}\right)\right)\right)
\] |
unpow2 [=>]57.7 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot M\right) \cdot M}{\ell} \cdot \frac{h}{{d}^{2}}\right)\right)\right)
\] |
unpow2 [=>]57.7 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{\ell} \cdot \frac{h}{\color{blue}{d \cdot d}}\right)\right)\right)
\] |
associate-/r* [=>]57.6 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{\ell} \cdot \color{blue}{\frac{\frac{h}{d}}{d}}\right)\right)\right)
\] |
Applied egg-rr53.7
Simplified53.7
[Start]53.7 | \[ \left(\sqrt{\frac{d}{h}} \cdot \left(\sqrt{d} \cdot \frac{1}{\sqrt{\ell}}\right)\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{\ell} \cdot \frac{\frac{h}{d}}{d}\right)\right)\right)
\] |
|---|---|
associate-*r/ [=>]53.7 | \[ \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{d} \cdot 1}{\sqrt{\ell}}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{\ell} \cdot \frac{\frac{h}{d}}{d}\right)\right)\right)
\] |
*-rgt-identity [=>]53.7 | \[ \left(\sqrt{\frac{d}{h}} \cdot \frac{\color{blue}{\sqrt{d}}}{\sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(0.25 \cdot \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{\ell} \cdot \frac{\frac{h}{d}}{d}\right)\right)\right)
\] |
Applied egg-rr50.7
Final simplification14.1
| Alternative 1 | |
|---|---|
| Error | 18.6 |
| Cost | 104784 |
| Alternative 2 | |
|---|---|
| Error | 14.4 |
| Cost | 104784 |
| Alternative 3 | |
|---|---|
| Error | 21.5 |
| Cost | 21716 |
| Alternative 4 | |
|---|---|
| Error | 17.9 |
| Cost | 21716 |
| Alternative 5 | |
|---|---|
| Error | 19.3 |
| Cost | 21452 |
| Alternative 6 | |
|---|---|
| Error | 20.4 |
| Cost | 21136 |
| Alternative 7 | |
|---|---|
| Error | 20.3 |
| Cost | 21136 |
| Alternative 8 | |
|---|---|
| Error | 19.5 |
| Cost | 21136 |
| Alternative 9 | |
|---|---|
| Error | 21.8 |
| Cost | 15184 |
| Alternative 10 | |
|---|---|
| Error | 22.0 |
| Cost | 15184 |
| Alternative 11 | |
|---|---|
| Error | 21.9 |
| Cost | 15184 |
| Alternative 12 | |
|---|---|
| Error | 22.3 |
| Cost | 15184 |
| Alternative 13 | |
|---|---|
| Error | 23.1 |
| Cost | 13384 |
| Alternative 14 | |
|---|---|
| Error | 22.3 |
| Cost | 13384 |
| Alternative 15 | |
|---|---|
| Error | 22.3 |
| Cost | 13384 |
| Alternative 16 | |
|---|---|
| Error | 26.8 |
| Cost | 7244 |
| Alternative 17 | |
|---|---|
| Error | 28.1 |
| Cost | 6916 |
| Alternative 18 | |
|---|---|
| Error | 43.2 |
| Cost | 6720 |
herbie shell --seed 2023073
(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)))))