| Alternative 1 | |
|---|---|
| Error | 25.19% |
| Cost | 27268 |
(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 (sqrt (/ (/ 1.0 l) h))))
(if (<= d -1.65e+212)
(* t_0 (- d))
(if (<= d -3.5e-130)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(+ 1.0 (* (* h (/ (pow (* 0.5 (* M (/ D d))) 2.0) l)) -0.5)))
(if (<= d -4e-187)
(-
(* (/ D (/ (/ d M) (* M D))) (* (sqrt (/ h (pow l 3.0))) 0.125))
(* d t_0))
(if (<= d 1.15e-285)
(*
(+ 1.0 (* (* (pow (* M (* D (/ 0.5 d))) 2.0) (/ h l)) -0.5))
(sqrt (* (/ d l) (/ d h))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+
1.0
(* -0.5 (* h (* (/ (pow (/ D (/ d M)) 2.0) l) 0.25)))))))))))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 = sqrt(((1.0 / l) / h));
double tmp;
if (d <= -1.65e+212) {
tmp = t_0 * -d;
} else if (d <= -3.5e-130) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 + ((h * (pow((0.5 * (M * (D / d))), 2.0) / l)) * -0.5));
} else if (d <= -4e-187) {
tmp = ((D / ((d / M) / (M * D))) * (sqrt((h / pow(l, 3.0))) * 0.125)) - (d * t_0);
} else if (d <= 1.15e-285) {
tmp = (1.0 + ((pow((M * (D * (0.5 / d))), 2.0) * (h / l)) * -0.5)) * sqrt(((d / l) * (d / h)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (-0.5 * (h * ((pow((D / (d / M)), 2.0) / l) * 0.25))));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((1.0d0 / l) / h))
if (d <= (-1.65d+212)) then
tmp = t_0 * -d
else if (d <= (-3.5d-130)) then
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0d0 + ((h * (((0.5d0 * (m * (d_1 / d))) ** 2.0d0) / l)) * (-0.5d0)))
else if (d <= (-4d-187)) then
tmp = ((d_1 / ((d / m) / (m * d_1))) * (sqrt((h / (l ** 3.0d0))) * 0.125d0)) - (d * t_0)
else if (d <= 1.15d-285) then
tmp = (1.0d0 + ((((m * (d_1 * (0.5d0 / d))) ** 2.0d0) * (h / l)) * (-0.5d0))) * sqrt(((d / l) * (d / h)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((-0.5d0) * (h * ((((d_1 / (d / m)) ** 2.0d0) / l) * 0.25d0))))
end if
code = tmp
end function
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 = Math.sqrt(((1.0 / l) / h));
double tmp;
if (d <= -1.65e+212) {
tmp = t_0 * -d;
} else if (d <= -3.5e-130) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l))) * (1.0 + ((h * (Math.pow((0.5 * (M * (D / d))), 2.0) / l)) * -0.5));
} else if (d <= -4e-187) {
tmp = ((D / ((d / M) / (M * D))) * (Math.sqrt((h / Math.pow(l, 3.0))) * 0.125)) - (d * t_0);
} else if (d <= 1.15e-285) {
tmp = (1.0 + ((Math.pow((M * (D * (0.5 / d))), 2.0) * (h / l)) * -0.5)) * Math.sqrt(((d / l) * (d / h)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (-0.5 * (h * ((Math.pow((D / (d / M)), 2.0) / l) * 0.25))));
}
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 = math.sqrt(((1.0 / l) / h)) tmp = 0 if d <= -1.65e+212: tmp = t_0 * -d elif d <= -3.5e-130: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l))) * (1.0 + ((h * (math.pow((0.5 * (M * (D / d))), 2.0) / l)) * -0.5)) elif d <= -4e-187: tmp = ((D / ((d / M) / (M * D))) * (math.sqrt((h / math.pow(l, 3.0))) * 0.125)) - (d * t_0) elif d <= 1.15e-285: tmp = (1.0 + ((math.pow((M * (D * (0.5 / d))), 2.0) * (h / l)) * -0.5)) * math.sqrt(((d / l) * (d / h))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (-0.5 * (h * ((math.pow((D / (d / M)), 2.0) / l) * 0.25)))) 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 = sqrt(Float64(Float64(1.0 / l) / h)) tmp = 0.0 if (d <= -1.65e+212) tmp = Float64(t_0 * Float64(-d)); elseif (d <= -3.5e-130) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 + Float64(Float64(h * Float64((Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0) / l)) * -0.5))); elseif (d <= -4e-187) tmp = Float64(Float64(Float64(D / Float64(Float64(d / M) / Float64(M * D))) * Float64(sqrt(Float64(h / (l ^ 3.0))) * 0.125)) - Float64(d * t_0)); elseif (d <= 1.15e-285) tmp = Float64(Float64(1.0 + Float64(Float64((Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0) * Float64(h / l)) * -0.5)) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64(Float64((Float64(D / Float64(d / M)) ^ 2.0) / l) * 0.25))))); 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 = sqrt(((1.0 / l) / h)); tmp = 0.0; if (d <= -1.65e+212) tmp = t_0 * -d; elseif (d <= -3.5e-130) tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 + ((h * (((0.5 * (M * (D / d))) ^ 2.0) / l)) * -0.5)); elseif (d <= -4e-187) tmp = ((D / ((d / M) / (M * D))) * (sqrt((h / (l ^ 3.0))) * 0.125)) - (d * t_0); elseif (d <= 1.15e-285) tmp = (1.0 + ((((M * (D * (0.5 / d))) ^ 2.0) * (h / l)) * -0.5)) * sqrt(((d / l) * (d / h))); else tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (-0.5 * (h * ((((D / (d / M)) ^ 2.0) / l) * 0.25)))); 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[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.65e+212], N[(t$95$0 * (-d)), $MachinePrecision], If[LessEqual[d, -3.5e-130], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h * N[(N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-187], N[(N[(N[(D / N[(N[(d / M), $MachinePrecision] / N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] - N[(d * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-285], N[(N[(1.0 + N[(N[(N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[(N[Power[N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * 0.25), $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 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{if}\;d \leq -1.65 \cdot 10^{+212}:\\
\;\;\;\;t_0 \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq -3.5 \cdot 10^{-130}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 + \left(h \cdot \frac{{\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right) \cdot -0.5\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-187}:\\
\;\;\;\;\frac{D}{\frac{\frac{d}{M}}{M \cdot D}} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot t_0\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-285}:\\
\;\;\;\;\left(1 + \left({\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot -0.5\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \left(\frac{{\left(\frac{D}{\frac{d}{M}}\right)}^{2}}{\ell} \cdot 0.25\right)\right)\right)\\
\end{array}
Results
if d < -1.65e212Initial program 49.35
Simplified47.09
[Start]49.35 | \[ \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 [=>]49.35 | \[ \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 [=>]49.35 | \[ \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 [=>]49.35 | \[ \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 [=>]49.35 | \[ \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* [=>]49.35 | \[ \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 [=>]49.35 | \[ \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 [=>]47.09 | \[ \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)
\] |
Applied egg-rr45.74
Taylor expanded in d around -inf 26.22
Simplified24.96
[Start]26.22 | \[ -1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)
\] |
|---|---|
associate-*r* [=>]26.22 | \[ \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}}
\] |
neg-mul-1 [<=]26.22 | \[ \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{\ell \cdot h}}
\] |
*-commutative [=>]26.22 | \[ \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)}
\] |
associate-/r* [=>]24.96 | \[ \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}} \cdot \left(-d\right)
\] |
if -1.65e212 < d < -3.4999999999999999e-130Initial program 30.74
Simplified31.21
[Start]30.74 | \[ \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 [=>]30.74 | \[ \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 [=>]30.74 | \[ \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 [=>]30.74 | \[ \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 [=>]30.75 | \[ \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* [=>]30.75 | \[ \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 [=>]30.75 | \[ \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 [=>]31.21 | \[ \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)
\] |
Applied egg-rr31.97
Simplified27.98
[Start]31.97 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(e^{\mathsf{log1p}\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)} - 1\right)\right)
\] |
|---|---|
expm1-def [=>]31.97 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}\right)
\] |
expm1-log1p [=>]31.21 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)
\] |
associate-*r/ [=>]29.48 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot h}{\ell}}\right)
\] |
associate-*l/ [<=]27.98 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell} \cdot h\right)}\right)
\] |
*-commutative [=>]27.98 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)}\right)
\] |
*-commutative [=>]27.98 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \color{blue}{\left(\frac{D}{d} \cdot 0.5\right)}\right)}^{2}}{\ell}\right)\right)
\] |
associate-*r* [=>]27.98 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\left(M \cdot \frac{D}{d}\right) \cdot 0.5\right)}}^{2}}{\ell}\right)\right)
\] |
Applied egg-rr18.21
if -3.4999999999999999e-130 < d < -4.0000000000000001e-187Initial program 51.82
Simplified54.63
[Start]51.82 | \[ \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.82 | \[ \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.82 | \[ \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.82 | \[ \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.82 | \[ \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.82 | \[ \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.82 | \[ \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 [=>]54.63 | \[ \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)
\] |
Applied egg-rr55.14
Taylor expanded in d around -inf 62.17
Simplified54.92
[Start]62.17 | \[ 0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) + -1 \cdot \left(d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)
\] |
|---|---|
mul-1-neg [=>]62.17 | \[ 0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) + \color{blue}{\left(-d \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)}
\] |
unsub-neg [=>]62.17 | \[ \color{blue}{0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) - d \cdot \sqrt{\frac{1}{\ell \cdot h}}}
\] |
*-commutative [=>]62.17 | \[ \color{blue}{\left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \cdot 0.125} - d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\] |
associate-*l* [=>]62.17 | \[ \color{blue}{\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right)} - d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\] |
associate-/l* [=>]63.99 | \[ \color{blue}{\frac{{D}^{2}}{\frac{d}{{M}^{2}}}} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\] |
unpow2 [=>]63.99 | \[ \frac{\color{blue}{D \cdot D}}{\frac{d}{{M}^{2}}} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\] |
associate-/l* [=>]62.06 | \[ \color{blue}{\frac{D}{\frac{\frac{d}{{M}^{2}}}{D}}} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\] |
unpow2 [=>]62.06 | \[ \frac{D}{\frac{\frac{d}{\color{blue}{M \cdot M}}}{D}} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\] |
associate-/r* [=>]60.54 | \[ \frac{D}{\frac{\color{blue}{\frac{\frac{d}{M}}{M}}}{D}} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\] |
associate-/l/ [=>]55.24 | \[ \frac{D}{\color{blue}{\frac{\frac{d}{M}}{D \cdot M}}} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{1}{\ell \cdot h}}
\] |
associate-/r* [=>]54.92 | \[ \frac{D}{\frac{\frac{d}{M}}{D \cdot M}} \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}
\] |
if -4.0000000000000001e-187 < d < 1.14999999999999998e-285Initial program 65.58
Applied egg-rr74.01
Simplified74.01
[Start]74.01 | \[ \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} + \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.5 \cdot \left({\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)
\] |
|---|---|
*-lft-identity [<=]74.01 | \[ \color{blue}{1 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} + \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(-0.5 \cdot \left({\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)
\] |
*-commutative [<=]74.01 | \[ 1 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} + \color{blue}{\left(-0.5 \cdot \left({\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}}
\] |
distribute-rgt-in [<=]74.01 | \[ \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left({\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}
\] |
*-commutative [=>]74.01 | \[ \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \color{blue}{\left({\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right) \cdot -0.5}\right)
\] |
if 1.14999999999999998e-285 < d Initial program 41.2
Simplified41.57
[Start]41.2 | \[ \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 [=>]41.2 | \[ \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 [=>]41.19 | \[ \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 [=>]41.19 | \[ \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 [=>]41.19 | \[ \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* [=>]41.19 | \[ \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 [=>]41.19 | \[ \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 [=>]41.57 | \[ \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)
\] |
Applied egg-rr42.22
Simplified39.65
[Start]42.22 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(e^{\mathsf{log1p}\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)} - 1\right)\right)
\] |
|---|---|
expm1-def [=>]42.22 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}\right)
\] |
expm1-log1p [=>]41.57 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left({\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)
\] |
associate-*r/ [=>]40.26 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot h}{\ell}}\right)
\] |
associate-*l/ [<=]39.65 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell} \cdot h\right)}\right)
\] |
*-commutative [=>]39.65 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)}\right)
\] |
*-commutative [=>]39.65 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \color{blue}{\left(\frac{D}{d} \cdot 0.5\right)}\right)}^{2}}{\ell}\right)\right)
\] |
associate-*r* [=>]39.65 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\left(M \cdot \frac{D}{d}\right) \cdot 0.5\right)}}^{2}}{\ell}\right)\right)
\] |
Applied egg-rr19.29
Simplified19.4
[Start]19.29 | \[ \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} + \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(\left(-0.5 \cdot h\right) \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\frac{\ell}{0.25}}\right)
\] |
|---|---|
*-lft-identity [<=]19.29 | \[ \color{blue}{1 \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} + \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(\left(-0.5 \cdot h\right) \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\frac{\ell}{0.25}}\right)
\] |
*-commutative [<=]19.29 | \[ 1 \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} + \color{blue}{\left(\left(-0.5 \cdot h\right) \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\frac{\ell}{0.25}}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}
\] |
distribute-rgt-in [<=]19.29 | \[ \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(-0.5 \cdot h\right) \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\frac{\ell}{0.25}}\right)}
\] |
associate-*l* [=>]19.29 | \[ \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \color{blue}{-0.5 \cdot \left(h \cdot \frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\frac{\ell}{0.25}}\right)}\right)
\] |
associate-/r/ [=>]19.29 | \[ \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \color{blue}{\left(\frac{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}}{\ell} \cdot 0.25\right)}\right)\right)
\] |
associate-/l* [<=]19.23 | \[ \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \left(\frac{{\color{blue}{\left(\frac{M \cdot D}{d}\right)}}^{2}}{\ell} \cdot 0.25\right)\right)\right)
\] |
*-commutative [<=]19.23 | \[ \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \left(\frac{{\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2}}{\ell} \cdot 0.25\right)\right)\right)
\] |
associate-/l* [=>]19.4 | \[ \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \left(\frac{{\color{blue}{\left(\frac{D}{\frac{d}{M}}\right)}}^{2}}{\ell} \cdot 0.25\right)\right)\right)
\] |
Final simplification26.78
| Alternative 1 | |
|---|---|
| Error | 25.19% |
| Cost | 27268 |
| Alternative 2 | |
|---|---|
| Error | 27.34% |
| Cost | 21580 |
| Alternative 3 | |
|---|---|
| Error | 28.68% |
| Cost | 21524 |
| Alternative 4 | |
|---|---|
| Error | 29.27% |
| Cost | 21448 |
| Alternative 5 | |
|---|---|
| Error | 28.96% |
| Cost | 21448 |
| Alternative 6 | |
|---|---|
| Error | 32.43% |
| Cost | 21136 |
| Alternative 7 | |
|---|---|
| Error | 28.38% |
| Cost | 21136 |
| Alternative 8 | |
|---|---|
| Error | 29.69% |
| Cost | 21060 |
| Alternative 9 | |
|---|---|
| Error | 28.08% |
| Cost | 21000 |
| Alternative 10 | |
|---|---|
| Error | 38.79% |
| Cost | 14928 |
| Alternative 11 | |
|---|---|
| Error | 30.79% |
| Cost | 14928 |
| Alternative 12 | |
|---|---|
| Error | 31.54% |
| Cost | 14928 |
| Alternative 13 | |
|---|---|
| Error | 38.3% |
| Cost | 13384 |
| Alternative 14 | |
|---|---|
| Error | 42.72% |
| Cost | 7176 |
| Alternative 15 | |
|---|---|
| Error | 42.5% |
| Cost | 7176 |
| Alternative 16 | |
|---|---|
| Error | 51.62% |
| Cost | 6980 |
| Alternative 17 | |
|---|---|
| Error | 51.57% |
| Cost | 6980 |
| Alternative 18 | |
|---|---|
| Error | 51.57% |
| Cost | 6980 |
| Alternative 19 | |
|---|---|
| Error | 68.39% |
| Cost | 6720 |
herbie shell --seed 2023102
(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)))))