| Alternative 1 | |
|---|---|
| Error | 21.9 |
| Cost | 32960 |
(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
(if (<= l -1e-134)
(* 2.0 (* (cos k) (/ (pow l 2.0) (* (pow (sin k) 2.0) (* t (pow k 2.0))))))
(/
2.0
(* (sin k) (* (* (sin k) t) (/ (pow k 2.0) (* (cos k) (pow l 2.0))))))))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 tmp;
if (l <= -1e-134) {
tmp = 2.0 * (cos(k) * (pow(l, 2.0) / (pow(sin(k), 2.0) * (t * pow(k, 2.0)))));
} else {
tmp = 2.0 / (sin(k) * ((sin(k) * t) * (pow(k, 2.0) / (cos(k) * pow(l, 2.0)))));
}
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) :: tmp
if (l <= (-1d-134)) then
tmp = 2.0d0 * (cos(k) * ((l ** 2.0d0) / ((sin(k) ** 2.0d0) * (t * (k ** 2.0d0)))))
else
tmp = 2.0d0 / (sin(k) * ((sin(k) * t) * ((k ** 2.0d0) / (cos(k) * (l ** 2.0d0)))))
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 tmp;
if (l <= -1e-134) {
tmp = 2.0 * (Math.cos(k) * (Math.pow(l, 2.0) / (Math.pow(Math.sin(k), 2.0) * (t * Math.pow(k, 2.0)))));
} else {
tmp = 2.0 / (Math.sin(k) * ((Math.sin(k) * t) * (Math.pow(k, 2.0) / (Math.cos(k) * Math.pow(l, 2.0)))));
}
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): tmp = 0 if l <= -1e-134: tmp = 2.0 * (math.cos(k) * (math.pow(l, 2.0) / (math.pow(math.sin(k), 2.0) * (t * math.pow(k, 2.0))))) else: tmp = 2.0 / (math.sin(k) * ((math.sin(k) * t) * (math.pow(k, 2.0) / (math.cos(k) * math.pow(l, 2.0))))) 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) tmp = 0.0 if (l <= -1e-134) tmp = Float64(2.0 * Float64(cos(k) * Float64((l ^ 2.0) / Float64((sin(k) ^ 2.0) * Float64(t * (k ^ 2.0)))))); else tmp = Float64(2.0 / Float64(sin(k) * Float64(Float64(sin(k) * t) * Float64((k ^ 2.0) / Float64(cos(k) * (l ^ 2.0)))))); 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) tmp = 0.0; if (l <= -1e-134) tmp = 2.0 * (cos(k) * ((l ^ 2.0) / ((sin(k) ^ 2.0) * (t * (k ^ 2.0))))); else tmp = 2.0 / (sin(k) * ((sin(k) * t) * ((k ^ 2.0) / (cos(k) * (l ^ 2.0))))); 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_] := If[LessEqual[l, -1e-134], N[(2.0 * N[(N[Cos[k], $MachinePrecision] * N[(N[Power[l, 2.0], $MachinePrecision] / N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * N[(t * N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[Sin[k], $MachinePrecision] * N[(N[(N[Sin[k], $MachinePrecision] * t), $MachinePrecision] * N[(N[Power[k, 2.0], $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-134}:\\
\;\;\;\;2 \cdot \left(\cos k \cdot \frac{{\ell}^{2}}{{\sin k}^{2} \cdot \left(t \cdot {k}^{2}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\sin k \cdot \left(\left(\sin k \cdot t\right) \cdot \frac{{k}^{2}}{\cos k \cdot {\ell}^{2}}\right)}\\
\end{array}
Results
if l < -1.00000000000000004e-134Initial program 49.0
Simplified42.2
[Start]49.0 | \[ \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_best-simplify-2 [=>]49.0 | \[ \frac{2}{\color{blue}{\left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right) \cdot \left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right)}}
\] |
rational_best-simplify-44 [=>]49.0 | \[ \frac{2}{\color{blue}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \left(\left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right) \cdot \tan k\right)}}
\] |
rational_best-simplify-2 [=>]49.0 | \[ \frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \color{blue}{\left(\tan k \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)\right)}}
\] |
rational_best-simplify-19 [=>]49.0 | \[ \frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \left(\tan k \cdot \color{blue}{\left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + -1\right)}\right)}
\] |
rational_best-simplify-1 [=>]49.0 | \[ \frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \left(\tan k \cdot \color{blue}{\left(-1 + \left(1 + {\left(\frac{k}{t}\right)}^{2}\right)\right)}\right)}
\] |
rational_best-simplify-43 [=>]42.2 | \[ \frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \left(\tan k \cdot \color{blue}{\left({\left(\frac{k}{t}\right)}^{2} + \left(1 + -1\right)\right)}\right)}
\] |
metadata-eval [=>]42.2 | \[ \frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \left(\tan k \cdot \left({\left(\frac{k}{t}\right)}^{2} + \color{blue}{0}\right)\right)}
\] |
rational_best-simplify-3 [=>]42.2 | \[ \frac{2}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \left(\tan k \cdot \color{blue}{{\left(\frac{k}{t}\right)}^{2}}\right)}
\] |
Taylor expanded in t around 0 26.0
Simplified27.2
[Start]26.0 | \[ \frac{2}{\frac{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)}{\cos k \cdot {\ell}^{2}}}
\] |
|---|---|
rational_best-simplify-2 [=>]26.0 | \[ \frac{2}{\frac{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}}{\cos k \cdot {\ell}^{2}}}
\] |
rational_best-simplify-44 [=>]27.2 | \[ \frac{2}{\frac{\color{blue}{t \cdot \left({k}^{2} \cdot {\sin k}^{2}\right)}}{\cos k \cdot {\ell}^{2}}}
\] |
rational_best-simplify-2 [=>]27.2 | \[ \frac{2}{\frac{\color{blue}{\left({k}^{2} \cdot {\sin k}^{2}\right) \cdot t}}{\cos k \cdot {\ell}^{2}}}
\] |
rational_best-simplify-47 [=>]27.2 | \[ \frac{2}{\color{blue}{t \cdot \frac{{k}^{2} \cdot {\sin k}^{2}}{\cos k \cdot {\ell}^{2}}}}
\] |
exponential-simplify-27 [=>]27.2 | \[ \frac{2}{t \cdot \frac{\color{blue}{{\left(\sin k \cdot k\right)}^{2}}}{\cos k \cdot {\ell}^{2}}}
\] |
rational_best-simplify-2 [=>]27.2 | \[ \frac{2}{t \cdot \frac{{\color{blue}{\left(k \cdot \sin k\right)}}^{2}}{\cos k \cdot {\ell}^{2}}}
\] |
Taylor expanded in t around 0 25.8
Simplified27.1
[Start]25.8 | \[ 2 \cdot \frac{\cos k \cdot {\ell}^{2}}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)}
\] |
|---|---|
rational_best-simplify-47 [=>]25.9 | \[ 2 \cdot \color{blue}{\left({\ell}^{2} \cdot \frac{\cos k}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)}\right)}
\] |
rational_best-simplify-2 [=>]25.9 | \[ 2 \cdot \color{blue}{\left(\frac{\cos k}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)} \cdot {\ell}^{2}\right)}
\] |
rational_best-simplify-44 [=>]26.0 | \[ \color{blue}{\frac{\cos k}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)} \cdot \left(2 \cdot {\ell}^{2}\right)}
\] |
rational_best-simplify-2 [=>]26.0 | \[ \frac{\cos k}{{k}^{2} \cdot \color{blue}{\left(t \cdot {\sin k}^{2}\right)}} \cdot \left(2 \cdot {\ell}^{2}\right)
\] |
rational_best-simplify-44 [=>]27.1 | \[ \frac{\cos k}{\color{blue}{t \cdot \left({k}^{2} \cdot {\sin k}^{2}\right)}} \cdot \left(2 \cdot {\ell}^{2}\right)
\] |
exponential-simplify-27 [=>]27.1 | \[ \frac{\cos k}{t \cdot \color{blue}{{\left(\sin k \cdot k\right)}^{2}}} \cdot \left(2 \cdot {\ell}^{2}\right)
\] |
rational_best-simplify-2 [<=]27.1 | \[ \frac{\cos k}{t \cdot {\color{blue}{\left(k \cdot \sin k\right)}}^{2}} \cdot \left(2 \cdot {\ell}^{2}\right)
\] |
Taylor expanded in k around inf 25.8
Simplified25.8
[Start]25.8 | \[ 2 \cdot \frac{\cos k \cdot {\ell}^{2}}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)}
\] |
|---|---|
rational_best-simplify-2 [=>]25.8 | \[ 2 \cdot \frac{\color{blue}{{\ell}^{2} \cdot \cos k}}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)}
\] |
rational_best-simplify-47 [=>]25.8 | \[ 2 \cdot \color{blue}{\left(\cos k \cdot \frac{{\ell}^{2}}{{k}^{2} \cdot \left({\sin k}^{2} \cdot t\right)}\right)}
\] |
rational_best-simplify-44 [=>]25.8 | \[ 2 \cdot \left(\cos k \cdot \frac{{\ell}^{2}}{\color{blue}{{\sin k}^{2} \cdot \left({k}^{2} \cdot t\right)}}\right)
\] |
rational_best-simplify-2 [=>]25.8 | \[ 2 \cdot \left(\cos k \cdot \frac{{\ell}^{2}}{{\sin k}^{2} \cdot \color{blue}{\left(t \cdot {k}^{2}\right)}}\right)
\] |
if -1.00000000000000004e-134 < l Initial program 46.3
Simplified38.5
[Start]46.3 | \[ \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_best-simplify-2 [=>]46.3 | \[ \frac{2}{\color{blue}{\left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right) \cdot \left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right)}}
\] |
rational_best-simplify-44 [=>]46.3 | \[ \frac{2}{\color{blue}{\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \left(\left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right) \cdot \tan k\right)}}
\] |
rational_best-simplify-2 [=>]46.3 | \[ \frac{2}{\color{blue}{\left(\left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right) \cdot \tan k\right) \cdot \left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right)}}
\] |
rational_best-simplify-44 [=>]46.3 | \[ \frac{2}{\color{blue}{\frac{{t}^{3}}{\ell \cdot \ell} \cdot \left(\left(\left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right) \cdot \tan k\right) \cdot \sin k\right)}}
\] |
rational_best-simplify-2 [<=]46.3 | \[ \frac{2}{\frac{{t}^{3}}{\ell \cdot \ell} \cdot \color{blue}{\left(\sin k \cdot \left(\left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right) \cdot \tan k\right)\right)}}
\] |
rational_best-simplify-2 [=>]46.3 | \[ \frac{2}{\frac{{t}^{3}}{\ell \cdot \ell} \cdot \left(\sin k \cdot \color{blue}{\left(\tan k \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) - 1\right)\right)}\right)}
\] |
rational_best-simplify-19 [=>]46.3 | \[ \frac{2}{\frac{{t}^{3}}{\ell \cdot \ell} \cdot \left(\sin k \cdot \left(\tan k \cdot \color{blue}{\left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + -1\right)}\right)\right)}
\] |
rational_best-simplify-1 [=>]46.3 | \[ \frac{2}{\frac{{t}^{3}}{\ell \cdot \ell} \cdot \left(\sin k \cdot \left(\tan k \cdot \color{blue}{\left(-1 + \left(1 + {\left(\frac{k}{t}\right)}^{2}\right)\right)}\right)\right)}
\] |
rational_best-simplify-43 [=>]38.5 | \[ \frac{2}{\frac{{t}^{3}}{\ell \cdot \ell} \cdot \left(\sin k \cdot \left(\tan k \cdot \color{blue}{\left({\left(\frac{k}{t}\right)}^{2} + \left(1 + -1\right)\right)}\right)\right)}
\] |
metadata-eval [=>]38.5 | \[ \frac{2}{\frac{{t}^{3}}{\ell \cdot \ell} \cdot \left(\sin k \cdot \left(\tan k \cdot \left({\left(\frac{k}{t}\right)}^{2} + \color{blue}{0}\right)\right)\right)}
\] |
rational_best-simplify-3 [=>]38.5 | \[ \frac{2}{\frac{{t}^{3}}{\ell \cdot \ell} \cdot \left(\sin k \cdot \left(\tan k \cdot \color{blue}{{\left(\frac{k}{t}\right)}^{2}}\right)\right)}
\] |
Applied egg-rr38.1
Simplified38.1
[Start]38.1 | \[ \frac{2}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot \frac{{\left(\frac{k}{t}\right)}^{2}}{\ell \cdot \ell}\right)\right) + 0}
\] |
|---|---|
rational_best-simplify-3 [=>]38.1 | \[ \frac{2}{\color{blue}{{t}^{3} \cdot \left(\sin k \cdot \left(\tan k \cdot \frac{{\left(\frac{k}{t}\right)}^{2}}{\ell \cdot \ell}\right)\right)}}
\] |
rational_best-simplify-44 [=>]38.1 | \[ \frac{2}{\color{blue}{\sin k \cdot \left({t}^{3} \cdot \left(\tan k \cdot \frac{{\left(\frac{k}{t}\right)}^{2}}{\ell \cdot \ell}\right)\right)}}
\] |
Taylor expanded in t around 0 20.6
Simplified20.4
[Start]20.6 | \[ \frac{2}{\sin k \cdot \frac{{k}^{2} \cdot \left(\sin k \cdot t\right)}{\cos k \cdot {\ell}^{2}}}
\] |
|---|---|
rational_best-simplify-47 [=>]20.4 | \[ \frac{2}{\sin k \cdot \color{blue}{\left(\left(\sin k \cdot t\right) \cdot \frac{{k}^{2}}{\cos k \cdot {\ell}^{2}}\right)}}
\] |
Final simplification22.1
| Alternative 1 | |
|---|---|
| Error | 21.9 |
| Cost | 32960 |
| Alternative 2 | |
|---|---|
| Error | 22.5 |
| Cost | 32896 |
| Alternative 3 | |
|---|---|
| Error | 22.0 |
| Cost | 26696 |
| Alternative 4 | |
|---|---|
| Error | 21.9 |
| Cost | 26696 |
| Alternative 5 | |
|---|---|
| Error | 22.0 |
| Cost | 26696 |
| Alternative 6 | |
|---|---|
| Error | 21.8 |
| Cost | 26696 |
| Alternative 7 | |
|---|---|
| Error | 29.3 |
| Cost | 19968 |
| Alternative 8 | |
|---|---|
| Error | 30.4 |
| Cost | 19904 |
| Alternative 9 | |
|---|---|
| Error | 30.3 |
| Cost | 19904 |
| Alternative 10 | |
|---|---|
| Error | 31.1 |
| Cost | 13376 |
| Alternative 11 | |
|---|---|
| Error | 31.1 |
| Cost | 13376 |
herbie shell --seed 2023096
(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))))