| Alternative 1 | |
|---|---|
| Error | 14.8 |
| Cost | 20360 |
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ l (pow k 2.0))))
(if (<= k -2.9e-66)
(* l (* (/ l t) (/ (/ 2.0 (* (sin k) (tan k))) (pow k 2.0))))
(if (<= k 3.8e-69)
(* t_1 (/ 1.0 (* t (* 0.5 (/ (pow k 2.0) l)))))
(* l (* (/ 2.0 (sin k)) (/ (/ t_1 t) (tan k))))))))double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) - 1.0));
}
double code(double t, double l, double k) {
double t_1 = l / pow(k, 2.0);
double tmp;
if (k <= -2.9e-66) {
tmp = l * ((l / t) * ((2.0 / (sin(k) * tan(k))) / pow(k, 2.0)));
} else if (k <= 3.8e-69) {
tmp = t_1 * (1.0 / (t * (0.5 * (pow(k, 2.0) / l))));
} else {
tmp = l * ((2.0 / sin(k)) * ((t_1 / t) / tan(k)));
}
return tmp;
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) - 1.0d0))
end function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: t_1
real(8) :: tmp
t_1 = l / (k ** 2.0d0)
if (k <= (-2.9d-66)) then
tmp = l * ((l / t) * ((2.0d0 / (sin(k) * tan(k))) / (k ** 2.0d0)))
else if (k <= 3.8d-69) then
tmp = t_1 * (1.0d0 / (t * (0.5d0 * ((k ** 2.0d0) / l))))
else
tmp = l * ((2.0d0 / sin(k)) * ((t_1 / t) / tan(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) - 1.0));
}
public static double code(double t, double l, double k) {
double t_1 = l / Math.pow(k, 2.0);
double tmp;
if (k <= -2.9e-66) {
tmp = l * ((l / t) * ((2.0 / (Math.sin(k) * Math.tan(k))) / Math.pow(k, 2.0)));
} else if (k <= 3.8e-69) {
tmp = t_1 * (1.0 / (t * (0.5 * (Math.pow(k, 2.0) / l))));
} else {
tmp = l * ((2.0 / Math.sin(k)) * ((t_1 / t) / Math.tan(k)));
}
return tmp;
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) - 1.0))
def code(t, l, k): t_1 = l / math.pow(k, 2.0) tmp = 0 if k <= -2.9e-66: tmp = l * ((l / t) * ((2.0 / (math.sin(k) * math.tan(k))) / math.pow(k, 2.0))) elif k <= 3.8e-69: tmp = t_1 * (1.0 / (t * (0.5 * (math.pow(k, 2.0) / l)))) else: tmp = l * ((2.0 / math.sin(k)) * ((t_1 / t) / math.tan(k))) return tmp
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) - 1.0))) end
function code(t, l, k) t_1 = Float64(l / (k ^ 2.0)) tmp = 0.0 if (k <= -2.9e-66) tmp = Float64(l * Float64(Float64(l / t) * Float64(Float64(2.0 / Float64(sin(k) * tan(k))) / (k ^ 2.0)))); elseif (k <= 3.8e-69) tmp = Float64(t_1 * Float64(1.0 / Float64(t * Float64(0.5 * Float64((k ^ 2.0) / l))))); else tmp = Float64(l * Float64(Float64(2.0 / sin(k)) * Float64(Float64(t_1 / t) / tan(k)))); end return tmp end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) - 1.0)); end
function tmp_2 = code(t, l, k) t_1 = l / (k ^ 2.0); tmp = 0.0; if (k <= -2.9e-66) tmp = l * ((l / t) * ((2.0 / (sin(k) * tan(k))) / (k ^ 2.0))); elseif (k <= 3.8e-69) tmp = t_1 * (1.0 / (t * (0.5 * ((k ^ 2.0) / l)))); else tmp = l * ((2.0 / sin(k)) * ((t_1 / t) / tan(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[t_, l_, k_] := Block[{t$95$1 = N[(l / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, -2.9e-66], N[(l * N[(N[(l / t), $MachinePrecision] * N[(N[(2.0 / N[(N[Sin[k], $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 3.8e-69], N[(t$95$1 * N[(1.0 / N[(t * N[(0.5 * N[(N[Power[k, 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l * N[(N[(2.0 / N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / t), $MachinePrecision] / N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\begin{array}{l}
t_1 := \frac{\ell}{{k}^{2}}\\
\mathbf{if}\;k \leq -2.9 \cdot 10^{-66}:\\
\;\;\;\;\ell \cdot \left(\frac{\ell}{t} \cdot \frac{\frac{2}{\sin k \cdot \tan k}}{{k}^{2}}\right)\\
\mathbf{elif}\;k \leq 3.8 \cdot 10^{-69}:\\
\;\;\;\;t_1 \cdot \frac{1}{t \cdot \left(0.5 \cdot \frac{{k}^{2}}{\ell}\right)}\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(\frac{2}{\sin k} \cdot \frac{\frac{t_1}{t}}{\tan k}\right)\\
\end{array}
Results
if k < -2.90000000000000011e-66Initial program 45.1
Simplified36.8
[Start]45.1 | \[ \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\] |
|---|---|
rational.json-simplify-46 [=>]45.1 | \[ \color{blue}{\frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1}}
\] |
rational.json-simplify-48 [=>]36.8 | \[ \frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\color{blue}{{\left(\frac{k}{t}\right)}^{2} + \left(1 - 1\right)}}
\] |
metadata-eval [=>]36.8 | \[ \frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{{\left(\frac{k}{t}\right)}^{2} + \color{blue}{0}}
\] |
rational.json-simplify-4 [=>]36.8 | \[ \frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\color{blue}{{\left(\frac{k}{t}\right)}^{2}}}
\] |
Applied egg-rr35.0
Simplified33.8
[Start]35.0 | \[ \frac{2}{\left(\sin k \cdot \frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}\right) \cdot {\left(\frac{k}{t}\right)}^{2}} + 0
\] |
|---|---|
rational.json-simplify-4 [=>]35.0 | \[ \color{blue}{\frac{2}{\left(\sin k \cdot \frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}\right) \cdot {\left(\frac{k}{t}\right)}^{2}}}
\] |
rational.json-simplify-46 [=>]35.0 | \[ \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}}}{{\left(\frac{k}{t}\right)}^{2}}}
\] |
rational.json-simplify-46 [=>]35.0 | \[ \frac{\color{blue}{\frac{\frac{2}{\sin k}}{\frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}}}}{{\left(\frac{k}{t}\right)}^{2}}
\] |
rational.json-simplify-46 [=>]35.0 | \[ \frac{\frac{\frac{2}{\sin k}}{\color{blue}{\frac{\frac{\tan k}{\ell}}{\frac{\ell}{{t}^{3}}}}}}{{\left(\frac{k}{t}\right)}^{2}}
\] |
rational.json-simplify-61 [=>]34.9 | \[ \frac{\color{blue}{\frac{\frac{\ell}{{t}^{3}}}{\frac{\frac{\tan k}{\ell}}{\frac{2}{\sin k}}}}}{{\left(\frac{k}{t}\right)}^{2}}
\] |
rational.json-simplify-44 [=>]33.8 | \[ \color{blue}{\frac{\frac{\frac{\ell}{{t}^{3}}}{{\left(\frac{k}{t}\right)}^{2}}}{\frac{\frac{\tan k}{\ell}}{\frac{2}{\sin k}}}}
\] |
rational.json-simplify-47 [=>]33.8 | \[ \frac{\frac{\frac{\ell}{{t}^{3}}}{{\left(\frac{k}{t}\right)}^{2}}}{\color{blue}{\frac{\tan k}{\ell \cdot \frac{2}{\sin k}}}}
\] |
Taylor expanded in l around 0 15.3
Applied egg-rr12.6
Applied egg-rr12.8
Simplified12.8
[Start]12.8 | \[ \ell \cdot \frac{\frac{\frac{2}{\sin k}}{\tan k} \cdot \frac{\ell}{t}}{{k}^{2}} + 0
\] |
|---|---|
rational.json-simplify-4 [=>]12.8 | \[ \color{blue}{\ell \cdot \frac{\frac{\frac{2}{\sin k}}{\tan k} \cdot \frac{\ell}{t}}{{k}^{2}}}
\] |
rational.json-simplify-49 [=>]12.8 | \[ \ell \cdot \color{blue}{\left(\frac{\ell}{t} \cdot \frac{\frac{\frac{2}{\sin k}}{\tan k}}{{k}^{2}}\right)}
\] |
rational.json-simplify-47 [=>]12.8 | \[ \ell \cdot \left(\frac{\ell}{t} \cdot \frac{\color{blue}{\frac{2}{\sin k \cdot \tan k}}}{{k}^{2}}\right)
\] |
if -2.90000000000000011e-66 < k < 3.7999999999999998e-69Initial program 63.8
Simplified60.6
[Start]63.8 | \[ \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\] |
|---|---|
rational.json-simplify-46 [=>]63.8 | \[ \color{blue}{\frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1}}
\] |
rational.json-simplify-48 [=>]60.6 | \[ \frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\color{blue}{{\left(\frac{k}{t}\right)}^{2} + \left(1 - 1\right)}}
\] |
metadata-eval [=>]60.6 | \[ \frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{{\left(\frac{k}{t}\right)}^{2} + \color{blue}{0}}
\] |
rational.json-simplify-4 [=>]60.6 | \[ \frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\color{blue}{{\left(\frac{k}{t}\right)}^{2}}}
\] |
Applied egg-rr58.5
Simplified53.7
[Start]58.5 | \[ \frac{2}{\left(\sin k \cdot \frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}\right) \cdot {\left(\frac{k}{t}\right)}^{2}} + 0
\] |
|---|---|
rational.json-simplify-4 [=>]58.5 | \[ \color{blue}{\frac{2}{\left(\sin k \cdot \frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}\right) \cdot {\left(\frac{k}{t}\right)}^{2}}}
\] |
rational.json-simplify-46 [=>]58.4 | \[ \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}}}{{\left(\frac{k}{t}\right)}^{2}}}
\] |
rational.json-simplify-46 [=>]58.4 | \[ \frac{\color{blue}{\frac{\frac{2}{\sin k}}{\frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}}}}{{\left(\frac{k}{t}\right)}^{2}}
\] |
rational.json-simplify-46 [=>]55.5 | \[ \frac{\frac{\frac{2}{\sin k}}{\color{blue}{\frac{\frac{\tan k}{\ell}}{\frac{\ell}{{t}^{3}}}}}}{{\left(\frac{k}{t}\right)}^{2}}
\] |
rational.json-simplify-61 [=>]54.0 | \[ \frac{\color{blue}{\frac{\frac{\ell}{{t}^{3}}}{\frac{\frac{\tan k}{\ell}}{\frac{2}{\sin k}}}}}{{\left(\frac{k}{t}\right)}^{2}}
\] |
rational.json-simplify-44 [=>]53.7 | \[ \color{blue}{\frac{\frac{\frac{\ell}{{t}^{3}}}{{\left(\frac{k}{t}\right)}^{2}}}{\frac{\frac{\tan k}{\ell}}{\frac{2}{\sin k}}}}
\] |
rational.json-simplify-47 [=>]53.7 | \[ \frac{\frac{\frac{\ell}{{t}^{3}}}{{\left(\frac{k}{t}\right)}^{2}}}{\color{blue}{\frac{\tan k}{\ell \cdot \frac{2}{\sin k}}}}
\] |
Taylor expanded in l around 0 27.7
Applied egg-rr19.2
Taylor expanded in k around 0 19.3
if 3.7999999999999998e-69 < k Initial program 45.2
Simplified37.2
[Start]45.2 | \[ \frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)}
\] |
|---|---|
rational.json-simplify-46 [=>]45.3 | \[ \color{blue}{\frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1}}
\] |
rational.json-simplify-48 [=>]37.2 | \[ \frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\color{blue}{{\left(\frac{k}{t}\right)}^{2} + \left(1 - 1\right)}}
\] |
metadata-eval [=>]37.2 | \[ \frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{{\left(\frac{k}{t}\right)}^{2} + \color{blue}{0}}
\] |
rational.json-simplify-4 [=>]37.2 | \[ \frac{\frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k}}{\color{blue}{{\left(\frac{k}{t}\right)}^{2}}}
\] |
Applied egg-rr35.2
Simplified33.9
[Start]35.2 | \[ \frac{2}{\left(\sin k \cdot \frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}\right) \cdot {\left(\frac{k}{t}\right)}^{2}} + 0
\] |
|---|---|
rational.json-simplify-4 [=>]35.2 | \[ \color{blue}{\frac{2}{\left(\sin k \cdot \frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}\right) \cdot {\left(\frac{k}{t}\right)}^{2}}}
\] |
rational.json-simplify-46 [=>]35.2 | \[ \color{blue}{\frac{\frac{2}{\sin k \cdot \frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}}}{{\left(\frac{k}{t}\right)}^{2}}}
\] |
rational.json-simplify-46 [=>]35.2 | \[ \frac{\color{blue}{\frac{\frac{2}{\sin k}}{\frac{\tan k}{\ell \cdot \frac{\ell}{{t}^{3}}}}}}{{\left(\frac{k}{t}\right)}^{2}}
\] |
rational.json-simplify-46 [=>]35.1 | \[ \frac{\frac{\frac{2}{\sin k}}{\color{blue}{\frac{\frac{\tan k}{\ell}}{\frac{\ell}{{t}^{3}}}}}}{{\left(\frac{k}{t}\right)}^{2}}
\] |
rational.json-simplify-61 [=>]35.0 | \[ \frac{\color{blue}{\frac{\frac{\ell}{{t}^{3}}}{\frac{\frac{\tan k}{\ell}}{\frac{2}{\sin k}}}}}{{\left(\frac{k}{t}\right)}^{2}}
\] |
rational.json-simplify-44 [=>]33.9 | \[ \color{blue}{\frac{\frac{\frac{\ell}{{t}^{3}}}{{\left(\frac{k}{t}\right)}^{2}}}{\frac{\frac{\tan k}{\ell}}{\frac{2}{\sin k}}}}
\] |
rational.json-simplify-47 [=>]33.9 | \[ \frac{\frac{\frac{\ell}{{t}^{3}}}{{\left(\frac{k}{t}\right)}^{2}}}{\color{blue}{\frac{\tan k}{\ell \cdot \frac{2}{\sin k}}}}
\] |
Taylor expanded in l around 0 13.4
Applied egg-rr11.7
Simplified11.2
[Start]11.7 | \[ \ell \cdot \left(\frac{2}{\sin k} \cdot \frac{\frac{\ell}{t}}{{k}^{2} \cdot \tan k}\right) + 0
\] |
|---|---|
rational.json-simplify-4 [=>]11.7 | \[ \color{blue}{\ell \cdot \left(\frac{2}{\sin k} \cdot \frac{\frac{\ell}{t}}{{k}^{2} \cdot \tan k}\right)}
\] |
rational.json-simplify-46 [=>]11.7 | \[ \ell \cdot \left(\frac{2}{\sin k} \cdot \color{blue}{\frac{\frac{\frac{\ell}{t}}{{k}^{2}}}{\tan k}}\right)
\] |
rational.json-simplify-44 [=>]11.2 | \[ \ell \cdot \left(\frac{2}{\sin k} \cdot \frac{\color{blue}{\frac{\frac{\ell}{{k}^{2}}}{t}}}{\tan k}\right)
\] |
Final simplification12.8
| Alternative 1 | |
|---|---|
| Error | 14.8 |
| Cost | 20360 |
| Alternative 2 | |
|---|---|
| Error | 14.6 |
| Cost | 20360 |
| Alternative 3 | |
|---|---|
| Error | 14.0 |
| Cost | 20096 |
| Alternative 4 | |
|---|---|
| Error | 12.6 |
| Cost | 20096 |
| Alternative 5 | |
|---|---|
| Error | 25.0 |
| Cost | 13632 |
| Alternative 6 | |
|---|---|
| Error | 30.2 |
| Cost | 7040 |
| Alternative 7 | |
|---|---|
| Error | 29.7 |
| Cost | 7040 |
herbie shell --seed 2023075
(FPCore (t l k)
:name "Toniolo and Linder, Equation (10-)"
:precision binary64
(/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (- (+ 1.0 (pow (/ k t) 2.0)) 1.0))))