| Alternative 1 | |
|---|---|
| Accuracy | 81.5% |
| Cost | 20036 |
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (* c0 (* (pow (/ -1.0 V) 0.5) (pow (/ (- l) A) -0.5)))))
(if (<= (* V l) (- INFINITY))
t_0
(if (<= (* V l) -2e-295)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
t_0
(if (<= (* V l) 4e+296)
(/ c0 (/ (sqrt (* V l)) (sqrt A)))
(* c0 (/ (sqrt (/ A V)) (sqrt l)))))))))double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
double code(double c0, double A, double V, double l) {
double t_0 = c0 * (pow((-1.0 / V), 0.5) * pow((-l / A), -0.5));
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = t_0;
} else if ((V * l) <= -2e-295) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = t_0;
} else if ((V * l) <= 4e+296) {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
} else {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
}
return tmp;
}
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 * (Math.pow((-1.0 / V), 0.5) * Math.pow((-l / A), -0.5));
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = t_0;
} else if ((V * l) <= -2e-295) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = t_0;
} else if ((V * l) <= 4e+296) {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
} else {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
}
return tmp;
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
def code(c0, A, V, l): t_0 = c0 * (math.pow((-1.0 / V), 0.5) * math.pow((-l / A), -0.5)) tmp = 0 if (V * l) <= -math.inf: tmp = t_0 elif (V * l) <= -2e-295: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = t_0 elif (V * l) <= 4e+296: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) else: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) return tmp
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function code(c0, A, V, l) t_0 = Float64(c0 * Float64((Float64(-1.0 / V) ^ 0.5) * (Float64(Float64(-l) / A) ^ -0.5))) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = t_0; elseif (Float64(V * l) <= -2e-295) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = t_0; elseif (Float64(V * l) <= 4e+296) tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); else tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); end return tmp end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
function tmp_2 = code(c0, A, V, l) t_0 = c0 * (((-1.0 / V) ^ 0.5) * ((-l / A) ^ -0.5)); tmp = 0.0; if ((V * l) <= -Inf) tmp = t_0; elseif ((V * l) <= -2e-295) tmp = c0 * (sqrt(-A) / sqrt((V * -l))); elseif ((V * l) <= 0.0) tmp = t_0; elseif ((V * l) <= 4e+296) tmp = c0 / (sqrt((V * l)) / sqrt(A)); else tmp = c0 * (sqrt((A / V)) / sqrt(l)); end tmp_2 = tmp; end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(c0 * N[(N[Power[N[(-1.0 / V), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[((-l) / A), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -2e-295], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 4e+296], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := c0 \cdot \left({\left(\frac{-1}{V}\right)}^{0.5} \cdot {\left(\frac{-\ell}{A}\right)}^{-0.5}\right)\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;t_0\\
\mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-295}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;t_0\\
\mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+296}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
Results
if (*.f64 V l) < -inf.0 or -2.00000000000000012e-295 < (*.f64 V l) < 0.0Initial program 14.9%
Applied egg-rr43.0%
[Start]14.9 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
pow1/2 [=>]14.9 | \[ c0 \cdot \color{blue}{{\left(\frac{A}{V \cdot \ell}\right)}^{0.5}}
\] |
clear-num [=>]14.9 | \[ c0 \cdot {\color{blue}{\left(\frac{1}{\frac{V \cdot \ell}{A}}\right)}}^{0.5}
\] |
inv-pow [=>]14.9 | \[ c0 \cdot {\color{blue}{\left({\left(\frac{V \cdot \ell}{A}\right)}^{-1}\right)}}^{0.5}
\] |
pow-pow [=>]14.9 | \[ c0 \cdot \color{blue}{{\left(\frac{V \cdot \ell}{A}\right)}^{\left(-1 \cdot 0.5\right)}}
\] |
associate-/l* [=>]43.0 | \[ c0 \cdot {\color{blue}{\left(\frac{V}{\frac{A}{\ell}}\right)}}^{\left(-1 \cdot 0.5\right)}
\] |
metadata-eval [=>]43.0 | \[ c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{\color{blue}{-0.5}}
\] |
Simplified43.0%
[Start]43.0 | \[ c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}
\] |
|---|---|
associate-/l* [<=]14.9 | \[ c0 \cdot {\color{blue}{\left(\frac{V \cdot \ell}{A}\right)}}^{-0.5}
\] |
*-lft-identity [<=]14.9 | \[ c0 \cdot {\left(\frac{V \cdot \ell}{\color{blue}{1 \cdot A}}\right)}^{-0.5}
\] |
times-frac [=>]43.0 | \[ c0 \cdot {\color{blue}{\left(\frac{V}{1} \cdot \frac{\ell}{A}\right)}}^{-0.5}
\] |
/-rgt-identity [=>]43.0 | \[ c0 \cdot {\left(\color{blue}{V} \cdot \frac{\ell}{A}\right)}^{-0.5}
\] |
Taylor expanded in V around -inf 52.1%
Simplified56.1%
[Start]52.1 | \[ c0 \cdot e^{-0.5 \cdot \left(\log \left(-1 \cdot \frac{\ell}{A}\right) + -1 \cdot \log \left(\frac{-1}{V}\right)\right)}
\] |
|---|---|
+-commutative [=>]52.1 | \[ c0 \cdot e^{-0.5 \cdot \color{blue}{\left(-1 \cdot \log \left(\frac{-1}{V}\right) + \log \left(-1 \cdot \frac{\ell}{A}\right)\right)}}
\] |
distribute-lft-in [=>]52.1 | \[ c0 \cdot e^{\color{blue}{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right) + -0.5 \cdot \log \left(-1 \cdot \frac{\ell}{A}\right)}}
\] |
*-commutative [<=]52.1 | \[ c0 \cdot e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right) + \color{blue}{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}}
\] |
exp-sum [=>]52.5 | \[ c0 \cdot \color{blue}{\left(e^{-0.5 \cdot \left(-1 \cdot \log \left(\frac{-1}{V}\right)\right)} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)}
\] |
associate-*r* [=>]52.5 | \[ c0 \cdot \left(e^{\color{blue}{\left(-0.5 \cdot -1\right) \cdot \log \left(\frac{-1}{V}\right)}} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)
\] |
metadata-eval [=>]52.5 | \[ c0 \cdot \left(e^{\color{blue}{0.5} \cdot \log \left(\frac{-1}{V}\right)} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)
\] |
*-commutative [<=]52.5 | \[ c0 \cdot \left(e^{\color{blue}{\log \left(\frac{-1}{V}\right) \cdot 0.5}} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)
\] |
exp-to-pow [=>]53.4 | \[ c0 \cdot \left(\color{blue}{{\left(\frac{-1}{V}\right)}^{0.5}} \cdot e^{\log \left(-1 \cdot \frac{\ell}{A}\right) \cdot -0.5}\right)
\] |
exp-to-pow [=>]56.1 | \[ c0 \cdot \left({\left(\frac{-1}{V}\right)}^{0.5} \cdot \color{blue}{{\left(-1 \cdot \frac{\ell}{A}\right)}^{-0.5}}\right)
\] |
associate-*r/ [=>]56.1 | \[ c0 \cdot \left({\left(\frac{-1}{V}\right)}^{0.5} \cdot {\color{blue}{\left(\frac{-1 \cdot \ell}{A}\right)}}^{-0.5}\right)
\] |
neg-mul-1 [<=]56.1 | \[ c0 \cdot \left({\left(\frac{-1}{V}\right)}^{0.5} \cdot {\left(\frac{\color{blue}{-\ell}}{A}\right)}^{-0.5}\right)
\] |
if -inf.0 < (*.f64 V l) < -2.00000000000000012e-295Initial program 77.5%
Applied egg-rr92.1%
[Start]77.5 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
frac-2neg [=>]77.5 | \[ c0 \cdot \sqrt{\color{blue}{\frac{-A}{-V \cdot \ell}}}
\] |
sqrt-div [=>]92.1 | \[ c0 \cdot \color{blue}{\frac{\sqrt{-A}}{\sqrt{-V \cdot \ell}}}
\] |
*-commutative [=>]92.1 | \[ c0 \cdot \frac{\sqrt{-A}}{\sqrt{-\color{blue}{\ell \cdot V}}}
\] |
distribute-rgt-neg-in [=>]92.1 | \[ c0 \cdot \frac{\sqrt{-A}}{\sqrt{\color{blue}{\ell \cdot \left(-V\right)}}}
\] |
if 0.0 < (*.f64 V l) < 3.99999999999999993e296Initial program 76.3%
Applied egg-rr87.1%
[Start]76.3 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
sqrt-div [=>]90.5 | \[ c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}}
\] |
associate-*r/ [=>]87.1 | \[ \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}}
\] |
Simplified90.6%
[Start]87.1 | \[ \frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}
\] |
|---|---|
associate-/l* [=>]90.6 | \[ \color{blue}{\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}}
\] |
if 3.99999999999999993e296 < (*.f64 V l) Initial program 40.4%
Applied egg-rr45.1%
[Start]40.4 | \[ c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\] |
|---|---|
associate-/r* [=>]66.5 | \[ c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}}
\] |
sqrt-div [=>]45.1 | \[ c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}}
\] |
Final simplification81.7%
| Alternative 1 | |
|---|---|
| Accuracy | 81.5% |
| Cost | 20036 |
| Alternative 2 | |
|---|---|
| Accuracy | 75.5% |
| Cost | 14808 |
| Alternative 3 | |
|---|---|
| Accuracy | 75.5% |
| Cost | 14808 |
| Alternative 4 | |
|---|---|
| Accuracy | 77.6% |
| Cost | 14288 |
| Alternative 5 | |
|---|---|
| Accuracy | 77.6% |
| Cost | 14288 |
| Alternative 6 | |
|---|---|
| Accuracy | 81.8% |
| Cost | 14288 |
| Alternative 7 | |
|---|---|
| Accuracy | 81.4% |
| Cost | 14288 |
| Alternative 8 | |
|---|---|
| Accuracy | 71.3% |
| Cost | 13645 |
| Alternative 9 | |
|---|---|
| Accuracy | 70.4% |
| Cost | 7752 |
| Alternative 10 | |
|---|---|
| Accuracy | 70.4% |
| Cost | 7752 |
| Alternative 11 | |
|---|---|
| Accuracy | 70.4% |
| Cost | 7688 |
| Alternative 12 | |
|---|---|
| Accuracy | 70.4% |
| Cost | 7688 |
| Alternative 13 | |
|---|---|
| Accuracy | 70.4% |
| Cost | 7688 |
| Alternative 14 | |
|---|---|
| Accuracy | 69.9% |
| Cost | 7625 |
| Alternative 15 | |
|---|---|
| Accuracy | 70.1% |
| Cost | 7624 |
| Alternative 16 | |
|---|---|
| Accuracy | 70.4% |
| Cost | 7624 |
| Alternative 17 | |
|---|---|
| Accuracy | 70.4% |
| Cost | 7624 |
| Alternative 18 | |
|---|---|
| Accuracy | 63.2% |
| Cost | 6848 |
herbie shell --seed 2023153
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))