| Alternative 1 | |
|---|---|
| Error | 19.7 |
| Cost | 11076 |
(FPCore (c0 w h D d M)
:precision binary64
(*
(/ c0 (* 2.0 w))
(+
(/ (* c0 (* d d)) (* (* w h) (* D D)))
(sqrt
(-
(*
(/ (* c0 (* d d)) (* (* w h) (* D D)))
(/ (* c0 (* d d)) (* (* w h) (* D D))))
(* M M))))))(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (/ c0 (* 2.0 w)))
(t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_2 (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 1e+301)
(* t_0 (* 2.0 (* d (/ (/ (/ c0 w) (* h (/ D d))) D))))
(if (<= t_2 INFINITY)
(pow
(* (/ (* (sqrt 0.5) (* c0 d)) (/ D (sqrt 2.0))) (/ (sqrt (/ 1.0 h)) w))
2.0)
(* 0.25 (* D (/ (/ (* h D) (/ d M)) (/ d M))))))))double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= 1e+301) {
tmp = t_0 * (2.0 * (d * (((c0 / w) / (h * (D / d))) / D)));
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow((((sqrt(0.5) * (c0 * d)) / (D / sqrt(2.0))) * (sqrt((1.0 / h)) / w)), 2.0);
} else {
tmp = 0.25 * (D * (((h * D) / (d / M)) / (d / M)));
}
return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + Math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= 1e+301) {
tmp = t_0 * (2.0 * (d * (((c0 / w) / (h * (D / d))) / D)));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = Math.pow((((Math.sqrt(0.5) * (c0 * d)) / (D / Math.sqrt(2.0))) * (Math.sqrt((1.0 / h)) / w)), 2.0);
} else {
tmp = 0.25 * (D * (((h * D) / (d / M)) / (d / M)));
}
return tmp;
}
def code(c0, w, h, D, d, M): return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))))
def code(c0, w, h, D, d, M): t_0 = c0 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) t_2 = t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M)))) tmp = 0 if t_2 <= 1e+301: tmp = t_0 * (2.0 * (d * (((c0 / w) / (h * (D / d))) / D))) elif t_2 <= math.inf: tmp = math.pow((((math.sqrt(0.5) * (c0 * d)) / (D / math.sqrt(2.0))) * (math.sqrt((1.0 / h)) / w)), 2.0) else: tmp = 0.25 * (D * (((h * D) / (d / M)) / (d / M))) return tmp
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) + sqrt(Float64(Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) * Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))) - Float64(M * M))))) end
function code(c0, w, h, D, d, M) t_0 = Float64(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_2 = Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= 1e+301) tmp = Float64(t_0 * Float64(2.0 * Float64(d * Float64(Float64(Float64(c0 / w) / Float64(h * Float64(D / d))) / D)))); elseif (t_2 <= Inf) tmp = Float64(Float64(Float64(sqrt(0.5) * Float64(c0 * d)) / Float64(D / sqrt(2.0))) * Float64(sqrt(Float64(1.0 / h)) / w)) ^ 2.0; else tmp = Float64(0.25 * Float64(D * Float64(Float64(Float64(h * D) / Float64(d / M)) / Float64(d / M)))); end return tmp end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M)))); end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M)))); tmp = 0.0; if (t_2 <= 1e+301) tmp = t_0 * (2.0 * (d * (((c0 / w) / (h * (D / d))) / D))); elseif (t_2 <= Inf) tmp = (((sqrt(0.5) * (c0 * d)) / (D / sqrt(2.0))) * (sqrt((1.0 / h)) / w)) ^ 2.0; else tmp = 0.25 * (D * (((h * D) / (d / M)) / (d / M))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 1e+301], N[(t$95$0 * N[(2.0 * N[(d * N[(N[(N[(c0 / w), $MachinePrecision] / N[(h * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[(N[(N[(N[Sqrt[0.5], $MachinePrecision] * N[(c0 * d), $MachinePrecision]), $MachinePrecision] / N[(D / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(0.25 * N[(D * N[(N[(N[(h * D), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\
\mathbf{if}\;t_2 \leq 10^{+301}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(d \cdot \frac{\frac{\frac{c0}{w}}{h \cdot \frac{D}{d}}}{D}\right)\right)\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;{\left(\frac{\sqrt{0.5} \cdot \left(c0 \cdot d\right)}{\frac{D}{\sqrt{2}}} \cdot \frac{\sqrt{\frac{1}{h}}}{w}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(D \cdot \frac{\frac{h \cdot D}{\frac{d}{M}}}{\frac{d}{M}}\right)\\
\end{array}
Results
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < 1.00000000000000005e301Initial program 34.7
Applied egg-rr34.9
Taylor expanded in c0 around inf 37.4
Simplified30.2
[Start]37.4 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)
\] |
|---|---|
times-frac [=>]41.5 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{{d}^{2}}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right)}\right)
\] |
*-commutative [=>]41.5 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}\right)}\right)
\] |
associate-/r* [=>]41.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \frac{{d}^{2}}{{D}^{2}}\right)\right)
\] |
unpow2 [=>]41.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \frac{\color{blue}{d \cdot d}}{{D}^{2}}\right)\right)
\] |
unpow2 [=>]41.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \frac{d \cdot d}{\color{blue}{D \cdot D}}\right)\right)
\] |
associate-/r* [=>]39.6 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}\right)\right)
\] |
associate-/l* [=>]38.6 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \frac{\color{blue}{\frac{d}{\frac{D}{d}}}}{D}\right)\right)
\] |
times-frac [<=]36.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{\frac{c0}{w} \cdot \frac{d}{\frac{D}{d}}}{h \cdot D}}\right)
\] |
associate-*l/ [<=]36.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{\frac{c0}{w}}{h \cdot D} \cdot \frac{d}{\frac{D}{d}}\right)}\right)
\] |
associate-/r* [<=]36.5 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\frac{c0}{w \cdot \left(h \cdot D\right)}} \cdot \frac{d}{\frac{D}{d}}\right)\right)
\] |
associate-*r/ [=>]32.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{\frac{c0}{w \cdot \left(h \cdot D\right)} \cdot d}{\frac{D}{d}}}\right)
\] |
associate-/r/ [=>]32.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{\frac{c0}{w \cdot \left(h \cdot D\right)} \cdot d}{D} \cdot d\right)}\right)
\] |
*-commutative [=>]32.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(d \cdot \frac{\frac{c0}{w \cdot \left(h \cdot D\right)} \cdot d}{D}\right)}\right)
\] |
associate-/r* [=>]31.9 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(d \cdot \frac{\color{blue}{\frac{\frac{c0}{w}}{h \cdot D}} \cdot d}{D}\right)\right)
\] |
associate-*l/ [=>]30.4 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(d \cdot \frac{\color{blue}{\frac{\frac{c0}{w} \cdot d}{h \cdot D}}}{D}\right)\right)
\] |
associate-/l* [=>]31.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(d \cdot \frac{\color{blue}{\frac{\frac{c0}{w}}{\frac{h \cdot D}{d}}}}{D}\right)\right)
\] |
*-commutative [=>]31.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(d \cdot \frac{\frac{\frac{c0}{w}}{\frac{\color{blue}{D \cdot h}}{d}}}{D}\right)\right)
\] |
associate-*l/ [<=]30.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(d \cdot \frac{\frac{\frac{c0}{w}}{\color{blue}{\frac{D}{d} \cdot h}}}{D}\right)\right)
\] |
*-commutative [=>]30.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(d \cdot \frac{\frac{\frac{c0}{w}}{\color{blue}{h \cdot \frac{D}{d}}}}{D}\right)\right)
\] |
if 1.00000000000000005e301 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0Initial program 64.0
Simplified62.7
[Start]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
|---|---|
times-frac [=>]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
fma-neg [=>]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right)
\] |
times-frac [=>]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}\right)
\] |
times-frac [=>]62.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}}, -M \cdot M\right)}\right)
\] |
Taylor expanded in c0 around inf 57.9
Simplified49.6
[Start]57.9 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)
\] |
|---|---|
*-commutative [=>]57.9 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)} \cdot 2\right)}
\] |
times-frac [=>]56.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(\frac{{d}^{2}}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right)} \cdot 2\right)
\] |
unpow2 [=>]56.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right) \cdot 2\right)
\] |
unpow2 [=>]56.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{c0}{w \cdot h}\right) \cdot 2\right)
\] |
associate-*l/ [<=]53.4 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\color{blue}{\left(\frac{d}{D \cdot D} \cdot d\right)} \cdot \frac{c0}{w \cdot h}\right) \cdot 2\right)
\] |
*-commutative [<=]53.4 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(\frac{c0}{w \cdot h} \cdot \left(\frac{d}{D \cdot D} \cdot d\right)\right)} \cdot 2\right)
\] |
associate-*l* [=>]53.4 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \left(\left(\frac{d}{D \cdot D} \cdot d\right) \cdot 2\right)\right)}
\] |
*-commutative [=>]53.4 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{\color{blue}{h \cdot w}} \cdot \left(\left(\frac{d}{D \cdot D} \cdot d\right) \cdot 2\right)\right)
\] |
associate-/r* [=>]53.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\frac{c0}{h}}{w}} \cdot \left(\left(\frac{d}{D \cdot D} \cdot d\right) \cdot 2\right)\right)
\] |
associate-/r* [=>]51.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\left(\color{blue}{\frac{\frac{d}{D}}{D}} \cdot d\right) \cdot 2\right)\right)
\] |
associate-*l/ [=>]49.9 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\color{blue}{\frac{\frac{d}{D} \cdot d}{D}} \cdot 2\right)\right)
\] |
associate-*r/ [<=]49.6 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot 2\right)\right)
\] |
unpow2 [<=]49.6 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\color{blue}{{\left(\frac{d}{D}\right)}^{2}} \cdot 2\right)\right)
\] |
Applied egg-rr42.5
Simplified40.0
[Start]42.5 | \[ {\left(\sqrt{\frac{c0}{\left(\left(2 \cdot \frac{w}{c0}\right) \cdot w\right) \cdot h}} \cdot \left(\frac{d}{D} \cdot \sqrt{2}\right)\right)}^{2}
\] |
|---|---|
*-commutative [=>]42.5 | \[ {\color{blue}{\left(\left(\frac{d}{D} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{c0}{\left(\left(2 \cdot \frac{w}{c0}\right) \cdot w\right) \cdot h}}\right)}}^{2}
\] |
associate-*l* [=>]42.5 | \[ {\left(\left(\frac{d}{D} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{c0}{\color{blue}{\left(2 \cdot \left(\frac{w}{c0} \cdot w\right)\right)} \cdot h}}\right)}^{2}
\] |
associate-*l* [=>]42.5 | \[ {\left(\left(\frac{d}{D} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{c0}{\color{blue}{2 \cdot \left(\left(\frac{w}{c0} \cdot w\right) \cdot h\right)}}}\right)}^{2}
\] |
associate-*r* [<=]40.0 | \[ {\left(\left(\frac{d}{D} \cdot \sqrt{2}\right) \cdot \sqrt{\frac{c0}{2 \cdot \color{blue}{\left(\frac{w}{c0} \cdot \left(w \cdot h\right)\right)}}}\right)}^{2}
\] |
Taylor expanded in d around 0 20.8
Simplified21.5
[Start]20.8 | \[ {\left(\frac{\sqrt{2} \cdot \left(\sqrt{0.5} \cdot \left(d \cdot c0\right)\right)}{D \cdot w} \cdot \sqrt{\frac{1}{h}}\right)}^{2}
\] |
|---|---|
associate-*l/ [=>]21.9 | \[ {\color{blue}{\left(\frac{\left(\sqrt{2} \cdot \left(\sqrt{0.5} \cdot \left(d \cdot c0\right)\right)\right) \cdot \sqrt{\frac{1}{h}}}{D \cdot w}\right)}}^{2}
\] |
times-frac [=>]21.6 | \[ {\color{blue}{\left(\frac{\sqrt{2} \cdot \left(\sqrt{0.5} \cdot \left(d \cdot c0\right)\right)}{D} \cdot \frac{\sqrt{\frac{1}{h}}}{w}\right)}}^{2}
\] |
*-commutative [=>]21.6 | \[ {\left(\frac{\color{blue}{\left(\sqrt{0.5} \cdot \left(d \cdot c0\right)\right) \cdot \sqrt{2}}}{D} \cdot \frac{\sqrt{\frac{1}{h}}}{w}\right)}^{2}
\] |
associate-/l* [=>]21.5 | \[ {\left(\color{blue}{\frac{\sqrt{0.5} \cdot \left(d \cdot c0\right)}{\frac{D}{\sqrt{2}}}} \cdot \frac{\sqrt{\frac{1}{h}}}{w}\right)}^{2}
\] |
*-commutative [=>]21.5 | \[ {\left(\frac{\sqrt{0.5} \cdot \color{blue}{\left(c0 \cdot d\right)}}{\frac{D}{\sqrt{2}}} \cdot \frac{\sqrt{\frac{1}{h}}}{w}\right)}^{2}
\] |
if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 64.0
Simplified63.7
[Start]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
|---|---|
associate-*l/ [<=]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \left(d \cdot d\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
*-commutative [=>]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
fma-def [=>]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)}
\] |
associate-*l* [=>]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\right)}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
associate-/r* [=>]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \color{blue}{\frac{\frac{c0}{w}}{h \cdot \left(D \cdot D\right)}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
associate-*r* [=>]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{\color{blue}{\left(h \cdot D\right) \cdot D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
*-commutative [=>]64.0 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{\color{blue}{D \cdot \left(h \cdot D\right)}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
Taylor expanded in c0 around -inf 63.0
Simplified32.9
[Start]63.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)
\] |
|---|---|
fma-def [=>]63.0 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)}
\] |
Taylor expanded in c0 around 0 33.9
Simplified33.6
[Start]33.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [<=]33.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}{{d}^{2}}
\] |
associate-/l* [=>]33.9 | \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{h \cdot {M}^{2}}}}
\] |
unpow2 [=>]33.9 | \[ 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{h \cdot {M}^{2}}}
\] |
unpow2 [=>]33.9 | \[ 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{h \cdot {M}^{2}}}
\] |
unpow2 [=>]33.9 | \[ 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}}
\] |
associate-/r* [=>]33.6 | \[ 0.25 \cdot \frac{D \cdot D}{\color{blue}{\frac{\frac{d \cdot d}{h}}{M \cdot M}}}
\] |
Taylor expanded in D around 0 33.9
Simplified22.2
[Start]33.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}
\] |
|---|---|
unpow2 [=>]33.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{d \cdot d}}
\] |
associate-*r* [=>]33.2 | \[ 0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{d \cdot d}
\] |
unpow2 [=>]33.2 | \[ 0.25 \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}\right) \cdot h}{d \cdot d}
\] |
unpow2 [=>]33.2 | \[ 0.25 \cdot \frac{\left(\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot h}{d \cdot d}
\] |
associate-*r/ [<=]33.8 | \[ 0.25 \cdot \color{blue}{\left(\left(\left(D \cdot D\right) \cdot \left(M \cdot M\right)\right) \cdot \frac{h}{d \cdot d}\right)}
\] |
associate-*r* [<=]33.7 | \[ 0.25 \cdot \color{blue}{\left(\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right)\right)}
\] |
remove-double-neg [<=]33.7 | \[ 0.25 \cdot \left(\left(D \cdot D\right) \cdot \color{blue}{\left(-\left(-\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right)\right)}\right)
\] |
associate-*r/ [=>]33.9 | \[ 0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(-\left(-\color{blue}{\frac{\left(M \cdot M\right) \cdot h}{d \cdot d}}\right)\right)\right)
\] |
times-frac [=>]29.9 | \[ 0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(-\left(-\color{blue}{\frac{M \cdot M}{d} \cdot \frac{h}{d}}\right)\right)\right)
\] |
distribute-lft-neg-in [=>]29.9 | \[ 0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(-\color{blue}{\left(-\frac{M \cdot M}{d}\right) \cdot \frac{h}{d}}\right)\right)
\] |
associate-*l* [=>]26.2 | \[ 0.25 \cdot \color{blue}{\left(D \cdot \left(D \cdot \left(-\left(-\frac{M \cdot M}{d}\right) \cdot \frac{h}{d}\right)\right)\right)}
\] |
distribute-lft-neg-in [<=]26.2 | \[ 0.25 \cdot \left(D \cdot \left(D \cdot \left(-\color{blue}{\left(-\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)}\right)\right)\right)
\] |
times-frac [<=]30.8 | \[ 0.25 \cdot \left(D \cdot \left(D \cdot \left(-\left(-\color{blue}{\frac{\left(M \cdot M\right) \cdot h}{d \cdot d}}\right)\right)\right)\right)
\] |
associate-*r/ [<=]30.4 | \[ 0.25 \cdot \left(D \cdot \left(D \cdot \left(-\left(-\color{blue}{\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}}\right)\right)\right)\right)
\] |
remove-double-neg [=>]30.4 | \[ 0.25 \cdot \left(D \cdot \left(D \cdot \color{blue}{\left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right)}\right)\right)
\] |
associate-*r/ [=>]30.8 | \[ 0.25 \cdot \left(D \cdot \left(D \cdot \color{blue}{\frac{\left(M \cdot M\right) \cdot h}{d \cdot d}}\right)\right)
\] |
Applied egg-rr16.8
Final simplification19.0
| Alternative 1 | |
|---|---|
| Error | 19.7 |
| Cost | 11076 |
| Alternative 2 | |
|---|---|
| Error | 19.7 |
| Cost | 1545 |
| Alternative 3 | |
|---|---|
| Error | 20.9 |
| Cost | 1225 |
| Alternative 4 | |
|---|---|
| Error | 22.3 |
| Cost | 960 |
| Alternative 5 | |
|---|---|
| Error | 20.9 |
| Cost | 960 |
| Alternative 6 | |
|---|---|
| Error | 31.8 |
| Cost | 64 |
herbie shell --seed 2023038
(FPCore (c0 w h D d M)
:name "Henrywood and Agarwal, Equation (13)"
:precision binary64
(* (/ c0 (* 2.0 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))