
(FPCore (w0 M D h l d) :precision binary64 (* 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) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
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))));
}
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))))
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 tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); 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]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w0 M D h l d) :precision binary64 (* 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) {
return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
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))));
}
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))))
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 tmp = code(w0, M, D, h, l, d) tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)))); 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]
\begin{array}{l}
\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\end{array}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (* (* M 0.5) (/ D d))) (t_1 (* (* (* M D) (/ 0.5 d)) (sqrt h))))
(if (<= h 5e-266)
(* w0 (sqrt (- 1.0 (* t_0 (/ (* h t_0) l)))))
(* w0 (sqrt (- 1.0 (* t_1 (/ t_1 l))))))))assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * 0.5) * (D / d);
double t_1 = ((M * D) * (0.5 / d)) * sqrt(h);
double tmp;
if (h <= 5e-266) {
tmp = w0 * sqrt((1.0 - (t_0 * ((h * t_0) / l))));
} else {
tmp = w0 * sqrt((1.0 - (t_1 * (t_1 / l))));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (m * 0.5d0) * (d / d_1)
t_1 = ((m * d) * (0.5d0 / d_1)) * sqrt(h)
if (h <= 5d-266) then
tmp = w0 * sqrt((1.0d0 - (t_0 * ((h * t_0) / l))))
else
tmp = w0 * sqrt((1.0d0 - (t_1 * (t_1 / l))))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * 0.5) * (D / d);
double t_1 = ((M * D) * (0.5 / d)) * Math.sqrt(h);
double tmp;
if (h <= 5e-266) {
tmp = w0 * Math.sqrt((1.0 - (t_0 * ((h * t_0) / l))));
} else {
tmp = w0 * Math.sqrt((1.0 - (t_1 * (t_1 / l))));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): t_0 = (M * 0.5) * (D / d) t_1 = ((M * D) * (0.5 / d)) * math.sqrt(h) tmp = 0 if h <= 5e-266: tmp = w0 * math.sqrt((1.0 - (t_0 * ((h * t_0) / l)))) else: tmp = w0 * math.sqrt((1.0 - (t_1 * (t_1 / l)))) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) t_0 = Float64(Float64(M * 0.5) * Float64(D / d)) t_1 = Float64(Float64(Float64(M * D) * Float64(0.5 / d)) * sqrt(h)) tmp = 0.0 if (h <= 5e-266) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(Float64(h * t_0) / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_1 * Float64(t_1 / l))))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = (M * 0.5) * (D / d);
t_1 = ((M * D) * (0.5 / d)) * sqrt(h);
tmp = 0.0;
if (h <= 5e-266)
tmp = w0 * sqrt((1.0 - (t_0 * ((h * t_0) / l))));
else
tmp = w0 * sqrt((1.0 - (t_1 * (t_1 / l))));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(M * D), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, 5e-266], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$1 * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := \left(M \cdot 0.5\right) \cdot \frac{D}{d}\\
t_1 := \left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right) \cdot \sqrt{h}\\
\mathbf{if}\;h \leq 5 \cdot 10^{-266}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_0 \cdot \frac{h \cdot t\_0}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_1 \cdot \frac{t\_1}{\ell}}\\
\end{array}
\end{array}
if h < 4.99999999999999992e-266Initial program 79.3%
Simplified80.9%
associate-*r/86.1%
*-commutative86.1%
associate-*l/84.5%
associate-*r/86.1%
div-inv86.1%
metadata-eval86.1%
Applied egg-rr86.1%
associate-/l*80.9%
*-commutative80.9%
unpow280.9%
associate-*r*83.4%
Applied egg-rr83.4%
associate-*l/90.2%
Applied egg-rr90.2%
if 4.99999999999999992e-266 < h Initial program 80.4%
Simplified79.7%
associate-/r*79.7%
associate-*r/80.4%
*-commutative80.4%
associate-*r/79.6%
unpow279.6%
unpow279.6%
associate-*r/85.4%
clear-num85.4%
associate-*r/86.2%
times-frac85.4%
div-inv85.4%
metadata-eval85.4%
Applied egg-rr85.4%
associate-/r/85.4%
*-commutative85.4%
associate-*r/86.1%
*-commutative86.1%
associate-/l*85.4%
associate-*r/85.4%
Simplified85.4%
associate-*l/85.4%
*-un-lft-identity85.4%
Applied egg-rr85.4%
add-sqr-sqrt85.4%
*-un-lft-identity85.4%
times-frac85.4%
*-commutative85.4%
sqrt-prod85.4%
sqrt-pow171.8%
metadata-eval71.8%
pow171.8%
associate-*r*71.1%
Applied egg-rr90.3%
Final simplification90.2%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(let* ((t_0 (- 1.0 (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l))))
(t_1 (* (* M 0.5) (/ D d))))
(if (<= t_0 1e+129)
(* w0 (sqrt t_0))
(* w0 (sqrt (- 1.0 (* t_1 (/ (* h t_1) l))))))))assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = 1.0 - (pow(((M * D) / (d * 2.0)), 2.0) * (h / l));
double t_1 = (M * 0.5) * (D / d);
double tmp;
if (t_0 <= 1e+129) {
tmp = w0 * sqrt(t_0);
} else {
tmp = w0 * sqrt((1.0 - (t_1 * ((h * t_1) / l))));
}
return tmp;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - ((((m * d) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l))
t_1 = (m * 0.5d0) * (d / d_1)
if (t_0 <= 1d+129) then
tmp = w0 * sqrt(t_0)
else
tmp = w0 * sqrt((1.0d0 - (t_1 * ((h * t_1) / l))))
end if
code = tmp
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = 1.0 - (Math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l));
double t_1 = (M * 0.5) * (D / d);
double tmp;
if (t_0 <= 1e+129) {
tmp = w0 * Math.sqrt(t_0);
} else {
tmp = w0 * Math.sqrt((1.0 - (t_1 * ((h * t_1) / l))));
}
return tmp;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): t_0 = 1.0 - (math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) t_1 = (M * 0.5) * (D / d) tmp = 0 if t_0 <= 1e+129: tmp = w0 * math.sqrt(t_0) else: tmp = w0 * math.sqrt((1.0 - (t_1 * ((h * t_1) / l)))) return tmp
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) t_0 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l))) t_1 = Float64(Float64(M * 0.5) * Float64(D / d)) tmp = 0.0 if (t_0 <= 1e+129) tmp = Float64(w0 * sqrt(t_0)); else tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(t_1 * Float64(Float64(h * t_1) / l))))); end return tmp end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp_2 = code(w0, M, D, h, l, d)
t_0 = 1.0 - ((((M * D) / (d * 2.0)) ^ 2.0) * (h / l));
t_1 = (M * 0.5) * (D / d);
tmp = 0.0;
if (t_0 <= 1e+129)
tmp = w0 * sqrt(t_0);
else
tmp = w0 * sqrt((1.0 - (t_1 * ((h * t_1) / l))));
end
tmp_2 = tmp;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+129], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$1 * N[(N[(h * t$95$1), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := 1 - {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}\\
t_1 := \left(M \cdot 0.5\right) \cdot \frac{D}{d}\\
\mathbf{if}\;t\_0 \leq 10^{+129}:\\
\;\;\;\;w0 \cdot \sqrt{t\_0}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - t\_1 \cdot \frac{h \cdot t\_1}{\ell}}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) < 1e129Initial program 99.9%
if 1e129 < (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))) Initial program 38.9%
Simplified42.3%
associate-*r/61.4%
*-commutative61.4%
associate-*l/57.9%
associate-*r/61.4%
div-inv61.4%
metadata-eval61.4%
Applied egg-rr61.4%
associate-/l*42.3%
*-commutative42.3%
unpow242.3%
associate-*r*48.1%
Applied egg-rr48.1%
associate-*l/69.3%
Applied egg-rr69.3%
Final simplification89.9%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (* w0 (sqrt (- 1.0 (* (* (* M 0.5) (/ D d)) (* h (/ (* D (* M (/ 0.5 d))) l)))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 - (((M * 0.5) * (D / d)) * (h * ((D * (M * (0.5 / d))) / l)))));
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0 * sqrt((1.0d0 - (((m * 0.5d0) * (d / d_1)) * (h * ((d * (m * (0.5d0 / d_1))) / l)))))
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 - (((M * 0.5) * (D / d)) * (h * ((D * (M * (0.5 / d))) / l)))));
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 - (((M * 0.5) * (D / d)) * (h * ((D * (M * (0.5 / d))) / l)))))
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(M * 0.5) * Float64(D / d)) * Float64(h * Float64(Float64(D * Float64(M * Float64(0.5 / d))) / l)))))) end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 - (((M * 0.5) * (D / d)) * (h * ((D * (M * (0.5 / d))) / l)))));
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right) \cdot \left(h \cdot \frac{D \cdot \left(M \cdot \frac{0.5}{d}\right)}{\ell}\right)}
\end{array}
Initial program 79.9%
Simplified80.2%
associate-*r/85.7%
*-commutative85.7%
associate-*l/85.4%
associate-*r/85.7%
div-inv85.7%
metadata-eval85.7%
Applied egg-rr85.7%
associate-/l*80.2%
*-commutative80.2%
unpow280.2%
associate-*r*82.1%
Applied egg-rr82.1%
associate-*l/88.7%
Applied egg-rr88.7%
associate-/l*88.3%
*-commutative88.3%
associate-*l/87.2%
associate-*r/87.6%
associate-*r/87.6%
Simplified87.6%
Final simplification87.6%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (let* ((t_0 (* (* M 0.5) (/ D d)))) (* w0 (sqrt (- 1.0 (* t_0 (/ (* h t_0) l)))))))
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * 0.5) * (D / d);
return w0 * sqrt((1.0 - (t_0 * ((h * t_0) / l))));
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
real(8) :: t_0
t_0 = (m * 0.5d0) * (d / d_1)
code = w0 * sqrt((1.0d0 - (t_0 * ((h * t_0) / l))))
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
double t_0 = (M * 0.5) * (D / d);
return w0 * Math.sqrt((1.0 - (t_0 * ((h * t_0) / l))));
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): t_0 = (M * 0.5) * (D / d) return w0 * math.sqrt((1.0 - (t_0 * ((h * t_0) / l))))
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) t_0 = Float64(Float64(M * 0.5) * Float64(D / d)) return Float64(w0 * sqrt(Float64(1.0 - Float64(t_0 * Float64(Float64(h * t_0) / l))))) end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
t_0 = (M * 0.5) * (D / d);
tmp = w0 * sqrt((1.0 - (t_0 * ((h * t_0) / l))));
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M * 0.5), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, N[(w0 * N[Sqrt[N[(1.0 - N[(t$95$0 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := \left(M \cdot 0.5\right) \cdot \frac{D}{d}\\
w0 \cdot \sqrt{1 - t\_0 \cdot \frac{h \cdot t\_0}{\ell}}
\end{array}
\end{array}
Initial program 79.9%
Simplified80.2%
associate-*r/85.7%
*-commutative85.7%
associate-*l/85.4%
associate-*r/85.7%
div-inv85.7%
metadata-eval85.7%
Applied egg-rr85.7%
associate-/l*80.2%
*-commutative80.2%
unpow280.2%
associate-*r*82.1%
Applied egg-rr82.1%
associate-*l/88.7%
Applied egg-rr88.7%
Final simplification88.7%
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
assert(w0 < M && M < D && D < h && h < l && l < d);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
real(8), intent (in) :: w0
real(8), intent (in) :: m
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: d_1
code = w0
end function
assert w0 < M && M < D && D < h && h < l && l < d;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
[w0, M, D, h, l, d] = sort([w0, M, D, h, l, d]) def code(w0, M, D, h, l, d): return w0
w0, M, D, h, l, d = sort([w0, M, D, h, l, d]) function code(w0, M, D, h, l, d) return w0 end
w0, M, D, h, l, d = num2cell(sort([w0, M, D, h, l, d])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
NOTE: w0, M, D, h, l, and d should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
[w0, M, D, h, l, d] = \mathsf{sort}([w0, M, D, h, l, d])\\
\\
w0
\end{array}
Initial program 79.9%
Simplified80.2%
Taylor expanded in D around 0 67.6%
Final simplification67.6%
herbie shell --seed 2024084
(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))))))