| Alternative 1 | |
|---|---|
| Error | 25.28% |
| Cost | 27528 |
(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 (* D (* M (/ 0.5 d))))
(t_1 (sqrt (/ d h)))
(t_2 (* t_1 (/ (sqrt (- d)) (sqrt (- l)))))
(t_3 (- 1.0 (* 0.5 (* h (* t_0 (/ t_0 l))))))
(t_4 (* t_2 t_3)))
(if (<= d -2.8e+176)
(/ (- d) (sqrt (* l h)))
(if (<= d -9e-94)
t_4
(if (<= d -3.1e-136)
(*
t_2
(-
1.0
(*
0.5
(/ (* (* D M) (* M (/ D 2.0))) (* (/ l h) (* d (* d 2.0)))))))
(if (<= d -5e-309)
t_4
(if (<= d 2.4e+74)
(* t_3 (* t_1 (/ (sqrt d) (sqrt l))))
(/ d (* (sqrt h) (sqrt l))))))))))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 = D * (M * (0.5 / d));
double t_1 = sqrt((d / h));
double t_2 = t_1 * (sqrt(-d) / sqrt(-l));
double t_3 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
double t_4 = t_2 * t_3;
double tmp;
if (d <= -2.8e+176) {
tmp = -d / sqrt((l * h));
} else if (d <= -9e-94) {
tmp = t_4;
} else if (d <= -3.1e-136) {
tmp = t_2 * (1.0 - (0.5 * (((D * M) * (M * (D / 2.0))) / ((l / h) * (d * (d * 2.0))))));
} else if (d <= -5e-309) {
tmp = t_4;
} else if (d <= 2.4e+74) {
tmp = t_3 * (t_1 * (sqrt(d) / sqrt(l)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = d_1 * (m * (0.5d0 / d))
t_1 = sqrt((d / h))
t_2 = t_1 * (sqrt(-d) / sqrt(-l))
t_3 = 1.0d0 - (0.5d0 * (h * (t_0 * (t_0 / l))))
t_4 = t_2 * t_3
if (d <= (-2.8d+176)) then
tmp = -d / sqrt((l * h))
else if (d <= (-9d-94)) then
tmp = t_4
else if (d <= (-3.1d-136)) then
tmp = t_2 * (1.0d0 - (0.5d0 * (((d_1 * m) * (m * (d_1 / 2.0d0))) / ((l / h) * (d * (d * 2.0d0))))))
else if (d <= (-5d-309)) then
tmp = t_4
else if (d <= 2.4d+74) then
tmp = t_3 * (t_1 * (sqrt(d) / sqrt(l)))
else
tmp = d / (sqrt(h) * sqrt(l))
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 = D * (M * (0.5 / d));
double t_1 = Math.sqrt((d / h));
double t_2 = t_1 * (Math.sqrt(-d) / Math.sqrt(-l));
double t_3 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l))));
double t_4 = t_2 * t_3;
double tmp;
if (d <= -2.8e+176) {
tmp = -d / Math.sqrt((l * h));
} else if (d <= -9e-94) {
tmp = t_4;
} else if (d <= -3.1e-136) {
tmp = t_2 * (1.0 - (0.5 * (((D * M) * (M * (D / 2.0))) / ((l / h) * (d * (d * 2.0))))));
} else if (d <= -5e-309) {
tmp = t_4;
} else if (d <= 2.4e+74) {
tmp = t_3 * (t_1 * (Math.sqrt(d) / Math.sqrt(l)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
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 = D * (M * (0.5 / d)) t_1 = math.sqrt((d / h)) t_2 = t_1 * (math.sqrt(-d) / math.sqrt(-l)) t_3 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l)))) t_4 = t_2 * t_3 tmp = 0 if d <= -2.8e+176: tmp = -d / math.sqrt((l * h)) elif d <= -9e-94: tmp = t_4 elif d <= -3.1e-136: tmp = t_2 * (1.0 - (0.5 * (((D * M) * (M * (D / 2.0))) / ((l / h) * (d * (d * 2.0)))))) elif d <= -5e-309: tmp = t_4 elif d <= 2.4e+74: tmp = t_3 * (t_1 * (math.sqrt(d) / math.sqrt(l))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) 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(D * Float64(M * Float64(0.5 / d))) t_1 = sqrt(Float64(d / h)) t_2 = Float64(t_1 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) t_3 = Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 * Float64(t_0 / l))))) t_4 = Float64(t_2 * t_3) tmp = 0.0 if (d <= -2.8e+176) tmp = Float64(Float64(-d) / sqrt(Float64(l * h))); elseif (d <= -9e-94) tmp = t_4; elseif (d <= -3.1e-136) tmp = Float64(t_2 * Float64(1.0 - Float64(0.5 * Float64(Float64(Float64(D * M) * Float64(M * Float64(D / 2.0))) / Float64(Float64(l / h) * Float64(d * Float64(d * 2.0))))))); elseif (d <= -5e-309) tmp = t_4; elseif (d <= 2.4e+74) tmp = Float64(t_3 * Float64(t_1 * Float64(sqrt(d) / sqrt(l)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); 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 = D * (M * (0.5 / d)); t_1 = sqrt((d / h)); t_2 = t_1 * (sqrt(-d) / sqrt(-l)); t_3 = 1.0 - (0.5 * (h * (t_0 * (t_0 / l)))); t_4 = t_2 * t_3; tmp = 0.0; if (d <= -2.8e+176) tmp = -d / sqrt((l * h)); elseif (d <= -9e-94) tmp = t_4; elseif (d <= -3.1e-136) tmp = t_2 * (1.0 - (0.5 * (((D * M) * (M * (D / 2.0))) / ((l / h) * (d * (d * 2.0)))))); elseif (d <= -5e-309) tmp = t_4; elseif (d <= 2.4e+74) tmp = t_3 * (t_1 * (sqrt(d) / sqrt(l))); else tmp = d / (sqrt(h) * sqrt(l)); 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[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * t$95$3), $MachinePrecision]}, If[LessEqual[d, -2.8e+176], N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -9e-94], t$95$4, If[LessEqual[d, -3.1e-136], N[(t$95$2 * N[(1.0 - N[(0.5 * N[(N[(N[(D * M), $MachinePrecision] * N[(M * N[(D / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(l / h), $MachinePrecision] * N[(d * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-309], t$95$4, If[LessEqual[d, 2.4e+74], N[(t$95$3 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $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 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := t_1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
t_3 := 1 - 0.5 \cdot \left(h \cdot \left(t_0 \cdot \frac{t_0}{\ell}\right)\right)\\
t_4 := t_2 \cdot t_3\\
\mathbf{if}\;d \leq -2.8 \cdot 10^{+176}:\\
\;\;\;\;\frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;d \leq -9 \cdot 10^{-94}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;d \leq -3.1 \cdot 10^{-136}:\\
\;\;\;\;t_2 \cdot \left(1 - 0.5 \cdot \frac{\left(D \cdot M\right) \cdot \left(M \cdot \frac{D}{2}\right)}{\frac{\ell}{h} \cdot \left(d \cdot \left(d \cdot 2\right)\right)}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-309}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{+74}:\\
\;\;\;\;t_3 \cdot \left(t_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
Results
if d < -2.8000000000000002e176Initial program 43.96
Taylor expanded in d around inf 98.72
Simplified98.72
[Start]98.72 | \[ \sqrt{\frac{1}{\ell \cdot h}} \cdot d
\] |
|---|---|
*-commutative [=>]98.72 | \[ \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}}
\] |
associate-/l/ [<=]98.72 | \[ d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}
\] |
Applied egg-rr98.97
Simplified98.93
[Start]98.97 | \[ \frac{d \cdot \sqrt{\frac{-1}{h}}}{\sqrt{-\ell}}
\] |
|---|---|
associate-/l* [=>]98.93 | \[ \color{blue}{\frac{d}{\frac{\sqrt{-\ell}}{\sqrt{\frac{-1}{h}}}}}
\] |
Applied egg-rr24.5
Simplified24.39
[Start]24.5 | \[ d \cdot \frac{-1}{\sqrt{\ell \cdot h}}
\] |
|---|---|
*-commutative [=>]24.5 | \[ \color{blue}{\frac{-1}{\sqrt{\ell \cdot h}} \cdot d}
\] |
associate-*l/ [=>]24.39 | \[ \color{blue}{\frac{-1 \cdot d}{\sqrt{\ell \cdot h}}}
\] |
neg-mul-1 [<=]24.39 | \[ \frac{\color{blue}{-d}}{\sqrt{\ell \cdot h}}
\] |
if -2.8000000000000002e176 < d < -9.0000000000000004e-94 or -3.1e-136 < d < -4.9999999999999995e-309Initial program 39.74
Simplified40.6
[Start]39.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 [=>]39.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 [=>]39.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 [=>]39.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 [=>]39.74 | \[ \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* [=>]39.74 | \[ \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 [=>]39.74 | \[ \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 [=>]40.6 | \[ \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-rr41.32
Simplified37.52
[Start]41.32 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(e^{\mathsf{log1p}\left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)} - 1\right)\right)
\] |
|---|---|
expm1-def [=>]41.32 | \[ \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(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}\right)
\] |
expm1-log1p [=>]40.6 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)
\] |
associate-*r/ [=>]38.79 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right)
\] |
associate-*l/ [<=]38.26 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}}{\ell} \cdot h\right)}\right)
\] |
*-commutative [=>]38.26 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}\right)
\] |
*-commutative [=>]38.26 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\left(0.5 \cdot M\right)} \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)
\] |
associate-*r* [<=]38.26 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}}^{2}}{\ell}\right)\right)
\] |
metadata-eval [<=]38.26 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\frac{1}{2}} \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)
\] |
associate-/r/ [<=]38.27 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{1}{\frac{2}{M \cdot \frac{D}{d}}}\right)}}^{2}}{\ell}\right)\right)
\] |
associate-*r/ [=>]37.52 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{1}{\frac{2}{\color{blue}{\frac{M \cdot D}{d}}}}\right)}^{2}}{\ell}\right)\right)
\] |
associate-/l* [<=]37.52 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{1}{\color{blue}{\frac{2 \cdot d}{M \cdot D}}}\right)}^{2}}{\ell}\right)\right)
\] |
associate-/r/ [=>]37.52 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right)}}^{2}}{\ell}\right)\right)
\] |
*-commutative [=>]37.52 | \[ \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 D\right) \cdot \frac{1}{2 \cdot d}\right)}}^{2}}{\ell}\right)\right)
\] |
*-commutative [<=]37.52 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\left(D \cdot M\right)} \cdot \frac{1}{2 \cdot d}\right)}^{2}}{\ell}\right)\right)
\] |
associate-/r* [=>]37.52 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\left(D \cdot M\right) \cdot \color{blue}{\frac{\frac{1}{2}}{d}}\right)}^{2}}{\ell}\right)\right)
\] |
metadata-eval [=>]37.52 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\left(D \cdot M\right) \cdot \frac{\color{blue}{0.5}}{d}\right)}^{2}}{\ell}\right)\right)
\] |
Applied egg-rr36.67
Applied egg-rr28
if -9.0000000000000004e-94 < d < -3.1e-136Initial program 40.84
Simplified42.14
[Start]40.84 | \[ \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 [=>]40.84 | \[ \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 [=>]40.84 | \[ \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 [=>]40.84 | \[ \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 [=>]40.84 | \[ \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* [=>]40.84 | \[ \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 [=>]40.84 | \[ \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 [=>]42.14 | \[ \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-rr53.92
Applied egg-rr41.18
if -4.9999999999999995e-309 < d < 2.40000000000000008e74Initial program 43.1
Simplified44.45
[Start]43.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)
\] |
|---|---|
metadata-eval [=>]43.1 | \[ \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 [=>]43.1 | \[ \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 [=>]43.1 | \[ \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 [=>]43.1 | \[ \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* [=>]43.1 | \[ \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 [=>]43.1 | \[ \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 [=>]44.45 | \[ \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.33
Simplified41.65
[Start]45.33 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(e^{\mathsf{log1p}\left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)} - 1\right)\right)
\] |
|---|---|
expm1-def [=>]45.33 | \[ \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(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}\right)
\] |
expm1-log1p [=>]44.45 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)
\] |
associate-*r/ [=>]43.21 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right)
\] |
associate-*l/ [<=]42.61 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}}{\ell} \cdot h\right)}\right)
\] |
*-commutative [=>]42.61 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\left(h \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)}\right)
\] |
*-commutative [=>]42.61 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\left(0.5 \cdot M\right)} \cdot \frac{D}{d}\right)}^{2}}{\ell}\right)\right)
\] |
associate-*r* [<=]42.61 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}}^{2}}{\ell}\right)\right)
\] |
metadata-eval [<=]42.61 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\frac{1}{2}} \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)
\] |
associate-/r/ [<=]42.62 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\color{blue}{\left(\frac{1}{\frac{2}{M \cdot \frac{D}{d}}}\right)}}^{2}}{\ell}\right)\right)
\] |
associate-*r/ [=>]41.65 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{1}{\frac{2}{\color{blue}{\frac{M \cdot D}{d}}}}\right)}^{2}}{\ell}\right)\right)
\] |
associate-/l* [<=]41.66 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{1}{\color{blue}{\frac{2 \cdot d}{M \cdot D}}}\right)}^{2}}{\ell}\right)\right)
\] |
associate-/r/ [=>]41.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(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right)}}^{2}}{\ell}\right)\right)
\] |
*-commutative [=>]41.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 D\right) \cdot \frac{1}{2 \cdot d}\right)}}^{2}}{\ell}\right)\right)
\] |
*-commutative [<=]41.65 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\color{blue}{\left(D \cdot M\right)} \cdot \frac{1}{2 \cdot d}\right)}^{2}}{\ell}\right)\right)
\] |
associate-/r* [=>]41.65 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\left(D \cdot M\right) \cdot \color{blue}{\frac{\frac{1}{2}}{d}}\right)}^{2}}{\ell}\right)\right)
\] |
metadata-eval [=>]41.65 | \[ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\left(D \cdot M\right) \cdot \frac{\color{blue}{0.5}}{d}\right)}^{2}}{\ell}\right)\right)
\] |
Applied egg-rr39.9
Applied egg-rr32.34
Simplified32.31
[Start]32.34 | \[ \left(\sqrt{\frac{d}{h}} \cdot \left(\sqrt{d} \cdot \frac{1}{\sqrt{\ell}}\right)\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \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)\right)\right)
\] |
|---|---|
associate-*r/ [=>]32.31 | \[ \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{d} \cdot 1}{\sqrt{\ell}}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \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)\right)\right)
\] |
*-rgt-identity [=>]32.31 | \[ \left(\sqrt{\frac{d}{h}} \cdot \frac{\color{blue}{\sqrt{d}}}{\sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \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)\right)\right)
\] |
if 2.40000000000000008e74 < d Initial program 41.89
Taylor expanded in d around inf 27.29
Simplified26.55
[Start]27.29 | \[ \sqrt{\frac{1}{\ell \cdot h}} \cdot d
\] |
|---|---|
*-commutative [=>]27.29 | \[ \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}}
\] |
associate-/l/ [<=]26.55 | \[ d \cdot \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}}
\] |
Applied egg-rr21.76
Simplified12.52
[Start]21.76 | \[ \frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}
\] |
|---|---|
associate-/l/ [=>]12.52 | \[ \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}}
\] |
Final simplification26.45
| Alternative 1 | |
|---|---|
| Error | 25.28% |
| Cost | 27528 |
| Alternative 2 | |
|---|---|
| Error | 24.71% |
| Cost | 27408 |
| Alternative 3 | |
|---|---|
| Error | 29.84% |
| Cost | 21712 |
| Alternative 4 | |
|---|---|
| Error | 33.16% |
| Cost | 21580 |
| Alternative 5 | |
|---|---|
| Error | 30.76% |
| Cost | 20872 |
| Alternative 6 | |
|---|---|
| Error | 32.97% |
| Cost | 15448 |
| Alternative 7 | |
|---|---|
| Error | 32.86% |
| Cost | 15316 |
| Alternative 8 | |
|---|---|
| Error | 31.43% |
| Cost | 15312 |
| Alternative 9 | |
|---|---|
| Error | 35.29% |
| Cost | 14920 |
| Alternative 10 | |
|---|---|
| Error | 36.64% |
| Cost | 14600 |
| Alternative 11 | |
|---|---|
| Error | 37.45% |
| Cost | 13644 |
| Alternative 12 | |
|---|---|
| Error | 35.59% |
| Cost | 13644 |
| Alternative 13 | |
|---|---|
| Error | 37.48% |
| Cost | 13516 |
| Alternative 14 | |
|---|---|
| Error | 43.15% |
| Cost | 7180 |
| Alternative 15 | |
|---|---|
| Error | 42.4% |
| Cost | 6916 |
| Alternative 16 | |
|---|---|
| Error | 68.93% |
| Cost | 6720 |
herbie shell --seed 2023093
(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)))))