(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 (* (/ k l) (pow (sin k) 2.0))) (t_2 (* t t_1)))
(if (<= t -4.61396164152947e+63)
(/ (* (cos k) (/ 2.0 k)) (/ 1.0 (/ l t_2)))
(if (<= t 1e-90)
(* l (/ (/ (cos k) (* k 0.5)) t_2))
(* (/ (cos k) t_1) (/ (/ 2.0 k) (/ t l)))))))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 = (k / l) * pow(sin(k), 2.0);
double t_2 = t * t_1;
double tmp;
if (t <= -4.61396164152947e+63) {
tmp = (cos(k) * (2.0 / k)) / (1.0 / (l / t_2));
} else if (t <= 1e-90) {
tmp = l * ((cos(k) / (k * 0.5)) / t_2);
} else {
tmp = (cos(k) / t_1) * ((2.0 / k) / (t / l));
}
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) :: tmp
t_1 = (k / l) * (sin(k) ** 2.0d0)
t_2 = t * t_1
if (t <= (-4.61396164152947d+63)) then
tmp = (cos(k) * (2.0d0 / k)) / (1.0d0 / (l / t_2))
else if (t <= 1d-90) then
tmp = l * ((cos(k) / (k * 0.5d0)) / t_2)
else
tmp = (cos(k) / t_1) * ((2.0d0 / k) / (t / l))
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 = (k / l) * Math.pow(Math.sin(k), 2.0);
double t_2 = t * t_1;
double tmp;
if (t <= -4.61396164152947e+63) {
tmp = (Math.cos(k) * (2.0 / k)) / (1.0 / (l / t_2));
} else if (t <= 1e-90) {
tmp = l * ((Math.cos(k) / (k * 0.5)) / t_2);
} else {
tmp = (Math.cos(k) / t_1) * ((2.0 / k) / (t / l));
}
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 = (k / l) * math.pow(math.sin(k), 2.0) t_2 = t * t_1 tmp = 0 if t <= -4.61396164152947e+63: tmp = (math.cos(k) * (2.0 / k)) / (1.0 / (l / t_2)) elif t <= 1e-90: tmp = l * ((math.cos(k) / (k * 0.5)) / t_2) else: tmp = (math.cos(k) / t_1) * ((2.0 / k) / (t / l)) 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(Float64(k / l) * (sin(k) ^ 2.0)) t_2 = Float64(t * t_1) tmp = 0.0 if (t <= -4.61396164152947e+63) tmp = Float64(Float64(cos(k) * Float64(2.0 / k)) / Float64(1.0 / Float64(l / t_2))); elseif (t <= 1e-90) tmp = Float64(l * Float64(Float64(cos(k) / Float64(k * 0.5)) / t_2)); else tmp = Float64(Float64(cos(k) / t_1) * Float64(Float64(2.0 / k) / Float64(t / l))); 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 = (k / l) * (sin(k) ^ 2.0); t_2 = t * t_1; tmp = 0.0; if (t <= -4.61396164152947e+63) tmp = (cos(k) * (2.0 / k)) / (1.0 / (l / t_2)); elseif (t <= 1e-90) tmp = l * ((cos(k) / (k * 0.5)) / t_2); else tmp = (cos(k) / t_1) * ((2.0 / k) / (t / l)); 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[(k / l), $MachinePrecision] * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * t$95$1), $MachinePrecision]}, If[LessEqual[t, -4.61396164152947e+63], N[(N[(N[Cos[k], $MachinePrecision] * N[(2.0 / k), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(l / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-90], N[(l * N[(N[(N[Cos[k], $MachinePrecision] / N[(k * 0.5), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[k], $MachinePrecision] / t$95$1), $MachinePrecision] * N[(N[(2.0 / k), $MachinePrecision] / N[(t / l), $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{k}{\ell} \cdot {\sin k}^{2}\\
t_2 := t \cdot t_1\\
\mathbf{if}\;t \leq -4.61396164152947 \cdot 10^{+63}:\\
\;\;\;\;\frac{\cos k \cdot \frac{2}{k}}{\frac{1}{\frac{\ell}{t_2}}}\\
\mathbf{elif}\;t \leq 10^{-90}:\\
\;\;\;\;\ell \cdot \frac{\frac{\cos k}{k \cdot 0.5}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos k}{t_1} \cdot \frac{\frac{2}{k}}{\frac{t}{\ell}}\\
\end{array}
Results
if t < -4.61396164152947014e63Initial program 49.6
Simplified36.7
Taylor expanded in t around 0 22.3
Simplified19.5
Applied egg-rr12.6
Taylor expanded in k around inf 19.5
Simplified9.0
Applied egg-rr7.4
if -4.61396164152947014e63 < t < 9.99999999999999995e-91Initial program 51.6
Simplified49.5
Taylor expanded in t around 0 23.7
Simplified25.1
Applied egg-rr17.2
Taylor expanded in k around inf 17.2
Simplified9.3
Applied egg-rr5.1
if 9.99999999999999995e-91 < t Initial program 40.5
Simplified28.9
Taylor expanded in t around 0 20.6
Simplified18.6
Applied egg-rr12.3
Taylor expanded in k around inf 17.3
Simplified5.8
Applied egg-rr4.5
Final simplification5.5
herbie shell --seed 2022211
(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))))