| Alternative 1 | |
|---|---|
| Error | 17.4 |
| Cost | 27396 |
(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 (/ d l)))
(t_1 (pow (/ d h) 0.5))
(t_2 (/ d (* (sqrt l) (sqrt h))))
(t_3
(* (+ 1.0 (* (pow (* M (* 0.5 (/ D d))) 2.0) (* (/ h l) -0.5))) t_2)))
(if (<= d -8.6e+109)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0)))))
(if (<= d -5e-298)
(*
(* t_1 (pow (/ d l) 0.5))
(- 1.0 (/ (* 0.5 (* h (pow (* 0.5 (/ (* D M) d)) 2.0))) l)))
(if (<= d 1.3e-66)
t_3
(if (<= d 53000000.0)
(*
(* t_0 t_1)
(- 1.0 (* 0.125 (* M (/ (* D (* h D)) (/ (* d d) (/ M l)))))))
(if (<= d 2.4e+145) t_3 t_2)))))))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((d / l));
double t_1 = pow((d / h), 0.5);
double t_2 = d / (sqrt(l) * sqrt(h));
double t_3 = (1.0 + (pow((M * (0.5 * (D / d))), 2.0) * ((h / l) * -0.5))) * t_2;
double tmp;
if (d <= -8.6e+109) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 + (-0.5 * ((h / l) * pow(((D / d) * (M / 2.0)), 2.0))));
} else if (d <= -5e-298) {
tmp = (t_1 * pow((d / l), 0.5)) * (1.0 - ((0.5 * (h * pow((0.5 * ((D * M) / d)), 2.0))) / l));
} else if (d <= 1.3e-66) {
tmp = t_3;
} else if (d <= 53000000.0) {
tmp = (t_0 * t_1) * (1.0 - (0.125 * (M * ((D * (h * D)) / ((d * d) / (M / l))))));
} else if (d <= 2.4e+145) {
tmp = t_3;
} else {
tmp = t_2;
}
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) :: tmp
t_0 = sqrt((d / l))
t_1 = (d / h) ** 0.5d0
t_2 = d / (sqrt(l) * sqrt(h))
t_3 = (1.0d0 + (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) * ((h / l) * (-0.5d0)))) * t_2
if (d <= (-8.6d+109)) then
tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0d0 + ((-0.5d0) * ((h / l) * (((d_1 / d) * (m / 2.0d0)) ** 2.0d0))))
else if (d <= (-5d-298)) then
tmp = (t_1 * ((d / l) ** 0.5d0)) * (1.0d0 - ((0.5d0 * (h * ((0.5d0 * ((d_1 * m) / d)) ** 2.0d0))) / l))
else if (d <= 1.3d-66) then
tmp = t_3
else if (d <= 53000000.0d0) then
tmp = (t_0 * t_1) * (1.0d0 - (0.125d0 * (m * ((d_1 * (h * d_1)) / ((d * d) / (m / l))))))
else if (d <= 2.4d+145) then
tmp = t_3
else
tmp = t_2
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((d / l));
double t_1 = Math.pow((d / h), 0.5);
double t_2 = d / (Math.sqrt(l) * Math.sqrt(h));
double t_3 = (1.0 + (Math.pow((M * (0.5 * (D / d))), 2.0) * ((h / l) * -0.5))) * t_2;
double tmp;
if (d <= -8.6e+109) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * t_0) * (1.0 + (-0.5 * ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0))));
} else if (d <= -5e-298) {
tmp = (t_1 * Math.pow((d / l), 0.5)) * (1.0 - ((0.5 * (h * Math.pow((0.5 * ((D * M) / d)), 2.0))) / l));
} else if (d <= 1.3e-66) {
tmp = t_3;
} else if (d <= 53000000.0) {
tmp = (t_0 * t_1) * (1.0 - (0.125 * (M * ((D * (h * D)) / ((d * d) / (M / l))))));
} else if (d <= 2.4e+145) {
tmp = t_3;
} else {
tmp = t_2;
}
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((d / l)) t_1 = math.pow((d / h), 0.5) t_2 = d / (math.sqrt(l) * math.sqrt(h)) t_3 = (1.0 + (math.pow((M * (0.5 * (D / d))), 2.0) * ((h / l) * -0.5))) * t_2 tmp = 0 if d <= -8.6e+109: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * t_0) * (1.0 + (-0.5 * ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0)))) elif d <= -5e-298: tmp = (t_1 * math.pow((d / l), 0.5)) * (1.0 - ((0.5 * (h * math.pow((0.5 * ((D * M) / d)), 2.0))) / l)) elif d <= 1.3e-66: tmp = t_3 elif d <= 53000000.0: tmp = (t_0 * t_1) * (1.0 - (0.125 * (M * ((D * (h * D)) / ((d * d) / (M / l)))))) elif d <= 2.4e+145: tmp = t_3 else: tmp = t_2 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(d / l)) t_1 = Float64(d / h) ^ 0.5 t_2 = Float64(d / Float64(sqrt(l) * sqrt(h))) t_3 = Float64(Float64(1.0 + Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5))) * t_2) tmp = 0.0 if (d <= -8.6e+109) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0))))); elseif (d <= -5e-298) tmp = Float64(Float64(t_1 * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * Float64(h * (Float64(0.5 * Float64(Float64(D * M) / d)) ^ 2.0))) / l))); elseif (d <= 1.3e-66) tmp = t_3; elseif (d <= 53000000.0) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 - Float64(0.125 * Float64(M * Float64(Float64(D * Float64(h * D)) / Float64(Float64(d * d) / Float64(M / l))))))); elseif (d <= 2.4e+145) tmp = t_3; else tmp = t_2; 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((d / l)); t_1 = (d / h) ^ 0.5; t_2 = d / (sqrt(l) * sqrt(h)); t_3 = (1.0 + (((M * (0.5 * (D / d))) ^ 2.0) * ((h / l) * -0.5))) * t_2; tmp = 0.0; if (d <= -8.6e+109) tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 + (-0.5 * ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0)))); elseif (d <= -5e-298) tmp = (t_1 * ((d / l) ^ 0.5)) * (1.0 - ((0.5 * (h * ((0.5 * ((D * M) / d)) ^ 2.0))) / l)); elseif (d <= 1.3e-66) tmp = t_3; elseif (d <= 53000000.0) tmp = (t_0 * t_1) * (1.0 - (0.125 * (M * ((D * (h * D)) / ((d * d) / (M / l)))))); elseif (d <= 2.4e+145) tmp = t_3; else tmp = t_2; 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[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$2 = N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(1.0 + N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[d, -8.6e+109], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-298], N[(N[(t$95$1 * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[(h * N[Power[N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.3e-66], t$95$3, If[LessEqual[d, 53000000.0], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(M * N[(N[(D * N[(h * D), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(M / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e+145], t$95$3, t$95$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)
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := {\left(\frac{d}{h}\right)}^{0.5}\\
t_2 := \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
t_3 := \left(1 + {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right) \cdot t_2\\
\mathbf{if}\;d \leq -8.6 \cdot 10^{+109}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\right) \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-298}:\\
\;\;\;\;\left(t_1 \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{0.5 \cdot \left(h \cdot {\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;d \leq 1.3 \cdot 10^{-66}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;d \leq 53000000:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - 0.125 \cdot \left(M \cdot \frac{D \cdot \left(h \cdot D\right)}{\frac{d \cdot d}{\frac{M}{\ell}}}\right)\right)\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{+145}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
Results
if d < -8.6000000000000001e109Initial program 28.0
Simplified27.5
[Start]28.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 [=>]28.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 [=>]28.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 [=>]28.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 [=>]28.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* [=>]28.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 [=>]28.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 [=>]27.5 | \[ \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-rr13.0
if -8.6000000000000001e109 < d < -5.0000000000000002e-298Initial program 25.6
Applied egg-rr24.5
if -5.0000000000000002e-298 < d < 1.2999999999999999e-66 or 5.3e7 < d < 2.39999999999999992e145Initial program 28.2
Simplified29.0
[Start]28.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 [=>]28.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 [=>]28.2 | \[ \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 [=>]28.2 | \[ \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 [=>]28.2 | \[ \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* [=>]28.2 | \[ \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 [=>]28.2 | \[ \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 [=>]29.0 | \[ \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-rr20.8
Simplified20.8
[Start]20.8 | \[ \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} + \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(\left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)
\] |
|---|---|
*-lft-identity [<=]20.8 | \[ \color{blue}{1 \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} + \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(\left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)
\] |
*-commutative [<=]20.8 | \[ 1 \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} + \color{blue}{\left(\left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}
\] |
distribute-rgt-in [<=]20.8 | \[ \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)}
\] |
*-commutative [=>]20.8 | \[ \frac{d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)
\] |
*-commutative [=>]20.8 | \[ \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \color{blue}{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \left(-0.5 \cdot \frac{h}{\ell}\right)}\right)
\] |
*-commutative [=>]20.8 | \[ \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2} \cdot \color{blue}{\left(\frac{h}{\ell} \cdot -0.5\right)}\right)
\] |
if 1.2999999999999999e-66 < d < 5.3e7Initial program 16.5
Taylor expanded in M around 0 25.6
Simplified24.6
[Start]25.6 | \[ \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 - 0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)
\] |
|---|---|
associate-*r/ [=>]25.6 | \[ \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 - \color{blue}{\frac{0.125 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right)
\] |
*-commutative [=>]25.6 | \[ \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 - \frac{0.125 \cdot \left({D}^{2} \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}\right)}{\ell \cdot {d}^{2}}\right)
\] |
associate-*r* [=>]26.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 - \frac{0.125 \cdot \color{blue}{\left(\left({D}^{2} \cdot h\right) \cdot {M}^{2}\right)}}{\ell \cdot {d}^{2}}\right)
\] |
associate-*r* [=>]26.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 - \frac{\color{blue}{\left(0.125 \cdot \left({D}^{2} \cdot h\right)\right) \cdot {M}^{2}}}{\ell \cdot {d}^{2}}\right)
\] |
associate-/l* [=>]26.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 - \color{blue}{\frac{0.125 \cdot \left({D}^{2} \cdot h\right)}{\frac{\ell \cdot {d}^{2}}{{M}^{2}}}}\right)
\] |
associate-*r/ [<=]26.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 - \color{blue}{0.125 \cdot \frac{{D}^{2} \cdot h}{\frac{\ell \cdot {d}^{2}}{{M}^{2}}}}\right)
\] |
unpow2 [=>]26.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 - 0.125 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot h}{\frac{\ell \cdot {d}^{2}}{{M}^{2}}}\right)
\] |
associate-*l* [=>]24.6 | \[ \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 - 0.125 \cdot \frac{\color{blue}{D \cdot \left(D \cdot h\right)}}{\frac{\ell \cdot {d}^{2}}{{M}^{2}}}\right)
\] |
*-commutative [=>]24.6 | \[ \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 - 0.125 \cdot \frac{D \cdot \left(D \cdot h\right)}{\frac{\color{blue}{{d}^{2} \cdot \ell}}{{M}^{2}}}\right)
\] |
unpow2 [=>]24.6 | \[ \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 - 0.125 \cdot \frac{D \cdot \left(D \cdot h\right)}{\frac{\color{blue}{\left(d \cdot d\right)} \cdot \ell}{{M}^{2}}}\right)
\] |
associate-*l* [=>]24.6 | \[ \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 - 0.125 \cdot \frac{D \cdot \left(D \cdot h\right)}{\frac{\color{blue}{d \cdot \left(d \cdot \ell\right)}}{{M}^{2}}}\right)
\] |
unpow2 [=>]24.6 | \[ \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 - 0.125 \cdot \frac{D \cdot \left(D \cdot h\right)}{\frac{d \cdot \left(d \cdot \ell\right)}{\color{blue}{M \cdot M}}}\right)
\] |
Applied egg-rr48.9
Simplified24.6
[Start]48.9 | \[ \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 - 0.125 \cdot \frac{D \cdot \left(D \cdot h\right)}{\frac{d \cdot \left(d \cdot \ell\right)}{M \cdot M}}\right)
\] |
|---|---|
expm1-def [=>]25.5 | \[ \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 - 0.125 \cdot \frac{D \cdot \left(D \cdot h\right)}{\frac{d \cdot \left(d \cdot \ell\right)}{M \cdot M}}\right)
\] |
expm1-log1p [=>]24.6 | \[ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - 0.125 \cdot \frac{D \cdot \left(D \cdot h\right)}{\frac{d \cdot \left(d \cdot \ell\right)}{M \cdot M}}\right)
\] |
Applied egg-rr18.4
if 2.39999999999999992e145 < d Initial program 28.2
Simplified28.0
[Start]28.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 [=>]28.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 [=>]28.2 | \[ \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 [=>]28.2 | \[ \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 [=>]28.2 | \[ \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* [=>]28.2 | \[ \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 [=>]28.2 | \[ \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 [=>]28.0 | \[ \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 15.7
Simplified14.9
[Start]15.7 | \[ \sqrt{\frac{1}{\ell \cdot h}} \cdot d
\] |
|---|---|
*-commutative [=>]15.7 | \[ \color{blue}{d \cdot \sqrt{\frac{1}{\ell \cdot h}}}
\] |
associate-/r* [=>]14.9 | \[ d \cdot \sqrt{\color{blue}{\frac{\frac{1}{\ell}}{h}}}
\] |
Applied egg-rr10.4
Simplified5.5
[Start]10.4 | \[ \frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}
\] |
|---|---|
associate-/l/ [=>]5.5 | \[ \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}}
\] |
Final simplification18.6
| Alternative 1 | |
|---|---|
| Error | 17.4 |
| Cost | 27396 |
| Alternative 2 | |
|---|---|
| Error | 20.9 |
| Cost | 21400 |
| Alternative 3 | |
|---|---|
| Error | 19.3 |
| Cost | 21268 |
| Alternative 4 | |
|---|---|
| Error | 19.0 |
| Cost | 21268 |
| Alternative 5 | |
|---|---|
| Error | 19.0 |
| Cost | 21268 |
| Alternative 6 | |
|---|---|
| Error | 23.4 |
| Cost | 14988 |
| Alternative 7 | |
|---|---|
| Error | 22.4 |
| Cost | 14988 |
| Alternative 8 | |
|---|---|
| Error | 22.6 |
| Cost | 14988 |
| Alternative 9 | |
|---|---|
| Error | 22.3 |
| Cost | 14660 |
| Alternative 10 | |
|---|---|
| Error | 22.1 |
| Cost | 14468 |
| Alternative 11 | |
|---|---|
| Error | 23.8 |
| Cost | 13252 |
| Alternative 12 | |
|---|---|
| Error | 27.2 |
| Cost | 7044 |
| Alternative 13 | |
|---|---|
| Error | 33.1 |
| Cost | 6980 |
| Alternative 14 | |
|---|---|
| Error | 43.7 |
| Cost | 6720 |
herbie shell --seed 2022356
(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)))))