(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 (pow (sin k) 2.0)) (t_2 (/ (/ l k) k)) (t_3 (* 2.0 (cos k))))
(if (<= (* l l) 1e-199)
(* (* 2.0 t_2) (/ (cos k) (* t_1 (/ t l))))
(if (<= (* l l) 2e+263)
(/ (/ (* (* l l) t_3) k) (* k (* t_1 t)))
(* (/ l t) (/ (* t_2 t_3) t_1))))))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 = pow(sin(k), 2.0);
double t_2 = (l / k) / k;
double t_3 = 2.0 * cos(k);
double tmp;
if ((l * l) <= 1e-199) {
tmp = (2.0 * t_2) * (cos(k) / (t_1 * (t / l)));
} else if ((l * l) <= 2e+263) {
tmp = (((l * l) * t_3) / k) / (k * (t_1 * t));
} else {
tmp = (l / t) * ((t_2 * t_3) / t_1);
}
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) :: tmp
t_1 = sin(k) ** 2.0d0
t_2 = (l / k) / k
t_3 = 2.0d0 * cos(k)
if ((l * l) <= 1d-199) then
tmp = (2.0d0 * t_2) * (cos(k) / (t_1 * (t / l)))
else if ((l * l) <= 2d+263) then
tmp = (((l * l) * t_3) / k) / (k * (t_1 * t))
else
tmp = (l / t) * ((t_2 * t_3) / t_1)
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.pow(Math.sin(k), 2.0);
double t_2 = (l / k) / k;
double t_3 = 2.0 * Math.cos(k);
double tmp;
if ((l * l) <= 1e-199) {
tmp = (2.0 * t_2) * (Math.cos(k) / (t_1 * (t / l)));
} else if ((l * l) <= 2e+263) {
tmp = (((l * l) * t_3) / k) / (k * (t_1 * t));
} else {
tmp = (l / t) * ((t_2 * t_3) / t_1);
}
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.pow(math.sin(k), 2.0) t_2 = (l / k) / k t_3 = 2.0 * math.cos(k) tmp = 0 if (l * l) <= 1e-199: tmp = (2.0 * t_2) * (math.cos(k) / (t_1 * (t / l))) elif (l * l) <= 2e+263: tmp = (((l * l) * t_3) / k) / (k * (t_1 * t)) else: tmp = (l / t) * ((t_2 * t_3) / t_1) 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 = sin(k) ^ 2.0 t_2 = Float64(Float64(l / k) / k) t_3 = Float64(2.0 * cos(k)) tmp = 0.0 if (Float64(l * l) <= 1e-199) tmp = Float64(Float64(2.0 * t_2) * Float64(cos(k) / Float64(t_1 * Float64(t / l)))); elseif (Float64(l * l) <= 2e+263) tmp = Float64(Float64(Float64(Float64(l * l) * t_3) / k) / Float64(k * Float64(t_1 * t))); else tmp = Float64(Float64(l / t) * Float64(Float64(t_2 * t_3) / t_1)); 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 = sin(k) ^ 2.0; t_2 = (l / k) / k; t_3 = 2.0 * cos(k); tmp = 0.0; if ((l * l) <= 1e-199) tmp = (2.0 * t_2) * (cos(k) / (t_1 * (t / l))); elseif ((l * l) <= 2e+263) tmp = (((l * l) * t_3) / k) / (k * (t_1 * t)); else tmp = (l / t) * ((t_2 * t_3) / t_1); 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[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[Cos[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(l * l), $MachinePrecision], 1e-199], N[(N[(2.0 * t$95$2), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(t$95$1 * N[(t / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(l * l), $MachinePrecision], 2e+263], N[(N[(N[(N[(l * l), $MachinePrecision] * t$95$3), $MachinePrecision] / k), $MachinePrecision] / N[(k * N[(t$95$1 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l / t), $MachinePrecision] * N[(N[(t$95$2 * t$95$3), $MachinePrecision] / t$95$1), $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 := {\sin k}^{2}\\
t_2 := \frac{\frac{\ell}{k}}{k}\\
t_3 := 2 \cdot \cos k\\
\mathbf{if}\;\ell \cdot \ell \leq 10^{-199}:\\
\;\;\;\;\left(2 \cdot t_2\right) \cdot \frac{\cos k}{t_1 \cdot \frac{t}{\ell}}\\
\mathbf{elif}\;\ell \cdot \ell \leq 2 \cdot 10^{+263}:\\
\;\;\;\;\frac{\frac{\left(\ell \cdot \ell\right) \cdot t_3}{k}}{k \cdot \left(t_1 \cdot t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{t} \cdot \frac{t_2 \cdot t_3}{t_1}\\
\end{array}
Results
if (*.f64 l l) < 9.99999999999999982e-200Initial program 44.8
Simplified35.7
Taylor expanded in t around 0 16.2
Simplified15.5
Applied egg-rr7.4
Taylor expanded in k around inf 7.2
Simplified7.2
Applied egg-rr7.3
if 9.99999999999999982e-200 < (*.f64 l l) < 2.00000000000000003e263Initial program 42.5
Simplified33.3
Taylor expanded in t around 0 11.9
Simplified11.2
Taylor expanded in k around inf 11.9
Simplified2.0
if 2.00000000000000003e263 < (*.f64 l l) Initial program 62.3
Simplified61.4
Taylor expanded in t around 0 58.7
Simplified59.1
Applied egg-rr35.4
Taylor expanded in k around inf 35.4
Simplified35.4
Applied egg-rr17.8
Final simplification7.3
herbie shell --seed 2022212
(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))))