| Alternative 1 | |
|---|---|
| Error | 13.7 |
| Cost | 64 |
\[w0
\]
(FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0
(* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))))
(if (<= t_0 (- INFINITY))
(/ D (* d (/ 1.0 (* w0 (/ M (sqrt (/ (* l -4.0) h)))))))
(if (<= t_0 1e+306)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ D 2.0) (/ M d)) 2.0)))))
(if (<= t_0 INFINITY)
(/ (- D) (/ (/ d w0) (sqrt (* -0.25 (/ (* M h) (/ l M))))))
w0)))))double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = D / (d * (1.0 / (w0 * (M / sqrt(((l * -4.0) / h))))));
} else if (t_0 <= 1e+306) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D / 2.0) * (M / d)), 2.0))));
} else if (t_0 <= ((double) INFINITY)) {
tmp = -D / ((d / w0) / sqrt((-0.25 * ((M * h) / (l / M)))));
} else {
tmp = w0;
}
return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = D / (d * (1.0 / (w0 * (M / Math.sqrt(((l * -4.0) / h))))));
} else if (t_0 <= 1e+306) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D / 2.0) * (M / d)), 2.0))));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = -D / ((d / w0) / Math.sqrt((-0.25 * ((M * h) / (l / M)))));
} else {
tmp = w0;
}
return tmp;
}
def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
def code(w0, M, D, h, l, d): t_0 = w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)))) tmp = 0 if t_0 <= -math.inf: tmp = D / (d * (1.0 / (w0 * (M / math.sqrt(((l * -4.0) / h)))))) elif t_0 <= 1e+306: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D / 2.0) * (M / d)), 2.0)))) elif t_0 <= math.inf: tmp = -D / ((d / w0) / math.sqrt((-0.25 * ((M * h) / (l / M))))) else: tmp = w0 return tmp
function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) end
function code(w0, M, D, h, l, d) t_0 = Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(D / Float64(d * Float64(1.0 / Float64(w0 * Float64(M / sqrt(Float64(Float64(l * -4.0) / h))))))); elseif (t_0 <= 1e+306) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0))))); elseif (t_0 <= Inf) tmp = Float64(Float64(-D) / Float64(Float64(d / w0) / sqrt(Float64(-0.25 * Float64(Float64(M * h) / Float64(l / M)))))); else tmp = w0; end return tmp end
function tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); end
function tmp_2 = code(w0, M, D, h, l, d) t_0 = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); tmp = 0.0; if (t_0 <= -Inf) tmp = D / (d * (1.0 / (w0 * (M / sqrt(((l * -4.0) / h)))))); elseif (t_0 <= 1e+306) tmp = w0 * sqrt((1.0 - ((h / l) * (((D / 2.0) * (M / d)) ^ 2.0)))); elseif (t_0 <= Inf) tmp = -D / ((d / w0) / sqrt((-0.25 * ((M * h) / (l / M))))); else tmp = w0; end tmp_2 = tmp; end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(D / N[(d * N[(1.0 / N[(w0 * N[(M / N[Sqrt[N[(N[(l * -4.0), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+306], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[((-D) / N[(N[(d / w0), $MachinePrecision] / N[Sqrt[N[(-0.25 * N[(N[(M * h), $MachinePrecision] / N[(l / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]]]]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\begin{array}{l}
t_0 := w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\frac{D}{d \cdot \frac{1}{w0 \cdot \frac{M}{\sqrt{\frac{\ell \cdot -4}{h}}}}}\\
\mathbf{elif}\;t_0 \leq 10^{+306}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2}}\\
\mathbf{elif}\;t_0 \leq \infty:\\
\;\;\;\;\frac{-D}{\frac{\frac{d}{w0}}{\sqrt{-0.25 \cdot \frac{M \cdot h}{\frac{\ell}{M}}}}}\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
Results
if (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) < -inf.0Initial program 64.0
Simplified62.2
Taylor expanded in d around 0 60.6
Simplified59.1
Taylor expanded in D around 0 56.1
Simplified56.0
Applied egg-rr45.0
if -inf.0 < (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) < 1.00000000000000002e306Initial program 0.1
Simplified0.7
if 1.00000000000000002e306 < (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) < +inf.0Initial program 62.8
Simplified61.0
Taylor expanded in d around 0 60.1
Simplified57.6
Taylor expanded in D around -inf 56.4
Simplified55.7
Applied egg-rr51.4
if +inf.0 < (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))) Initial program 64.0
Simplified61.1
Taylor expanded in D around 0 13.8
Final simplification8.3
| Alternative 1 | |
|---|---|
| Error | 13.7 |
| Cost | 64 |
herbie shell --seed 2022325
(FPCore (w0 M D h l d)
:name "Henrywood and Agarwal, Equation (9a)"
:precision binary64
(* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))