(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 2.0) (/ k (cos k))))
(t_3 (* (* l (/ t_2 (* k t_1))) (/ 1.0 t))))
(if (<= k -1e+170)
t_3
(if (<= k 1e+60)
(/
(/ (* (* l 2.0) (/ (cos k) k)) k)
(* (/ (sin k) l) (/ (sin k) (pow t -1.0))))
(if (<= k 3.570485739764951e+189)
t_3
(* (/ t_2 (/ t_1 l)) (/ (/ 1.0 k) t)))))))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 * 2.0) / (k / cos(k));
double t_3 = (l * (t_2 / (k * t_1))) * (1.0 / t);
double tmp;
if (k <= -1e+170) {
tmp = t_3;
} else if (k <= 1e+60) {
tmp = (((l * 2.0) * (cos(k) / k)) / k) / ((sin(k) / l) * (sin(k) / pow(t, -1.0)));
} else if (k <= 3.570485739764951e+189) {
tmp = t_3;
} else {
tmp = (t_2 / (t_1 / l)) * ((1.0 / k) / t);
}
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 * 2.0d0) / (k / cos(k))
t_3 = (l * (t_2 / (k * t_1))) * (1.0d0 / t)
if (k <= (-1d+170)) then
tmp = t_3
else if (k <= 1d+60) then
tmp = (((l * 2.0d0) * (cos(k) / k)) / k) / ((sin(k) / l) * (sin(k) / (t ** (-1.0d0))))
else if (k <= 3.570485739764951d+189) then
tmp = t_3
else
tmp = (t_2 / (t_1 / l)) * ((1.0d0 / k) / t)
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 * 2.0) / (k / Math.cos(k));
double t_3 = (l * (t_2 / (k * t_1))) * (1.0 / t);
double tmp;
if (k <= -1e+170) {
tmp = t_3;
} else if (k <= 1e+60) {
tmp = (((l * 2.0) * (Math.cos(k) / k)) / k) / ((Math.sin(k) / l) * (Math.sin(k) / Math.pow(t, -1.0)));
} else if (k <= 3.570485739764951e+189) {
tmp = t_3;
} else {
tmp = (t_2 / (t_1 / l)) * ((1.0 / k) / t);
}
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 * 2.0) / (k / math.cos(k)) t_3 = (l * (t_2 / (k * t_1))) * (1.0 / t) tmp = 0 if k <= -1e+170: tmp = t_3 elif k <= 1e+60: tmp = (((l * 2.0) * (math.cos(k) / k)) / k) / ((math.sin(k) / l) * (math.sin(k) / math.pow(t, -1.0))) elif k <= 3.570485739764951e+189: tmp = t_3 else: tmp = (t_2 / (t_1 / l)) * ((1.0 / k) / t) 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 * 2.0) / Float64(k / cos(k))) t_3 = Float64(Float64(l * Float64(t_2 / Float64(k * t_1))) * Float64(1.0 / t)) tmp = 0.0 if (k <= -1e+170) tmp = t_3; elseif (k <= 1e+60) tmp = Float64(Float64(Float64(Float64(l * 2.0) * Float64(cos(k) / k)) / k) / Float64(Float64(sin(k) / l) * Float64(sin(k) / (t ^ -1.0)))); elseif (k <= 3.570485739764951e+189) tmp = t_3; else tmp = Float64(Float64(t_2 / Float64(t_1 / l)) * Float64(Float64(1.0 / k) / t)); 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 * 2.0) / (k / cos(k)); t_3 = (l * (t_2 / (k * t_1))) * (1.0 / t); tmp = 0.0; if (k <= -1e+170) tmp = t_3; elseif (k <= 1e+60) tmp = (((l * 2.0) * (cos(k) / k)) / k) / ((sin(k) / l) * (sin(k) / (t ^ -1.0))); elseif (k <= 3.570485739764951e+189) tmp = t_3; else tmp = (t_2 / (t_1 / l)) * ((1.0 / k) / t); 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 * 2.0), $MachinePrecision] / N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(l * N[(t$95$2 / N[(k * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, -1e+170], t$95$3, If[LessEqual[k, 1e+60], N[(N[(N[(N[(l * 2.0), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] / N[(N[(N[Sin[k], $MachinePrecision] / l), $MachinePrecision] * N[(N[Sin[k], $MachinePrecision] / N[Power[t, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 3.570485739764951e+189], t$95$3, N[(N[(t$95$2 / N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / k), $MachinePrecision] / t), $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{\ell \cdot 2}{\frac{k}{\cos k}}\\
t_3 := \left(\ell \cdot \frac{t_2}{k \cdot t_1}\right) \cdot \frac{1}{t}\\
\mathbf{if}\;k \leq -1 \cdot 10^{+170}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;k \leq 10^{+60}:\\
\;\;\;\;\frac{\frac{\left(\ell \cdot 2\right) \cdot \frac{\cos k}{k}}{k}}{\frac{\sin k}{\ell} \cdot \frac{\sin k}{{t}^{-1}}}\\
\mathbf{elif}\;k \leq 3.570485739764951 \cdot 10^{+189}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{t_2}{\frac{t_1}{\ell}} \cdot \frac{\frac{1}{k}}{t}\\
\end{array}
Results
if k < -1.00000000000000003e170 or 9.9999999999999995e59 < k < 3.57048573976495117e189Initial program 42.2
Simplified34.6
Taylor expanded in t around 0 21.4
Simplified21.6
Applied egg-rr17.1
Applied egg-rr10.3
Applied egg-rr7.8
if -1.00000000000000003e170 < k < 9.9999999999999995e59Initial program 55.0
Simplified46.1
Taylor expanded in t around 0 23.6
Simplified22.1
Applied egg-rr8.6
Applied egg-rr7.7
Applied egg-rr2.7
if 3.57048573976495117e189 < k Initial program 37.2
Simplified32.7
Taylor expanded in t around 0 22.1
Simplified22.2
Applied egg-rr20.4
Applied egg-rr13.4
Applied egg-rr6.0
Final simplification5.0
herbie shell --seed 2022185
(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))))