
(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 11 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: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))) 4e+124)
(* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0)))))
(*
w0
(sqrt (+ 1.0 (* -0.25 (* D (/ (* D (/ (* M (/ h d)) (/ d M))) l))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))) <= 4e+124) {
tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0 * sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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) :: tmp
if ((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))) <= 4d+124) then
tmp = w0 * sqrt((1.0d0 - ((h / l) * (((m / d_1) * (d / 2.0d0)) ** 2.0d0))))
else
tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * (d * ((d * ((m * (h / d_1)) / (d_1 / m))) / l)))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))) <= 4e+124) {
tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
} else {
tmp = w0 * Math.sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))) <= 4e+124: tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0)))) else: tmp = w0 * math.sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))) <= 4e+124) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0))))); else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(D * Float64(Float64(D * Float64(Float64(M * Float64(h / d)) / Float64(d / M))) / l)))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))) <= 4e+124)
tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0))));
else
tmp = w0 * sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[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], 4e+124], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(D * N[(N[(D * N[(N[(M * N[(h / d), $MachinePrecision]), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 4 \cdot 10^{+124}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(D \cdot \frac{D \cdot \frac{M \cdot \frac{h}{d}}{\frac{d}{M}}}{\ell}\right)}\\
\end{array}
\end{array}
if (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) < 3.99999999999999979e124Initial program 99.9%
*-commutative99.9%
times-frac97.1%
Simplified97.1%
if 3.99999999999999979e124 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))) Initial program 42.5%
times-frac44.6%
Simplified44.6%
Taylor expanded in w0 around 0 43.0%
Simplified53.2%
associate-*l/56.7%
associate-/l*60.1%
Applied egg-rr60.1%
associate-*l/61.3%
Applied egg-rr61.3%
associate-/r/61.3%
Applied egg-rr61.3%
Final simplification84.4%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= (/ h l) -1e-119)
(* w0 (sqrt (- 1.0 (* h (/ (pow (* D (/ (* M 0.5) d)) 2.0) l)))))
(*
w0
(sqrt (+ 1.0 (* -0.25 (* D (/ (* D (/ (* M (/ h d)) (/ d M))) l))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-119) {
tmp = w0 * sqrt((1.0 - (h * (pow((D * ((M * 0.5) / d)), 2.0) / l))));
} else {
tmp = w0 * sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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) :: tmp
if ((h / l) <= (-1d-119)) then
tmp = w0 * sqrt((1.0d0 - (h * (((d * ((m * 0.5d0) / d_1)) ** 2.0d0) / l))))
else
tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * (d * ((d * ((m * (h / d_1)) / (d_1 / m))) / l)))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if ((h / l) <= -1e-119) {
tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((D * ((M * 0.5) / d)), 2.0) / l))));
} else {
tmp = w0 * Math.sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if (h / l) <= -1e-119: tmp = w0 * math.sqrt((1.0 - (h * (math.pow((D * ((M * 0.5) / d)), 2.0) / l)))) else: tmp = w0 * math.sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (Float64(h / l) <= -1e-119) tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(D * Float64(Float64(M * 0.5) / d)) ^ 2.0) / l))))); else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(D * Float64(Float64(D * Float64(Float64(M * Float64(h / d)) / Float64(d / M))) / l)))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if ((h / l) <= -1e-119)
tmp = w0 * sqrt((1.0 - (h * (((D * ((M * 0.5) / d)) ^ 2.0) / l))));
else
tmp = w0 * sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e-119], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(D * N[(N[(M * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(D * N[(N[(D * N[(N[(M * N[(h / d), $MachinePrecision]), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{-119}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(D \cdot \frac{D \cdot \frac{M \cdot \frac{h}{d}}{\frac{d}{M}}}{\ell}\right)}\\
\end{array}
\end{array}
if (/.f64 h l) < -1.00000000000000001e-119Initial program 72.2%
times-frac73.1%
Simplified73.1%
clear-num73.1%
un-div-inv75.6%
div-inv75.6%
metadata-eval75.6%
Applied egg-rr75.6%
associate-/r/78.0%
associate-*r/77.1%
associate-/l*78.0%
associate-/l*78.0%
associate-/r*78.0%
associate-/r/77.0%
*-commutative77.0%
associate-/r/78.0%
*-commutative78.0%
associate-/l*77.1%
associate-*r*77.1%
associate-*r/78.0%
associate-*r/77.1%
associate-*l/77.0%
*-commutative77.0%
Simplified77.0%
if -1.00000000000000001e-119 < (/.f64 h l) Initial program 84.5%
times-frac84.5%
Simplified84.5%
Taylor expanded in w0 around 0 44.3%
Simplified62.1%
associate-*l/71.2%
associate-/l*79.8%
Applied egg-rr79.8%
associate-*l/85.0%
Applied egg-rr85.0%
associate-/r/85.2%
Applied egg-rr85.2%
Final simplification81.9%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= M 2.1e-44)
w0
(*
w0
(sqrt (+ 1.0 (* -0.25 (* (/ D (/ l D)) (* (/ h d) (/ (* M M) d)))))))))M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.1e-44) {
tmp = w0;
} else {
tmp = w0 * sqrt((1.0 + (-0.25 * ((D / (l / D)) * ((h / d) * ((M * M) / d))))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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) :: tmp
if (m <= 2.1d-44) then
tmp = w0
else
tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * ((d / (l / d)) * ((h / d_1) * ((m * m) / d_1))))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 2.1e-44) {
tmp = w0;
} else {
tmp = w0 * Math.sqrt((1.0 + (-0.25 * ((D / (l / D)) * ((h / d) * ((M * M) / d))))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 2.1e-44: tmp = w0 else: tmp = w0 * math.sqrt((1.0 + (-0.25 * ((D / (l / D)) * ((h / d) * ((M * M) / d)))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 2.1e-44) tmp = w0; else tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(h / d) * Float64(Float64(M * M) / d))))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 2.1e-44)
tmp = w0;
else
tmp = w0 * sqrt((1.0 + (-0.25 * ((D / (l / D)) * ((h / d) * ((M * M) / d))))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 2.1e-44], w0, N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(h / d), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.1 \cdot 10^{-44}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{h}{d} \cdot \frac{M \cdot M}{d}\right)\right)}\\
\end{array}
\end{array}
if M < 2.10000000000000001e-44Initial program 81.1%
times-frac81.1%
Simplified81.1%
Taylor expanded in M around 0 73.9%
if 2.10000000000000001e-44 < M Initial program 75.0%
times-frac76.5%
Simplified76.5%
Taylor expanded in w0 around 0 40.1%
Simplified49.2%
Final simplification67.5%
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
:precision binary64
(if (<= d 6.1e-149)
(* w0 (sqrt (+ 1.0 (* -0.25 (* (/ D (/ l D)) (/ (* h (/ M (/ d M))) d))))))
(if (<= d 2e+27)
(* w0 (+ 1.0 (* -0.125 (* (/ D (/ l h)) (/ D (pow (/ d M) 2.0))))))
w0)))M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 6.1e-149) {
tmp = w0 * sqrt((1.0 + (-0.25 * ((D / (l / D)) * ((h * (M / (d / M))) / d)))));
} else if (d <= 2e+27) {
tmp = w0 * (1.0 + (-0.125 * ((D / (l / h)) * (D / pow((d / M), 2.0)))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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) :: tmp
if (d_1 <= 6.1d-149) then
tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * ((d / (l / d)) * ((h * (m / (d_1 / m))) / d_1)))))
else if (d_1 <= 2d+27) then
tmp = w0 * (1.0d0 + ((-0.125d0) * ((d / (l / h)) * (d / ((d_1 / m) ** 2.0d0)))))
else
tmp = w0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 6.1e-149) {
tmp = w0 * Math.sqrt((1.0 + (-0.25 * ((D / (l / D)) * ((h * (M / (d / M))) / d)))));
} else if (d <= 2e+27) {
tmp = w0 * (1.0 + (-0.125 * ((D / (l / h)) * (D / Math.pow((d / M), 2.0)))));
} else {
tmp = w0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 6.1e-149: tmp = w0 * math.sqrt((1.0 + (-0.25 * ((D / (l / D)) * ((h * (M / (d / M))) / d))))) elif d <= 2e+27: tmp = w0 * (1.0 + (-0.125 * ((D / (l / h)) * (D / math.pow((d / M), 2.0))))) else: tmp = w0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 6.1e-149) tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(D / Float64(l / D)) * Float64(Float64(h * Float64(M / Float64(d / M))) / d)))))); elseif (d <= 2e+27) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D / Float64(l / h)) * Float64(D / (Float64(d / M) ^ 2.0)))))); else tmp = w0; end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (d <= 6.1e-149)
tmp = w0 * sqrt((1.0 + (-0.25 * ((D / (l / D)) * ((h * (M / (d / M))) / d)))));
elseif (d <= 2e+27)
tmp = w0 * (1.0 + (-0.125 * ((D / (l / h)) * (D / ((d / M) ^ 2.0)))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, 6.1e-149], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e+27], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D / N[(l / h), $MachinePrecision]), $MachinePrecision] * N[(D / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 6.1 \cdot 10^{-149}:\\
\;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \frac{h \cdot \frac{M}{\frac{d}{M}}}{d}\right)}\\
\mathbf{elif}\;d \leq 2 \cdot 10^{+27}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\frac{D}{\frac{\ell}{h}} \cdot \frac{D}{{\left(\frac{d}{M}\right)}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 6.09999999999999959e-149Initial program 79.2%
times-frac78.7%
Simplified78.7%
Taylor expanded in w0 around 0 41.9%
Simplified59.3%
associate-*r/58.3%
associate-/l*66.2%
Applied egg-rr66.2%
if 6.09999999999999959e-149 < d < 2e27Initial program 88.7%
times-frac88.7%
Simplified88.7%
Taylor expanded in M around 0 58.5%
*-commutative58.5%
associate-/l*58.3%
unpow258.3%
unpow258.3%
*-commutative58.3%
unpow258.3%
Simplified58.3%
Taylor expanded in l around 0 58.3%
*-commutative58.3%
times-frac64.1%
unpow264.1%
unpow264.1%
times-frac69.4%
Simplified69.4%
times-frac73.7%
pow273.7%
Applied egg-rr73.7%
if 2e27 < d Initial program 76.4%
times-frac79.6%
Simplified79.6%
Taylor expanded in M around 0 77.0%
Final simplification69.6%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M 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 (* -0.25 (* D (/ (* D (* M (/ (/ h d) (/ d M)))) l)))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 + (-0.25 * (D * ((D * (M * ((h / d) / (d / M)))) / l)))));
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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 + ((-0.25d0) * (d * ((d * (m * ((h / d_1) / (d_1 / m)))) / l)))))
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 + (-0.25 * (D * ((D * (M * ((h / d) / (d / M)))) / l)))));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 + (-0.25 * (D * ((D * (M * ((h / d) / (d / M)))) / l)))))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(D * Float64(Float64(D * Float64(M * Float64(Float64(h / d) / Float64(d / M)))) / l)))))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 + (-0.25 * (D * ((D * (M * ((h / d) / (d / M)))) / l)))));
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M 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[(-0.25 * N[(D * N[(N[(D * N[(M * N[(N[(h / d), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 + -0.25 \cdot \left(D \cdot \frac{D \cdot \left(M \cdot \frac{\frac{h}{d}}{\frac{d}{M}}\right)}{\ell}\right)}
\end{array}
Initial program 79.5%
times-frac79.9%
Simplified79.9%
Taylor expanded in w0 around 0 46.0%
Simplified59.4%
associate-*l/66.7%
associate-/l*73.6%
Applied egg-rr73.6%
associate-/r/74.2%
frac-times72.2%
Applied egg-rr72.2%
Taylor expanded in M around 0 58.3%
unpow258.3%
times-frac67.4%
unpow267.4%
associate-*l/74.2%
associate-/r/74.2%
associate-*l/78.5%
associate-/r/78.1%
*-commutative78.1%
*-commutative78.1%
associate-/l*78.1%
Simplified78.1%
Final simplification78.1%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M 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 (* -0.25 (* D (/ (* D (/ (* M (/ h d)) (/ d M))) l)))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0 * sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))));
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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 + ((-0.25d0) * (d * ((d * ((m * (h / d_1)) / (d_1 / m))) / l)))))
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0 * Math.sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))));
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0 * math.sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))))
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(D * Float64(Float64(D * Float64(Float64(M * Float64(h / d)) / Float64(d / M))) / l)))))) end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0 * sqrt((1.0 + (-0.25 * (D * ((D * ((M * (h / d)) / (d / M))) / l)))));
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M 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[(-0.25 * N[(D * N[(N[(D * N[(N[(M * N[(h / d), $MachinePrecision]), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 + -0.25 \cdot \left(D \cdot \frac{D \cdot \frac{M \cdot \frac{h}{d}}{\frac{d}{M}}}{\ell}\right)}
\end{array}
Initial program 79.5%
times-frac79.9%
Simplified79.9%
Taylor expanded in w0 around 0 46.0%
Simplified59.4%
associate-*l/66.7%
associate-/l*73.6%
Applied egg-rr73.6%
associate-*l/77.9%
Applied egg-rr77.9%
associate-/r/78.5%
Applied egg-rr78.5%
Final simplification78.5%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= M 1.25e-87) w0 (* w0 (+ 1.0 (* -0.125 (* h (* (* M M) (/ (pow (/ D d) 2.0) l))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.25e-87) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (h * ((M * M) * (pow((D / d), 2.0) / l)))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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) :: tmp
if (m <= 1.25d-87) then
tmp = w0
else
tmp = w0 * (1.0d0 + ((-0.125d0) * (h * ((m * m) * (((d / d_1) ** 2.0d0) / l)))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.25e-87) {
tmp = w0;
} else {
tmp = w0 * (1.0 + (-0.125 * (h * ((M * M) * (Math.pow((D / d), 2.0) / l)))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 1.25e-87: tmp = w0 else: tmp = w0 * (1.0 + (-0.125 * (h * ((M * M) * (math.pow((D / d), 2.0) / l))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 1.25e-87) tmp = w0; else tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(h * Float64(Float64(M * M) * Float64((Float64(D / d) ^ 2.0) / l)))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 1.25e-87)
tmp = w0;
else
tmp = w0 * (1.0 + (-0.125 * (h * ((M * M) * (((D / d) ^ 2.0) / l)))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.25e-87], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(h * N[(N[(M * M), $MachinePrecision] * N[(N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.25 \cdot 10^{-87}:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(h \cdot \left(\left(M \cdot M\right) \cdot \frac{{\left(\frac{D}{d}\right)}^{2}}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if M < 1.25000000000000011e-87Initial program 81.2%
times-frac81.2%
Simplified81.2%
Taylor expanded in M around 0 73.1%
if 1.25000000000000011e-87 < M Initial program 75.4%
times-frac76.7%
Simplified76.7%
Taylor expanded in M around 0 42.2%
*-commutative42.2%
associate-/l*46.2%
unpow246.2%
unpow246.2%
*-commutative46.2%
unpow246.2%
Simplified46.2%
Taylor expanded in D around 0 42.2%
unpow242.2%
associate-*r*47.6%
*-commutative47.6%
unpow247.6%
associate-*l/52.8%
unpow252.8%
associate-*r*46.2%
unpow246.2%
associate-*r*49.0%
unpow249.0%
unpow249.0%
*-commutative49.0%
associate-/r*49.1%
unpow249.1%
unpow249.1%
times-frac56.0%
unpow256.0%
unpow256.0%
Simplified56.0%
Final simplification68.1%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= d 2.05e+26) (* w0 (+ 1.0 (* -0.125 (* (/ D (/ l h)) (/ D (pow (/ d M) 2.0)))))) w0))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 2.05e+26) {
tmp = w0 * (1.0 + (-0.125 * ((D / (l / h)) * (D / pow((d / M), 2.0)))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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) :: tmp
if (d_1 <= 2.05d+26) then
tmp = w0 * (1.0d0 + ((-0.125d0) * ((d / (l / h)) * (d / ((d_1 / m) ** 2.0d0)))))
else
tmp = w0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 2.05e+26) {
tmp = w0 * (1.0 + (-0.125 * ((D / (l / h)) * (D / Math.pow((d / M), 2.0)))));
} else {
tmp = w0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 2.05e+26: tmp = w0 * (1.0 + (-0.125 * ((D / (l / h)) * (D / math.pow((d / M), 2.0))))) else: tmp = w0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 2.05e+26) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D / Float64(l / h)) * Float64(D / (Float64(d / M) ^ 2.0)))))); else tmp = w0; end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (d <= 2.05e+26)
tmp = w0 * (1.0 + (-0.125 * ((D / (l / h)) * (D / ((d / M) ^ 2.0)))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, 2.05e+26], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D / N[(l / h), $MachinePrecision]), $MachinePrecision] * N[(D / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.05 \cdot 10^{+26}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\frac{D}{\frac{\ell}{h}} \cdot \frac{D}{{\left(\frac{d}{M}\right)}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 2.04999999999999992e26Initial program 80.5%
times-frac80.0%
Simplified80.0%
Taylor expanded in M around 0 43.7%
*-commutative43.7%
associate-/l*45.2%
unpow245.2%
unpow245.2%
*-commutative45.2%
unpow245.2%
Simplified45.2%
Taylor expanded in l around 0 45.2%
*-commutative45.2%
times-frac45.6%
unpow245.6%
unpow245.6%
times-frac63.0%
Simplified63.0%
times-frac67.6%
pow267.6%
Applied egg-rr67.6%
if 2.04999999999999992e26 < d Initial program 76.4%
times-frac79.6%
Simplified79.6%
Taylor expanded in M around 0 77.0%
Final simplification69.9%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= d 320000.0) (* w0 (+ 1.0 (* -0.125 (/ (* D D) (* (/ l h) (* (/ d M) (/ d M))))))) w0))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 320000.0) {
tmp = w0 * (1.0 + (-0.125 * ((D * D) / ((l / h) * ((d / M) * (d / M))))));
} else {
tmp = w0;
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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) :: tmp
if (d_1 <= 320000.0d0) then
tmp = w0 * (1.0d0 + ((-0.125d0) * ((d * d) / ((l / h) * ((d_1 / m) * (d_1 / m))))))
else
tmp = w0
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (d <= 320000.0) {
tmp = w0 * (1.0 + (-0.125 * ((D * D) / ((l / h) * ((d / M) * (d / M))))));
} else {
tmp = w0;
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if d <= 320000.0: tmp = w0 * (1.0 + (-0.125 * ((D * D) / ((l / h) * ((d / M) * (d / M)))))) else: tmp = w0 return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (d <= 320000.0) tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D * D) / Float64(Float64(l / h) * Float64(Float64(d / M) * Float64(d / M))))))); else tmp = w0; end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (d <= 320000.0)
tmp = w0 * (1.0 + (-0.125 * ((D * D) / ((l / h) * ((d / M) * (d / M))))));
else
tmp = w0;
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, 320000.0], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D * D), $MachinePrecision] / N[(N[(l / h), $MachinePrecision] * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 320000:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{D \cdot D}{\frac{\ell}{h} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;w0\\
\end{array}
\end{array}
if d < 3.2e5Initial program 80.2%
times-frac79.7%
Simplified79.7%
Taylor expanded in M around 0 43.3%
*-commutative43.3%
associate-/l*44.8%
unpow244.8%
unpow244.8%
*-commutative44.8%
unpow244.8%
Simplified44.8%
Taylor expanded in l around 0 44.8%
*-commutative44.8%
times-frac45.2%
unpow245.2%
unpow245.2%
times-frac62.4%
Simplified62.4%
if 3.2e5 < d Initial program 77.5%
times-frac80.5%
Simplified80.5%
Taylor expanded in M around 0 76.6%
Final simplification66.0%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 (if (<= M 1.25) w0 (* -0.125 (* (* (/ D d) (/ D d)) (/ w0 (/ l (* h (* M M))))))))
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.25) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * (D / d)) * (w0 / (l / (h * (M * M)))));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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) :: tmp
if (m <= 1.25d0) then
tmp = w0
else
tmp = (-0.125d0) * (((d / d_1) * (d / d_1)) * (w0 / (l / (h * (m * m)))))
end if
code = tmp
end function
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
double tmp;
if (M <= 1.25) {
tmp = w0;
} else {
tmp = -0.125 * (((D / d) * (D / d)) * (w0 / (l / (h * (M * M)))));
}
return tmp;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): tmp = 0 if M <= 1.25: tmp = w0 else: tmp = -0.125 * (((D / d) * (D / d)) * (w0 / (l / (h * (M * M))))) return tmp
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) tmp = 0.0 if (M <= 1.25) tmp = w0; else tmp = Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(w0 / Float64(l / Float64(h * Float64(M * M)))))); end return tmp end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
tmp = 0.0;
if (M <= 1.25)
tmp = w0;
else
tmp = -0.125 * (((D / d) * (D / d)) * (w0 / (l / (h * (M * M)))));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.25], w0, N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(w0 / N[(l / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.25:\\
\;\;\;\;w0\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{w0}{\frac{\ell}{h \cdot \left(M \cdot M\right)}}\right)\\
\end{array}
\end{array}
if M < 1.25Initial program 81.0%
times-frac81.0%
Simplified81.0%
Taylor expanded in M around 0 72.9%
if 1.25 < M Initial program 74.9%
times-frac76.5%
Simplified76.5%
Taylor expanded in M around 0 38.0%
*-commutative38.0%
associate-/l*42.8%
unpow242.8%
unpow242.8%
*-commutative42.8%
unpow242.8%
Simplified42.8%
Taylor expanded in l around 0 42.8%
*-commutative42.8%
times-frac38.2%
unpow238.2%
unpow238.2%
times-frac54.4%
Simplified54.4%
Taylor expanded in D around inf 24.2%
associate-*r/24.2%
*-commutative24.2%
associate-*r/24.2%
times-frac24.1%
associate-*r*22.4%
*-commutative22.4%
unpow222.4%
associate-*r*22.8%
*-commutative22.8%
associate-*r/23.2%
*-commutative23.2%
unpow223.2%
unpow223.2%
times-frac26.9%
unpow226.9%
associate-*l*27.0%
Simplified24.1%
frac-times27.8%
Applied egg-rr27.8%
Final simplification62.0%
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (w0 M D h l d) :precision binary64 w0)
M = abs(M);
D = abs(D);
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
NOTE: M should be positive before calling this function
NOTE: D should be positive before calling this function
NOTE: M 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
M = Math.abs(M);
D = Math.abs(D);
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
return w0;
}
M = abs(M) D = abs(D) [M, D] = sort([M, D]) def code(w0, M, D, h, l, d): return w0
M = abs(M) D = abs(D) M, D = sort([M, D]) function code(w0, M, D, h, l, d) return w0 end
M = abs(M)
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
tmp = w0;
end
NOTE: M should be positive before calling this function NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
M = |M|\\
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
w0
\end{array}
Initial program 79.5%
times-frac79.9%
Simplified79.9%
Taylor expanded in M around 0 66.1%
Final simplification66.1%
herbie shell --seed 2023230
(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))))))