| Alternative 1 | |
|---|---|
| Error | 40.0 |
| Cost | 14884 |
(FPCore (n U t l Om U*) :precision binary64 (sqrt (* (* (* 2.0 n) U) (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))
(FPCore (n U t l Om U*)
:precision binary64
(let* ((t_1 (pow (/ l Om) 2.0))
(t_2
(sqrt
(*
(* (* 2.0 n) U)
(- (- t (* 2.0 (/ (* l l) Om))) (* (* n t_1) (- U U*)))))))
(if (<= t_2 1e-138)
(sqrt
(*
n
(* U (* -2.0 (+ (* n (* (- U U*) t_1)) (- (* l (* 2.0 (/ l Om))) t))))))
(if (<= t_2 2e+152) t_2 (- (* (* n l) (/ (sqrt (* (* U* U) 2.0)) Om)))))))double code(double n, double U, double t, double l, double Om, double U_42_) {
return sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * pow((l / Om), 2.0)) * (U - U_42_)))));
}
double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = pow((l / Om), 2.0);
double t_2 = sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * t_1) * (U - U_42_)))));
double tmp;
if (t_2 <= 1e-138) {
tmp = sqrt((n * (U * (-2.0 * ((n * ((U - U_42_) * t_1)) + ((l * (2.0 * (l / Om))) - t))))));
} else if (t_2 <= 2e+152) {
tmp = t_2;
} else {
tmp = -((n * l) * (sqrt(((U_42_ * U) * 2.0)) / Om));
}
return tmp;
}
real(8) function code(n, u, t, l, om, u_42)
real(8), intent (in) :: n
real(8), intent (in) :: u
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: u_42
code = sqrt((((2.0d0 * n) * u) * ((t - (2.0d0 * ((l * l) / om))) - ((n * ((l / om) ** 2.0d0)) * (u - u_42)))))
end function
real(8) function code(n, u, t, l, om, u_42)
real(8), intent (in) :: n
real(8), intent (in) :: u
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: u_42
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (l / om) ** 2.0d0
t_2 = sqrt((((2.0d0 * n) * u) * ((t - (2.0d0 * ((l * l) / om))) - ((n * t_1) * (u - u_42)))))
if (t_2 <= 1d-138) then
tmp = sqrt((n * (u * ((-2.0d0) * ((n * ((u - u_42) * t_1)) + ((l * (2.0d0 * (l / om))) - t))))))
else if (t_2 <= 2d+152) then
tmp = t_2
else
tmp = -((n * l) * (sqrt(((u_42 * u) * 2.0d0)) / om))
end if
code = tmp
end function
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
return Math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * Math.pow((l / Om), 2.0)) * (U - U_42_)))));
}
public static double code(double n, double U, double t, double l, double Om, double U_42_) {
double t_1 = Math.pow((l / Om), 2.0);
double t_2 = Math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * t_1) * (U - U_42_)))));
double tmp;
if (t_2 <= 1e-138) {
tmp = Math.sqrt((n * (U * (-2.0 * ((n * ((U - U_42_) * t_1)) + ((l * (2.0 * (l / Om))) - t))))));
} else if (t_2 <= 2e+152) {
tmp = t_2;
} else {
tmp = -((n * l) * (Math.sqrt(((U_42_ * U) * 2.0)) / Om));
}
return tmp;
}
def code(n, U, t, l, Om, U_42_): return math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * math.pow((l / Om), 2.0)) * (U - U_42_)))))
def code(n, U, t, l, Om, U_42_): t_1 = math.pow((l / Om), 2.0) t_2 = math.sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * t_1) * (U - U_42_))))) tmp = 0 if t_2 <= 1e-138: tmp = math.sqrt((n * (U * (-2.0 * ((n * ((U - U_42_) * t_1)) + ((l * (2.0 * (l / Om))) - t)))))) elif t_2 <= 2e+152: tmp = t_2 else: tmp = -((n * l) * (math.sqrt(((U_42_ * U) * 2.0)) / Om)) return tmp
function code(n, U, t, l, Om, U_42_) return sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * (Float64(l / Om) ^ 2.0)) * Float64(U - U_42_))))) end
function code(n, U, t, l, Om, U_42_) t_1 = Float64(l / Om) ^ 2.0 t_2 = sqrt(Float64(Float64(Float64(2.0 * n) * U) * Float64(Float64(t - Float64(2.0 * Float64(Float64(l * l) / Om))) - Float64(Float64(n * t_1) * Float64(U - U_42_))))) tmp = 0.0 if (t_2 <= 1e-138) tmp = sqrt(Float64(n * Float64(U * Float64(-2.0 * Float64(Float64(n * Float64(Float64(U - U_42_) * t_1)) + Float64(Float64(l * Float64(2.0 * Float64(l / Om))) - t)))))); elseif (t_2 <= 2e+152) tmp = t_2; else tmp = Float64(-Float64(Float64(n * l) * Float64(sqrt(Float64(Float64(U_42_ * U) * 2.0)) / Om))); end return tmp end
function tmp = code(n, U, t, l, Om, U_42_) tmp = sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * ((l / Om) ^ 2.0)) * (U - U_42_))))); end
function tmp_2 = code(n, U, t, l, Om, U_42_) t_1 = (l / Om) ^ 2.0; t_2 = sqrt((((2.0 * n) * U) * ((t - (2.0 * ((l * l) / Om))) - ((n * t_1) * (U - U_42_))))); tmp = 0.0; if (t_2 <= 1e-138) tmp = sqrt((n * (U * (-2.0 * ((n * ((U - U_42_) * t_1)) + ((l * (2.0 * (l / Om))) - t)))))); elseif (t_2 <= 2e+152) tmp = t_2; else tmp = -((n * l) * (sqrt(((U_42_ * U) * 2.0)) / Om)); end tmp_2 = tmp; end
code[n_, U_, t_, l_, Om_, U$42$_] := N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[n_, U_, t_, l_, Om_, U$42$_] := Block[{t$95$1 = N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(N[(2.0 * n), $MachinePrecision] * U), $MachinePrecision] * N[(N[(t - N[(2.0 * N[(N[(l * l), $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * t$95$1), $MachinePrecision] * N[(U - U$42$), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 1e-138], N[Sqrt[N[(n * N[(U * N[(-2.0 * N[(N[(n * N[(N[(U - U$42$), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(l * N[(2.0 * N[(l / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$2, 2e+152], t$95$2, (-N[(N[(n * l), $MachinePrecision] * N[(N[Sqrt[N[(N[(U$42$ * U), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision])]]]]
\sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\begin{array}{l}
t_1 := {\left(\frac{\ell}{Om}\right)}^{2}\\
t_2 := \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot t_1\right) \cdot \left(U - U*\right)\right)}\\
\mathbf{if}\;t_2 \leq 10^{-138}:\\
\;\;\;\;\sqrt{n \cdot \left(U \cdot \left(-2 \cdot \left(n \cdot \left(\left(U - U*\right) \cdot t_1\right) + \left(\ell \cdot \left(2 \cdot \frac{\ell}{Om}\right) - t\right)\right)\right)\right)}\\
\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+152}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-\left(n \cdot \ell\right) \cdot \frac{\sqrt{\left(U* \cdot U\right) \cdot 2}}{Om}\\
\end{array}
Results
if (sqrt.f64 (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.f64 U U*))))) < 1.00000000000000007e-138Initial program 50.7
Simplified50.7
[Start]50.7 | \[ \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\] |
|---|---|
rational_best-simplify-2 [=>]50.7 | \[ \sqrt{\color{blue}{\left(U \cdot \left(2 \cdot n\right)\right)} \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\] |
rational_best-simplify-44 [=>]50.7 | \[ \sqrt{\color{blue}{\left(2 \cdot \left(U \cdot n\right)\right)} \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\] |
rational_best-simplify-47 [=>]50.7 | \[ \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(\left(t - 2 \cdot \color{blue}{\left(\ell \cdot \frac{\ell}{Om}\right)}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\] |
rational_best-simplify-2 [=>]50.7 | \[ \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) - \color{blue}{\left(U - U*\right) \cdot \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right)}\right)}
\] |
rational_best-simplify-2 [=>]50.7 | \[ \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) - \left(U - U*\right) \cdot \color{blue}{\left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)}\right)}
\] |
rational_best-simplify-44 [=>]50.7 | \[ \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) - \color{blue}{{\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(\left(U - U*\right) \cdot n\right)}\right)}
\] |
Applied egg-rr36.3
Simplified37.3
[Start]36.3 | \[ \sqrt{U \cdot \left(n \cdot \left(\left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(n \cdot \left(U - U*\right)\right) + \left(2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right) - t\right)\right) \cdot -2\right)\right)} + 0
\] |
|---|---|
rational_best-simplify-3 [=>]36.3 | \[ \color{blue}{\sqrt{U \cdot \left(n \cdot \left(\left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(n \cdot \left(U - U*\right)\right) + \left(2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right) - t\right)\right) \cdot -2\right)\right)}}
\] |
rational_best-simplify-44 [=>]35.7 | \[ \sqrt{\color{blue}{n \cdot \left(U \cdot \left(\left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(n \cdot \left(U - U*\right)\right) + \left(2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right) - t\right)\right) \cdot -2\right)\right)}}
\] |
rational_best-simplify-2 [=>]35.7 | \[ \sqrt{n \cdot \left(U \cdot \color{blue}{\left(-2 \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(n \cdot \left(U - U*\right)\right) + \left(2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right) - t\right)\right)\right)}\right)}
\] |
rational_best-simplify-44 [=>]37.3 | \[ \sqrt{n \cdot \left(U \cdot \left(-2 \cdot \left(\color{blue}{n \cdot \left({\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(U - U*\right)\right)} + \left(2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right) - t\right)\right)\right)\right)}
\] |
rational_best-simplify-2 [=>]37.3 | \[ \sqrt{n \cdot \left(U \cdot \left(-2 \cdot \left(n \cdot \color{blue}{\left(\left(U - U*\right) \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right)} + \left(2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right) - t\right)\right)\right)\right)}
\] |
rational_best-simplify-44 [=>]37.3 | \[ \sqrt{n \cdot \left(U \cdot \left(-2 \cdot \left(n \cdot \left(\left(U - U*\right) \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) + \left(\color{blue}{\ell \cdot \left(2 \cdot \frac{\ell}{Om}\right)} - t\right)\right)\right)\right)}
\] |
if 1.00000000000000007e-138 < (sqrt.f64 (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.f64 U U*))))) < 2.0000000000000001e152Initial program 1.6
if 2.0000000000000001e152 < (sqrt.f64 (*.f64 (*.f64 (*.f64 2 n) U) (-.f64 (-.f64 t (*.f64 2 (/.f64 (*.f64 l l) Om))) (*.f64 (*.f64 n (pow.f64 (/.f64 l Om) 2)) (-.f64 U U*))))) Initial program 63.6
Simplified55.5
[Start]63.6 | \[ \sqrt{\left(\left(2 \cdot n\right) \cdot U\right) \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\] |
|---|---|
rational_best-simplify-2 [=>]63.6 | \[ \sqrt{\color{blue}{\left(U \cdot \left(2 \cdot n\right)\right)} \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\] |
rational_best-simplify-44 [=>]63.6 | \[ \sqrt{\color{blue}{\left(2 \cdot \left(U \cdot n\right)\right)} \cdot \left(\left(t - 2 \cdot \frac{\ell \cdot \ell}{Om}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\] |
rational_best-simplify-47 [=>]55.8 | \[ \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(\left(t - 2 \cdot \color{blue}{\left(\ell \cdot \frac{\ell}{Om}\right)}\right) - \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right) \cdot \left(U - U*\right)\right)}
\] |
rational_best-simplify-2 [=>]55.8 | \[ \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) - \color{blue}{\left(U - U*\right) \cdot \left(n \cdot {\left(\frac{\ell}{Om}\right)}^{2}\right)}\right)}
\] |
rational_best-simplify-2 [=>]55.8 | \[ \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) - \left(U - U*\right) \cdot \color{blue}{\left({\left(\frac{\ell}{Om}\right)}^{2} \cdot n\right)}\right)}
\] |
rational_best-simplify-44 [=>]55.5 | \[ \sqrt{\left(2 \cdot \left(U \cdot n\right)\right) \cdot \left(\left(t - 2 \cdot \left(\ell \cdot \frac{\ell}{Om}\right)\right) - \color{blue}{{\left(\frac{\ell}{Om}\right)}^{2} \cdot \left(\left(U - U*\right) \cdot n\right)}\right)}
\] |
Taylor expanded in U* around inf 63.0
Simplified61.4
[Start]63.0 | \[ \sqrt{2 \cdot \frac{{n}^{2} \cdot \left({\ell}^{2} \cdot \left(U \cdot U*\right)\right)}{{Om}^{2}}}
\] |
|---|---|
rational_best-simplify-2 [=>]63.0 | \[ \sqrt{2 \cdot \frac{{n}^{2} \cdot \color{blue}{\left(\left(U \cdot U*\right) \cdot {\ell}^{2}\right)}}{{Om}^{2}}}
\] |
rational_best-simplify-44 [=>]63.1 | \[ \sqrt{2 \cdot \frac{\color{blue}{\left(U \cdot U*\right) \cdot \left({n}^{2} \cdot {\ell}^{2}\right)}}{{Om}^{2}}}
\] |
rational_best-simplify-47 [=>]63.1 | \[ \sqrt{2 \cdot \color{blue}{\left(\left({n}^{2} \cdot {\ell}^{2}\right) \cdot \frac{U \cdot U*}{{Om}^{2}}\right)}}
\] |
exponential-simplify-27 [=>]61.4 | \[ \sqrt{2 \cdot \left(\color{blue}{{\left(\ell \cdot n\right)}^{2}} \cdot \frac{U \cdot U*}{{Om}^{2}}\right)}
\] |
rational_best-simplify-2 [<=]61.4 | \[ \sqrt{2 \cdot \left({\color{blue}{\left(n \cdot \ell\right)}}^{2} \cdot \frac{U \cdot U*}{{Om}^{2}}\right)}
\] |
Taylor expanded in n around -inf 55.8
Simplified55.8
[Start]55.8 | \[ -1 \cdot \left(\frac{\sqrt{2} \cdot \left(n \cdot \ell\right)}{Om} \cdot \sqrt{U \cdot U*}\right)
\] |
|---|---|
rational_best-simplify-44 [=>]55.8 | \[ \color{blue}{\frac{\sqrt{2} \cdot \left(n \cdot \ell\right)}{Om} \cdot \left(-1 \cdot \sqrt{U \cdot U*}\right)}
\] |
rational_best-simplify-2 [<=]55.8 | \[ \frac{\sqrt{2} \cdot \left(n \cdot \ell\right)}{Om} \cdot \left(-1 \cdot \sqrt{\color{blue}{U* \cdot U}}\right)
\] |
Applied egg-rr55.5
Final simplification29.0
| Alternative 1 | |
|---|---|
| Error | 40.0 |
| Cost | 14884 |
| Alternative 2 | |
|---|---|
| Error | 39.9 |
| Cost | 14884 |
| Alternative 3 | |
|---|---|
| Error | 30.0 |
| Cost | 14728 |
| Alternative 4 | |
|---|---|
| Error | 30.0 |
| Cost | 14728 |
| Alternative 5 | |
|---|---|
| Error | 33.1 |
| Cost | 14224 |
| Alternative 6 | |
|---|---|
| Error | 33.1 |
| Cost | 14224 |
| Alternative 7 | |
|---|---|
| Error | 41.1 |
| Cost | 14160 |
| Alternative 8 | |
|---|---|
| Error | 41.2 |
| Cost | 14096 |
| Alternative 9 | |
|---|---|
| Error | 41.0 |
| Cost | 14096 |
| Alternative 10 | |
|---|---|
| Error | 41.2 |
| Cost | 7696 |
| Alternative 11 | |
|---|---|
| Error | 36.2 |
| Cost | 7240 |
| Alternative 12 | |
|---|---|
| Error | 39.1 |
| Cost | 7112 |
| Alternative 13 | |
|---|---|
| Error | 39.0 |
| Cost | 7112 |
| Alternative 14 | |
|---|---|
| Error | 38.6 |
| Cost | 7112 |
| Alternative 15 | |
|---|---|
| Error | 40.1 |
| Cost | 6848 |
herbie shell --seed 2023096
(FPCore (n U t l Om U*)
:name "Toniolo and Linder, Equation (13)"
:precision binary64
(sqrt (* (* (* 2.0 n) U) (- (- t (* 2.0 (/ (* l l) Om))) (* (* n (pow (/ l Om) 2.0)) (- U U*))))))