(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 (* (cos k) (/ l (* k (/ k l)))))
(t_2 (pow (sin k) 2.0))
(t_3 (/ 1.0 (* t_2 t)))
(t_4 (* 2.0 (* (* (cos k) (/ (* (/ l k) l) k)) t_3))))
(if (<= l -1e+199)
(* 2.0 (/ t_3 (/ 1.0 t_1)))
(if (<= l -6.728547701870032e-158)
t_4
(if (<= l 1.2884415081700598e-132)
(* 2.0 (/ (/ t_1 t_2) t))
(if (<= l 1e-22)
(/ (/ 2.0 (tan k)) (/ (* t (* (* k k) (sin k))) (* l l)))
t_4))))))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 = cos(k) * (l / (k * (k / l)));
double t_2 = pow(sin(k), 2.0);
double t_3 = 1.0 / (t_2 * t);
double t_4 = 2.0 * ((cos(k) * (((l / k) * l) / k)) * t_3);
double tmp;
if (l <= -1e+199) {
tmp = 2.0 * (t_3 / (1.0 / t_1));
} else if (l <= -6.728547701870032e-158) {
tmp = t_4;
} else if (l <= 1.2884415081700598e-132) {
tmp = 2.0 * ((t_1 / t_2) / t);
} else if (l <= 1e-22) {
tmp = (2.0 / tan(k)) / ((t * ((k * k) * sin(k))) / (l * l));
} else {
tmp = t_4;
}
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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = cos(k) * (l / (k * (k / l)))
t_2 = sin(k) ** 2.0d0
t_3 = 1.0d0 / (t_2 * t)
t_4 = 2.0d0 * ((cos(k) * (((l / k) * l) / k)) * t_3)
if (l <= (-1d+199)) then
tmp = 2.0d0 * (t_3 / (1.0d0 / t_1))
else if (l <= (-6.728547701870032d-158)) then
tmp = t_4
else if (l <= 1.2884415081700598d-132) then
tmp = 2.0d0 * ((t_1 / t_2) / t)
else if (l <= 1d-22) then
tmp = (2.0d0 / tan(k)) / ((t * ((k * k) * sin(k))) / (l * l))
else
tmp = t_4
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 = Math.cos(k) * (l / (k * (k / l)));
double t_2 = Math.pow(Math.sin(k), 2.0);
double t_3 = 1.0 / (t_2 * t);
double t_4 = 2.0 * ((Math.cos(k) * (((l / k) * l) / k)) * t_3);
double tmp;
if (l <= -1e+199) {
tmp = 2.0 * (t_3 / (1.0 / t_1));
} else if (l <= -6.728547701870032e-158) {
tmp = t_4;
} else if (l <= 1.2884415081700598e-132) {
tmp = 2.0 * ((t_1 / t_2) / t);
} else if (l <= 1e-22) {
tmp = (2.0 / Math.tan(k)) / ((t * ((k * k) * Math.sin(k))) / (l * l));
} else {
tmp = t_4;
}
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 = math.cos(k) * (l / (k * (k / l))) t_2 = math.pow(math.sin(k), 2.0) t_3 = 1.0 / (t_2 * t) t_4 = 2.0 * ((math.cos(k) * (((l / k) * l) / k)) * t_3) tmp = 0 if l <= -1e+199: tmp = 2.0 * (t_3 / (1.0 / t_1)) elif l <= -6.728547701870032e-158: tmp = t_4 elif l <= 1.2884415081700598e-132: tmp = 2.0 * ((t_1 / t_2) / t) elif l <= 1e-22: tmp = (2.0 / math.tan(k)) / ((t * ((k * k) * math.sin(k))) / (l * l)) else: tmp = t_4 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(cos(k) * Float64(l / Float64(k * Float64(k / l)))) t_2 = sin(k) ^ 2.0 t_3 = Float64(1.0 / Float64(t_2 * t)) t_4 = Float64(2.0 * Float64(Float64(cos(k) * Float64(Float64(Float64(l / k) * l) / k)) * t_3)) tmp = 0.0 if (l <= -1e+199) tmp = Float64(2.0 * Float64(t_3 / Float64(1.0 / t_1))); elseif (l <= -6.728547701870032e-158) tmp = t_4; elseif (l <= 1.2884415081700598e-132) tmp = Float64(2.0 * Float64(Float64(t_1 / t_2) / t)); elseif (l <= 1e-22) tmp = Float64(Float64(2.0 / tan(k)) / Float64(Float64(t * Float64(Float64(k * k) * sin(k))) / Float64(l * l))); else tmp = t_4; 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 = cos(k) * (l / (k * (k / l))); t_2 = sin(k) ^ 2.0; t_3 = 1.0 / (t_2 * t); t_4 = 2.0 * ((cos(k) * (((l / k) * l) / k)) * t_3); tmp = 0.0; if (l <= -1e+199) tmp = 2.0 * (t_3 / (1.0 / t_1)); elseif (l <= -6.728547701870032e-158) tmp = t_4; elseif (l <= 1.2884415081700598e-132) tmp = 2.0 * ((t_1 / t_2) / t); elseif (l <= 1e-22) tmp = (2.0 / tan(k)) / ((t * ((k * k) * sin(k))) / (l * l)); else tmp = t_4; 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[(N[Cos[k], $MachinePrecision] * N[(l / N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(1.0 / N[(t$95$2 * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(2.0 * N[(N[(N[Cos[k], $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] * l), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e+199], N[(2.0 * N[(t$95$3 / N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6.728547701870032e-158], t$95$4, If[LessEqual[l, 1.2884415081700598e-132], N[(2.0 * N[(N[(t$95$1 / t$95$2), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1e-22], N[(N[(2.0 / N[Tan[k], $MachinePrecision]), $MachinePrecision] / N[(N[(t * N[(N[(k * k), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]]]
\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 := \cos k \cdot \frac{\ell}{k \cdot \frac{k}{\ell}}\\
t_2 := {\sin k}^{2}\\
t_3 := \frac{1}{t_2 \cdot t}\\
t_4 := 2 \cdot \left(\left(\cos k \cdot \frac{\frac{\ell}{k} \cdot \ell}{k}\right) \cdot t_3\right)\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+199}:\\
\;\;\;\;2 \cdot \frac{t_3}{\frac{1}{t_1}}\\
\mathbf{elif}\;\ell \leq -6.728547701870032 \cdot 10^{-158}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;\ell \leq 1.2884415081700598 \cdot 10^{-132}:\\
\;\;\;\;2 \cdot \frac{\frac{t_1}{t_2}}{t}\\
\mathbf{elif}\;\ell \leq 10^{-22}:\\
\;\;\;\;\frac{\frac{2}{\tan k}}{\frac{t \cdot \left(\left(k \cdot k\right) \cdot \sin k\right)}{\ell \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
Results
if l < -1.0000000000000001e199Initial program 64.0
Simplified64.0
Taylor expanded in k around inf 64.0
Applied egg-rr64.0
Taylor expanded in l around 0 64.0
Simplified50.9
Applied egg-rr15.8
if -1.0000000000000001e199 < l < -6.72854770187003164e-158 or 1e-22 < l Initial program 48.3
Simplified41.6
Taylor expanded in k around inf 24.4
Applied egg-rr23.0
Taylor expanded in l around 0 22.9
Simplified18.4
Applied egg-rr9.0
if -6.72854770187003164e-158 < l < 1.2884415081700598e-132Initial program 45.9
Simplified37.0
Taylor expanded in k around inf 18.8
Applied egg-rr18.8
Taylor expanded in l around 0 18.8
Simplified13.3
Applied egg-rr10.7
if 1.2884415081700598e-132 < l < 1e-22Initial program 42.5
Simplified31.3
Taylor expanded in k around inf 4.3
Simplified6.9
Final simplification9.7
herbie shell --seed 2022203
(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))))