| Alternative 1 | |
|---|---|
| Error | 11.6 |
| Cost | 26960 |
(FPCore (x l t) :precision binary64 (/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))
(FPCore (x l t)
:precision binary64
(let* ((t_1 (* (sqrt 2.0) t))
(t_2 (/ t_1 (- (* (sqrt (/ (+ x 1.0) (+ -1.0 x))) (* t (sqrt 2.0))))))
(t_3 (/ (pow l 2.0) x)))
(if (<= t -3.7e-19)
t_2
(if (<= t -9e-152)
(/ t_1 (sqrt (* (+ (pow t 2.0) t_3) 2.0)))
(if (<= t -2.7e-272)
t_2
(if (<= t 1.35e+35)
(/
t_1
(sqrt
(+ (* 2.0 (/ (* (pow t 2.0) (+ x 1.0)) (+ -1.0 x))) (* 2.0 t_3))))
(sqrt (/ (- x 1.0) (+ 1.0 x)))))))))double code(double x, double l, double t) {
return (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
double code(double x, double l, double t) {
double t_1 = sqrt(2.0) * t;
double t_2 = t_1 / -(sqrt(((x + 1.0) / (-1.0 + x))) * (t * sqrt(2.0)));
double t_3 = pow(l, 2.0) / x;
double tmp;
if (t <= -3.7e-19) {
tmp = t_2;
} else if (t <= -9e-152) {
tmp = t_1 / sqrt(((pow(t, 2.0) + t_3) * 2.0));
} else if (t <= -2.7e-272) {
tmp = t_2;
} else if (t <= 1.35e+35) {
tmp = t_1 / sqrt(((2.0 * ((pow(t, 2.0) * (x + 1.0)) / (-1.0 + x))) + (2.0 * t_3)));
} else {
tmp = sqrt(((x - 1.0) / (1.0 + x)));
}
return tmp;
}
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
code = (sqrt(2.0d0) * t) / sqrt(((((x + 1.0d0) / (x - 1.0d0)) * ((l * l) + (2.0d0 * (t * t)))) - (l * l)))
end function
real(8) function code(x, l, t)
real(8), intent (in) :: x
real(8), intent (in) :: l
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = sqrt(2.0d0) * t
t_2 = t_1 / -(sqrt(((x + 1.0d0) / ((-1.0d0) + x))) * (t * sqrt(2.0d0)))
t_3 = (l ** 2.0d0) / x
if (t <= (-3.7d-19)) then
tmp = t_2
else if (t <= (-9d-152)) then
tmp = t_1 / sqrt((((t ** 2.0d0) + t_3) * 2.0d0))
else if (t <= (-2.7d-272)) then
tmp = t_2
else if (t <= 1.35d+35) then
tmp = t_1 / sqrt(((2.0d0 * (((t ** 2.0d0) * (x + 1.0d0)) / ((-1.0d0) + x))) + (2.0d0 * t_3)))
else
tmp = sqrt(((x - 1.0d0) / (1.0d0 + x)))
end if
code = tmp
end function
public static double code(double x, double l, double t) {
return (Math.sqrt(2.0) * t) / Math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)));
}
public static double code(double x, double l, double t) {
double t_1 = Math.sqrt(2.0) * t;
double t_2 = t_1 / -(Math.sqrt(((x + 1.0) / (-1.0 + x))) * (t * Math.sqrt(2.0)));
double t_3 = Math.pow(l, 2.0) / x;
double tmp;
if (t <= -3.7e-19) {
tmp = t_2;
} else if (t <= -9e-152) {
tmp = t_1 / Math.sqrt(((Math.pow(t, 2.0) + t_3) * 2.0));
} else if (t <= -2.7e-272) {
tmp = t_2;
} else if (t <= 1.35e+35) {
tmp = t_1 / Math.sqrt(((2.0 * ((Math.pow(t, 2.0) * (x + 1.0)) / (-1.0 + x))) + (2.0 * t_3)));
} else {
tmp = Math.sqrt(((x - 1.0) / (1.0 + x)));
}
return tmp;
}
def code(x, l, t): return (math.sqrt(2.0) * t) / math.sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l)))
def code(x, l, t): t_1 = math.sqrt(2.0) * t t_2 = t_1 / -(math.sqrt(((x + 1.0) / (-1.0 + x))) * (t * math.sqrt(2.0))) t_3 = math.pow(l, 2.0) / x tmp = 0 if t <= -3.7e-19: tmp = t_2 elif t <= -9e-152: tmp = t_1 / math.sqrt(((math.pow(t, 2.0) + t_3) * 2.0)) elif t <= -2.7e-272: tmp = t_2 elif t <= 1.35e+35: tmp = t_1 / math.sqrt(((2.0 * ((math.pow(t, 2.0) * (x + 1.0)) / (-1.0 + x))) + (2.0 * t_3))) else: tmp = math.sqrt(((x - 1.0) / (1.0 + x))) return tmp
function code(x, l, t) return Float64(Float64(sqrt(2.0) * t) / sqrt(Float64(Float64(Float64(Float64(x + 1.0) / Float64(x - 1.0)) * Float64(Float64(l * l) + Float64(2.0 * Float64(t * t)))) - Float64(l * l)))) end
function code(x, l, t) t_1 = Float64(sqrt(2.0) * t) t_2 = Float64(t_1 / Float64(-Float64(sqrt(Float64(Float64(x + 1.0) / Float64(-1.0 + x))) * Float64(t * sqrt(2.0))))) t_3 = Float64((l ^ 2.0) / x) tmp = 0.0 if (t <= -3.7e-19) tmp = t_2; elseif (t <= -9e-152) tmp = Float64(t_1 / sqrt(Float64(Float64((t ^ 2.0) + t_3) * 2.0))); elseif (t <= -2.7e-272) tmp = t_2; elseif (t <= 1.35e+35) tmp = Float64(t_1 / sqrt(Float64(Float64(2.0 * Float64(Float64((t ^ 2.0) * Float64(x + 1.0)) / Float64(-1.0 + x))) + Float64(2.0 * t_3)))); else tmp = sqrt(Float64(Float64(x - 1.0) / Float64(1.0 + x))); end return tmp end
function tmp = code(x, l, t) tmp = (sqrt(2.0) * t) / sqrt(((((x + 1.0) / (x - 1.0)) * ((l * l) + (2.0 * (t * t)))) - (l * l))); end
function tmp_2 = code(x, l, t) t_1 = sqrt(2.0) * t; t_2 = t_1 / -(sqrt(((x + 1.0) / (-1.0 + x))) * (t * sqrt(2.0))); t_3 = (l ^ 2.0) / x; tmp = 0.0; if (t <= -3.7e-19) tmp = t_2; elseif (t <= -9e-152) tmp = t_1 / sqrt((((t ^ 2.0) + t_3) * 2.0)); elseif (t <= -2.7e-272) tmp = t_2; elseif (t <= 1.35e+35) tmp = t_1 / sqrt(((2.0 * (((t ^ 2.0) * (x + 1.0)) / (-1.0 + x))) + (2.0 * t_3))); else tmp = sqrt(((x - 1.0) / (1.0 + x))); end tmp_2 = tmp; end
code[x_, l_, t_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(l * l), $MachinePrecision] + N[(2.0 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, l_, t_] := Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / (-N[(N[Sqrt[N[(N[(x + 1.0), $MachinePrecision] / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[l, 2.0], $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t, -3.7e-19], t$95$2, If[LessEqual[t, -9e-152], N[(t$95$1 / N[Sqrt[N[(N[(N[Power[t, 2.0], $MachinePrecision] + t$95$3), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.7e-272], t$95$2, If[LessEqual[t, 1.35e+35], N[(t$95$1 / N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[t, 2.0], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(x - 1.0), $MachinePrecision] / N[(1.0 + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]]
\frac{\sqrt{2} \cdot t}{\sqrt{\frac{x + 1}{x - 1} \cdot \left(\ell \cdot \ell + 2 \cdot \left(t \cdot t\right)\right) - \ell \cdot \ell}}
\begin{array}{l}
t_1 := \sqrt{2} \cdot t\\
t_2 := \frac{t_1}{-\sqrt{\frac{x + 1}{-1 + x}} \cdot \left(t \cdot \sqrt{2}\right)}\\
t_3 := \frac{{\ell}^{2}}{x}\\
\mathbf{if}\;t \leq -3.7 \cdot 10^{-19}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq -9 \cdot 10^{-152}:\\
\;\;\;\;\frac{t_1}{\sqrt{\left({t}^{2} + t_3\right) \cdot 2}}\\
\mathbf{elif}\;t \leq -2.7 \cdot 10^{-272}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{+35}:\\
\;\;\;\;\frac{t_1}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + 2 \cdot t_3}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x - 1}{1 + x}}\\
\end{array}
Results
if t < -3.70000000000000005e-19 or -9.0000000000000008e-152 < t < -2.69999999999999993e-272Initial program 45.0
Taylor expanded in t around -inf 11.3
Simplified11.3
[Start]11.3 | \[ \frac{\sqrt{2} \cdot t}{-1 \cdot \left(\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}\right)}
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-74 [=>]11.3 | \[ \frac{\sqrt{2} \cdot t}{\color{blue}{\left(\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}\right) \cdot -1}}
\] |
rational_best_oopsla_all_46_json_45_simplify-92 [=>]11.3 | \[ \frac{\sqrt{2} \cdot t}{\color{blue}{-\left(\sqrt{2} \cdot t\right) \cdot \sqrt{\frac{1 + x}{x - 1}}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]11.3 | \[ \frac{\sqrt{2} \cdot t}{-\color{blue}{\sqrt{\frac{1 + x}{x - 1}} \cdot \left(\sqrt{2} \cdot t\right)}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]11.3 | \[ \frac{\sqrt{2} \cdot t}{-\sqrt{\frac{\color{blue}{x + 1}}{x - 1}} \cdot \left(\sqrt{2} \cdot t\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]11.3 | \[ \frac{\sqrt{2} \cdot t}{-\sqrt{\frac{x + 1}{\color{blue}{x + -1}}} \cdot \left(\sqrt{2} \cdot t\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]11.3 | \[ \frac{\sqrt{2} \cdot t}{-\sqrt{\frac{x + 1}{\color{blue}{-1 + x}}} \cdot \left(\sqrt{2} \cdot t\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [<=]11.3 | \[ \frac{\sqrt{2} \cdot t}{-\sqrt{\frac{x + 1}{-1 + x}} \cdot \color{blue}{\left(t \cdot \sqrt{2}\right)}}
\] |
if -3.70000000000000005e-19 < t < -9.0000000000000008e-152Initial program 31.5
Taylor expanded in l around 0 21.3
Simplified17.9
[Start]21.3 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{\left(1 + x\right) \cdot {t}^{2}}{x - 1} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-74 [=>]21.3 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{\color{blue}{{t}^{2} \cdot \left(1 + x\right)}}{x - 1} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]21.3 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \color{blue}{\left(x + 1\right)}}{x - 1} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]21.3 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{\color{blue}{x + -1}} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]21.3 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{\color{blue}{-1 + x}} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]21.3 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + \color{blue}{{\ell}^{2} \cdot \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right)}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-107 [=>]17.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \color{blue}{\left(\frac{1}{x - 1} + \left(\frac{x}{x - 1} - 1\right)\right)}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]17.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \left(\frac{1}{\color{blue}{x + -1}} + \left(\frac{x}{x - 1} - 1\right)\right)}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]17.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \left(\frac{1}{\color{blue}{-1 + x}} + \left(\frac{x}{x - 1} - 1\right)\right)}}
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]17.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \left(\frac{1}{-1 + x} + \left(\frac{x}{\color{blue}{x + -1}} - 1\right)\right)}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]17.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \left(\frac{1}{-1 + x} + \left(\frac{x}{\color{blue}{-1 + x}} - 1\right)\right)}}
\] |
Taylor expanded in x around inf 9.2
Taylor expanded in x around inf 9.6
Applied egg-rr9.6
if -2.69999999999999993e-272 < t < 1.35000000000000001e35Initial program 43.5
Taylor expanded in l around 0 38.1
Simplified29.9
[Start]38.1 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{\left(1 + x\right) \cdot {t}^{2}}{x - 1} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-74 [=>]38.1 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{\color{blue}{{t}^{2} \cdot \left(1 + x\right)}}{x - 1} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]38.1 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \color{blue}{\left(x + 1\right)}}{x - 1} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]38.1 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{\color{blue}{x + -1}} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]38.1 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{\color{blue}{-1 + x}} + \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right) \cdot {\ell}^{2}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-74 [=>]38.1 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + \color{blue}{{\ell}^{2} \cdot \left(\left(\frac{x}{x - 1} + \frac{1}{x - 1}\right) - 1\right)}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-107 [=>]29.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \color{blue}{\left(\frac{1}{x - 1} + \left(\frac{x}{x - 1} - 1\right)\right)}}}
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]29.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \left(\frac{1}{\color{blue}{x + -1}} + \left(\frac{x}{x - 1} - 1\right)\right)}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]29.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \left(\frac{1}{\color{blue}{-1 + x}} + \left(\frac{x}{x - 1} - 1\right)\right)}}
\] |
rational_best_oopsla_all_46_json_45_simplify-45 [=>]29.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \left(\frac{1}{-1 + x} + \left(\frac{x}{\color{blue}{x + -1}} - 1\right)\right)}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]29.9 | \[ \frac{\sqrt{2} \cdot t}{\sqrt{2 \cdot \frac{{t}^{2} \cdot \left(x + 1\right)}{-1 + x} + {\ell}^{2} \cdot \left(\frac{1}{-1 + x} + \left(\frac{x}{\color{blue}{-1 + x}} - 1\right)\right)}}
\] |
Taylor expanded in x around inf 20.7
if 1.35000000000000001e35 < t Initial program 44.8
Taylor expanded in l around 0 4.2
Taylor expanded in t around 0 4.2
Final simplification11.7
| Alternative 1 | |
|---|---|
| Error | 11.6 |
| Cost | 26960 |
| Alternative 2 | |
|---|---|
| Error | 15.0 |
| Cost | 20620 |
| Alternative 3 | |
|---|---|
| Error | 15.2 |
| Cost | 20368 |
| Alternative 4 | |
|---|---|
| Error | 14.9 |
| Cost | 14084 |
| Alternative 5 | |
|---|---|
| Error | 15.0 |
| Cost | 13444 |
| Alternative 6 | |
|---|---|
| Error | 34.6 |
| Cost | 6980 |
| Alternative 7 | |
|---|---|
| Error | 34.8 |
| Cost | 6852 |
| Alternative 8 | |
|---|---|
| Error | 38.8 |
| Cost | 320 |
| Alternative 9 | |
|---|---|
| Error | 39.1 |
| Cost | 64 |
herbie shell --seed 2023090
(FPCore (x l t)
:name "Toniolo and Linder, Equation (7)"
:precision binary64
(/ (* (sqrt 2.0) t) (sqrt (- (* (/ (+ x 1.0) (- x 1.0)) (+ (* l l) (* 2.0 (* t t)))) (* l l)))))