
(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))))
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));
}
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
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\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)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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))))
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));
}
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
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));
}
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))
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 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
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]
\begin{array}{l}
\\
\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)}
\end{array}
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (sin k) 2.0)))
(if (<= k 1.6e-67)
(/ 2.0 (/ (pow (* (sin k) (/ k l)) 2.0) (/ (cos k) t)))
(if (<= k 4e+101)
(/ 2.0 (/ (/ (* (/ (pow k 2.0) l) (* t t_1)) (cos k)) l))
(/ 2.0 (* t_1 (* (pow (/ k l) 2.0) (/ t (cos k)))))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = pow(sin(k), 2.0);
double tmp;
if (k <= 1.6e-67) {
tmp = 2.0 / (pow((sin(k) * (k / l)), 2.0) / (cos(k) / t));
} else if (k <= 4e+101) {
tmp = 2.0 / ((((pow(k, 2.0) / l) * (t * t_1)) / cos(k)) / l);
} else {
tmp = 2.0 / (t_1 * (pow((k / l), 2.0) * (t / cos(k))));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
t_1 = sin(k) ** 2.0d0
if (k <= 1.6d-67) then
tmp = 2.0d0 / (((sin(k) * (k / l)) ** 2.0d0) / (cos(k) / t))
else if (k <= 4d+101) then
tmp = 2.0d0 / (((((k ** 2.0d0) / l) * (t * t_1)) / cos(k)) / l)
else
tmp = 2.0d0 / (t_1 * (((k / l) ** 2.0d0) * (t / cos(k))))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = Math.pow(Math.sin(k), 2.0);
double tmp;
if (k <= 1.6e-67) {
tmp = 2.0 / (Math.pow((Math.sin(k) * (k / l)), 2.0) / (Math.cos(k) / t));
} else if (k <= 4e+101) {
tmp = 2.0 / ((((Math.pow(k, 2.0) / l) * (t * t_1)) / Math.cos(k)) / l);
} else {
tmp = 2.0 / (t_1 * (Math.pow((k / l), 2.0) * (t / Math.cos(k))));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = math.pow(math.sin(k), 2.0) tmp = 0 if k <= 1.6e-67: tmp = 2.0 / (math.pow((math.sin(k) * (k / l)), 2.0) / (math.cos(k) / t)) elif k <= 4e+101: tmp = 2.0 / ((((math.pow(k, 2.0) / l) * (t * t_1)) / math.cos(k)) / l) else: tmp = 2.0 / (t_1 * (math.pow((k / l), 2.0) * (t / math.cos(k)))) return tmp
k = abs(k) function code(t, l, k) t_1 = sin(k) ^ 2.0 tmp = 0.0 if (k <= 1.6e-67) tmp = Float64(2.0 / Float64((Float64(sin(k) * Float64(k / l)) ^ 2.0) / Float64(cos(k) / t))); elseif (k <= 4e+101) tmp = Float64(2.0 / Float64(Float64(Float64(Float64((k ^ 2.0) / l) * Float64(t * t_1)) / cos(k)) / l)); else tmp = Float64(2.0 / Float64(t_1 * Float64((Float64(k / l) ^ 2.0) * Float64(t / cos(k))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = sin(k) ^ 2.0; tmp = 0.0; if (k <= 1.6e-67) tmp = 2.0 / (((sin(k) * (k / l)) ^ 2.0) / (cos(k) / t)); elseif (k <= 4e+101) tmp = 2.0 / (((((k ^ 2.0) / l) * (t * t_1)) / cos(k)) / l); else tmp = 2.0 / (t_1 * (((k / l) ^ 2.0) * (t / cos(k)))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[k, 1.6e-67], N[(2.0 / N[(N[Power[N[(N[Sin[k], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 4e+101], N[(2.0 / N[(N[(N[(N[(N[Power[k, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(t * t$95$1), $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$1 * N[(N[Power[N[(k / l), $MachinePrecision], 2.0], $MachinePrecision] * N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
\mathbf{if}\;k \leq 1.6 \cdot 10^{-67}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k \cdot \frac{k}{\ell}\right)}^{2}}{\frac{\cos k}{t}}}\\
\mathbf{elif}\;k \leq 4 \cdot 10^{+101}:\\
\;\;\;\;\frac{2}{\frac{\frac{\frac{{k}^{2}}{\ell} \cdot \left(t \cdot t_1\right)}{\cos k}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t_1 \cdot \left({\left(\frac{k}{\ell}\right)}^{2} \cdot \frac{t}{\cos k}\right)}\\
\end{array}
\end{array}
if k < 1.60000000000000011e-67Initial program 43.6%
Simplified50.0%
Taylor expanded in t around 0 75.7%
associate-/l*77.4%
Simplified77.4%
expm1-log1p-u59.0%
expm1-udef29.3%
Applied egg-rr32.4%
expm1-def35.8%
expm1-log1p36.1%
associate-/r/36.1%
Simplified36.1%
*-commutative36.1%
unpow-prod-down36.0%
associate-/r/37.1%
unpow-prod-down33.7%
pow233.7%
add-sqr-sqrt89.1%
Applied egg-rr89.1%
associate-*r*89.7%
Simplified89.7%
clear-num89.7%
un-div-inv89.6%
pow-prod-down93.6%
Applied egg-rr93.6%
if 1.60000000000000011e-67 < k < 3.9999999999999999e101Initial program 31.8%
Simplified39.1%
associate-*l*39.0%
+-rgt-identity39.0%
*-commutative39.0%
associate-*r*39.0%
*-commutative39.0%
associate-/r*39.1%
associate-*l/39.1%
Applied egg-rr39.1%
Taylor expanded in t around 0 92.6%
times-frac99.7%
associate-*r/99.7%
Simplified99.7%
if 3.9999999999999999e101 < k Initial program 28.9%
Simplified43.2%
Taylor expanded in t around 0 70.2%
associate-/l*72.0%
Simplified72.0%
expm1-log1p-u38.9%
expm1-udef36.8%
Applied egg-rr44.3%
expm1-def48.1%
expm1-log1p48.8%
associate-/r/48.8%
Simplified48.8%
*-commutative48.8%
unpow-prod-down48.9%
associate-/r/48.9%
unpow-prod-down48.8%
pow248.8%
add-sqr-sqrt95.8%
Applied egg-rr95.8%
Final simplification95.0%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (pow (sin k) 2.0)))
(if (<= k 9e-37)
(/ 2.0 (/ (pow (* (sin k) (/ k l)) 2.0) (/ (cos k) t)))
(if (<= k 2.6e+109)
(/ 2.0 (* (/ (* t (/ (pow k 2.0) l)) l) (/ t_1 (cos k))))
(/ 2.0 (* t_1 (* (pow (/ k l) 2.0) (/ t (cos k)))))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = pow(sin(k), 2.0);
double tmp;
if (k <= 9e-37) {
tmp = 2.0 / (pow((sin(k) * (k / l)), 2.0) / (cos(k) / t));
} else if (k <= 2.6e+109) {
tmp = 2.0 / (((t * (pow(k, 2.0) / l)) / l) * (t_1 / cos(k)));
} else {
tmp = 2.0 / (t_1 * (pow((k / l), 2.0) * (t / cos(k))));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
t_1 = sin(k) ** 2.0d0
if (k <= 9d-37) then
tmp = 2.0d0 / (((sin(k) * (k / l)) ** 2.0d0) / (cos(k) / t))
else if (k <= 2.6d+109) then
tmp = 2.0d0 / (((t * ((k ** 2.0d0) / l)) / l) * (t_1 / cos(k)))
else
tmp = 2.0d0 / (t_1 * (((k / l) ** 2.0d0) * (t / cos(k))))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = Math.pow(Math.sin(k), 2.0);
double tmp;
if (k <= 9e-37) {
tmp = 2.0 / (Math.pow((Math.sin(k) * (k / l)), 2.0) / (Math.cos(k) / t));
} else if (k <= 2.6e+109) {
tmp = 2.0 / (((t * (Math.pow(k, 2.0) / l)) / l) * (t_1 / Math.cos(k)));
} else {
tmp = 2.0 / (t_1 * (Math.pow((k / l), 2.0) * (t / Math.cos(k))));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = math.pow(math.sin(k), 2.0) tmp = 0 if k <= 9e-37: tmp = 2.0 / (math.pow((math.sin(k) * (k / l)), 2.0) / (math.cos(k) / t)) elif k <= 2.6e+109: tmp = 2.0 / (((t * (math.pow(k, 2.0) / l)) / l) * (t_1 / math.cos(k))) else: tmp = 2.0 / (t_1 * (math.pow((k / l), 2.0) * (t / math.cos(k)))) return tmp
k = abs(k) function code(t, l, k) t_1 = sin(k) ^ 2.0 tmp = 0.0 if (k <= 9e-37) tmp = Float64(2.0 / Float64((Float64(sin(k) * Float64(k / l)) ^ 2.0) / Float64(cos(k) / t))); elseif (k <= 2.6e+109) tmp = Float64(2.0 / Float64(Float64(Float64(t * Float64((k ^ 2.0) / l)) / l) * Float64(t_1 / cos(k)))); else tmp = Float64(2.0 / Float64(t_1 * Float64((Float64(k / l) ^ 2.0) * Float64(t / cos(k))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = sin(k) ^ 2.0; tmp = 0.0; if (k <= 9e-37) tmp = 2.0 / (((sin(k) * (k / l)) ^ 2.0) / (cos(k) / t)); elseif (k <= 2.6e+109) tmp = 2.0 / (((t * ((k ^ 2.0) / l)) / l) * (t_1 / cos(k))); else tmp = 2.0 / (t_1 * (((k / l) ^ 2.0) * (t / cos(k)))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[k, 9e-37], N[(2.0 / N[(N[Power[N[(N[Sin[k], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Cos[k], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.6e+109], N[(2.0 / N[(N[(N[(t * N[(N[Power[k, 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(t$95$1 / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$1 * N[(N[Power[N[(k / l), $MachinePrecision], 2.0], $MachinePrecision] * N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := {\sin k}^{2}\\
\mathbf{if}\;k \leq 9 \cdot 10^{-37}:\\
\;\;\;\;\frac{2}{\frac{{\left(\sin k \cdot \frac{k}{\ell}\right)}^{2}}{\frac{\cos k}{t}}}\\
\mathbf{elif}\;k \leq 2.6 \cdot 10^{+109}:\\
\;\;\;\;\frac{2}{\frac{t \cdot \frac{{k}^{2}}{\ell}}{\ell} \cdot \frac{t_1}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t_1 \cdot \left({\left(\frac{k}{\ell}\right)}^{2} \cdot \frac{t}{\cos k}\right)}\\
\end{array}
\end{array}
if k < 9.00000000000000081e-37Initial program 43.7%
Simplified49.8%
Taylor expanded in t around 0 76.7%
associate-/l*78.2%
Simplified78.2%
expm1-log1p-u59.8%
expm1-udef30.3%
Applied egg-rr33.2%
expm1-def36.3%
expm1-log1p36.7%
associate-/r/36.7%
Simplified36.7%
*-commutative36.7%
unpow-prod-down36.5%
associate-/r/37.6%
unpow-prod-down34.4%
pow234.4%
add-sqr-sqrt89.2%
Applied egg-rr89.2%
associate-*r*89.7%
Simplified89.7%
clear-num89.7%
un-div-inv89.7%
pow-prod-down93.9%
Applied egg-rr93.9%
if 9.00000000000000081e-37 < k < 2.5999999999999998e109Initial program 25.1%
Simplified37.6%
associate-*l*37.5%
+-rgt-identity37.5%
*-commutative37.5%
associate-*r*37.5%
*-commutative37.5%
associate-/r*37.6%
associate-*l/37.6%
Applied egg-rr37.6%
Taylor expanded in t around 0 93.6%
times-frac99.7%
associate-*r/99.7%
Simplified99.7%
expm1-log1p-u77.6%
expm1-udef37.6%
associate-/l/37.6%
associate-*r*37.6%
Applied egg-rr37.6%
expm1-def77.5%
expm1-log1p99.7%
times-frac99.7%
*-commutative99.7%
Simplified99.7%
if 2.5999999999999998e109 < k Initial program 30.1%
Simplified42.9%
Taylor expanded in t around 0 69.0%
associate-/l*70.8%
Simplified70.8%
expm1-log1p-u38.5%
expm1-udef36.3%
Applied egg-rr44.2%
expm1-def48.2%
expm1-log1p48.8%
associate-/r/48.8%
Simplified48.8%
*-commutative48.8%
unpow-prod-down48.9%
associate-/r/48.8%
unpow-prod-down48.7%
pow248.7%
add-sqr-sqrt95.6%
Applied egg-rr95.6%
Final simplification95.0%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ t (cos k))))
(if (<= k 2.9e-5)
(/ 2.0 (* (pow (* (sin k) (/ k l)) 2.0) t_1))
(if (<= k 1.6e+109)
(/
2.0
(/
(* (* t (/ (pow k 2.0) l)) (- 0.5 (/ (cos (* k 2.0)) 2.0)))
(* l (cos k))))
(/ 2.0 (* (pow (sin k) 2.0) (* (pow (/ k l) 2.0) t_1)))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = t / cos(k);
double tmp;
if (k <= 2.9e-5) {
tmp = 2.0 / (pow((sin(k) * (k / l)), 2.0) * t_1);
} else if (k <= 1.6e+109) {
tmp = 2.0 / (((t * (pow(k, 2.0) / l)) * (0.5 - (cos((k * 2.0)) / 2.0))) / (l * cos(k)));
} else {
tmp = 2.0 / (pow(sin(k), 2.0) * (pow((k / l), 2.0) * t_1));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
t_1 = t / cos(k)
if (k <= 2.9d-5) then
tmp = 2.0d0 / (((sin(k) * (k / l)) ** 2.0d0) * t_1)
else if (k <= 1.6d+109) then
tmp = 2.0d0 / (((t * ((k ** 2.0d0) / l)) * (0.5d0 - (cos((k * 2.0d0)) / 2.0d0))) / (l * cos(k)))
else
tmp = 2.0d0 / ((sin(k) ** 2.0d0) * (((k / l) ** 2.0d0) * t_1))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = t / Math.cos(k);
double tmp;
if (k <= 2.9e-5) {
tmp = 2.0 / (Math.pow((Math.sin(k) * (k / l)), 2.0) * t_1);
} else if (k <= 1.6e+109) {
tmp = 2.0 / (((t * (Math.pow(k, 2.0) / l)) * (0.5 - (Math.cos((k * 2.0)) / 2.0))) / (l * Math.cos(k)));
} else {
tmp = 2.0 / (Math.pow(Math.sin(k), 2.0) * (Math.pow((k / l), 2.0) * t_1));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = t / math.cos(k) tmp = 0 if k <= 2.9e-5: tmp = 2.0 / (math.pow((math.sin(k) * (k / l)), 2.0) * t_1) elif k <= 1.6e+109: tmp = 2.0 / (((t * (math.pow(k, 2.0) / l)) * (0.5 - (math.cos((k * 2.0)) / 2.0))) / (l * math.cos(k))) else: tmp = 2.0 / (math.pow(math.sin(k), 2.0) * (math.pow((k / l), 2.0) * t_1)) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(t / cos(k)) tmp = 0.0 if (k <= 2.9e-5) tmp = Float64(2.0 / Float64((Float64(sin(k) * Float64(k / l)) ^ 2.0) * t_1)); elseif (k <= 1.6e+109) tmp = Float64(2.0 / Float64(Float64(Float64(t * Float64((k ^ 2.0) / l)) * Float64(0.5 - Float64(cos(Float64(k * 2.0)) / 2.0))) / Float64(l * cos(k)))); else tmp = Float64(2.0 / Float64((sin(k) ^ 2.0) * Float64((Float64(k / l) ^ 2.0) * t_1))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = t / cos(k); tmp = 0.0; if (k <= 2.9e-5) tmp = 2.0 / (((sin(k) * (k / l)) ^ 2.0) * t_1); elseif (k <= 1.6e+109) tmp = 2.0 / (((t * ((k ^ 2.0) / l)) * (0.5 - (cos((k * 2.0)) / 2.0))) / (l * cos(k))); else tmp = 2.0 / ((sin(k) ^ 2.0) * (((k / l) ^ 2.0) * t_1)); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2.9e-5], N[(2.0 / N[(N[Power[N[(N[Sin[k], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.6e+109], N[(2.0 / N[(N[(N[(t * N[(N[Power[k, 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(0.5 - N[(N[Cos[N[(k * 2.0), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(k / l), $MachinePrecision], 2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{t}{\cos k}\\
\mathbf{if}\;k \leq 2.9 \cdot 10^{-5}:\\
\;\;\;\;\frac{2}{{\left(\sin k \cdot \frac{k}{\ell}\right)}^{2} \cdot t_1}\\
\mathbf{elif}\;k \leq 1.6 \cdot 10^{+109}:\\
\;\;\;\;\frac{2}{\frac{\left(t \cdot \frac{{k}^{2}}{\ell}\right) \cdot \left(0.5 - \frac{\cos \left(k \cdot 2\right)}{2}\right)}{\ell \cdot \cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{{\sin k}^{2} \cdot \left({\left(\frac{k}{\ell}\right)}^{2} \cdot t_1\right)}\\
\end{array}
\end{array}
if k < 2.9e-5Initial program 43.4%
Simplified49.8%
Taylor expanded in t around 0 77.4%
associate-/l*78.9%
Simplified78.9%
expm1-log1p-u61.1%
expm1-udef29.9%
Applied egg-rr32.7%
expm1-def36.8%
expm1-log1p37.1%
associate-/r/37.1%
Simplified37.1%
*-commutative37.1%
unpow-prod-down37.0%
associate-/r/38.0%
unpow-prod-down34.9%
pow234.9%
add-sqr-sqrt89.5%
Applied egg-rr89.5%
associate-*r*90.1%
Simplified90.1%
Taylor expanded in k around inf 77.4%
associate-/r*77.4%
Simplified94.1%
if 2.9e-5 < k < 1.6000000000000001e109Initial program 23.1%
Simplified34.8%
associate-*l*34.8%
+-rgt-identity34.8%
*-commutative34.8%
associate-*r*34.8%
*-commutative34.8%
associate-/r*34.8%
associate-*l/34.8%
Applied egg-rr34.8%
Taylor expanded in t around 0 92.2%
times-frac99.7%
associate-*r/99.7%
Simplified99.7%
*-un-lft-identity99.7%
associate-/l/99.7%
associate-*r*99.7%
Applied egg-rr99.7%
unpow299.7%
sin-mult99.7%
Applied egg-rr99.7%
div-sub99.7%
+-inverses99.7%
cos-099.7%
metadata-eval99.7%
count-299.7%
*-commutative99.7%
Simplified99.7%
if 1.6000000000000001e109 < k Initial program 30.1%
Simplified42.9%
Taylor expanded in t around 0 69.0%
associate-/l*70.8%
Simplified70.8%
expm1-log1p-u38.5%
expm1-udef36.3%
Applied egg-rr44.2%
expm1-def48.2%
expm1-log1p48.8%
associate-/r/48.8%
Simplified48.8%
*-commutative48.8%
unpow-prod-down48.9%
associate-/r/48.8%
unpow-prod-down48.7%
pow248.7%
add-sqr-sqrt95.6%
Applied egg-rr95.6%
Final simplification94.9%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ t (cos k))))
(if (<= k 2.9e-5)
(/ 2.0 (* (pow (* (sin k) (/ k l)) 2.0) t_1))
(if (<= k 1.55e+110)
(/
2.0
(/
(* (* t (/ (pow k 2.0) l)) (- 0.5 (/ (cos (* k 2.0)) 2.0)))
(* l (cos k))))
(/ 2.0 (* t_1 (* (pow (sin k) 2.0) (/ (/ k l) (/ l k)))))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = t / cos(k);
double tmp;
if (k <= 2.9e-5) {
tmp = 2.0 / (pow((sin(k) * (k / l)), 2.0) * t_1);
} else if (k <= 1.55e+110) {
tmp = 2.0 / (((t * (pow(k, 2.0) / l)) * (0.5 - (cos((k * 2.0)) / 2.0))) / (l * cos(k)));
} else {
tmp = 2.0 / (t_1 * (pow(sin(k), 2.0) * ((k / l) / (l / k))));
}
return tmp;
}
NOTE: k should be positive before calling this 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) :: tmp
t_1 = t / cos(k)
if (k <= 2.9d-5) then
tmp = 2.0d0 / (((sin(k) * (k / l)) ** 2.0d0) * t_1)
else if (k <= 1.55d+110) then
tmp = 2.0d0 / (((t * ((k ** 2.0d0) / l)) * (0.5d0 - (cos((k * 2.0d0)) / 2.0d0))) / (l * cos(k)))
else
tmp = 2.0d0 / (t_1 * ((sin(k) ** 2.0d0) * ((k / l) / (l / k))))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = t / Math.cos(k);
double tmp;
if (k <= 2.9e-5) {
tmp = 2.0 / (Math.pow((Math.sin(k) * (k / l)), 2.0) * t_1);
} else if (k <= 1.55e+110) {
tmp = 2.0 / (((t * (Math.pow(k, 2.0) / l)) * (0.5 - (Math.cos((k * 2.0)) / 2.0))) / (l * Math.cos(k)));
} else {
tmp = 2.0 / (t_1 * (Math.pow(Math.sin(k), 2.0) * ((k / l) / (l / k))));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = t / math.cos(k) tmp = 0 if k <= 2.9e-5: tmp = 2.0 / (math.pow((math.sin(k) * (k / l)), 2.0) * t_1) elif k <= 1.55e+110: tmp = 2.0 / (((t * (math.pow(k, 2.0) / l)) * (0.5 - (math.cos((k * 2.0)) / 2.0))) / (l * math.cos(k))) else: tmp = 2.0 / (t_1 * (math.pow(math.sin(k), 2.0) * ((k / l) / (l / k)))) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(t / cos(k)) tmp = 0.0 if (k <= 2.9e-5) tmp = Float64(2.0 / Float64((Float64(sin(k) * Float64(k / l)) ^ 2.0) * t_1)); elseif (k <= 1.55e+110) tmp = Float64(2.0 / Float64(Float64(Float64(t * Float64((k ^ 2.0) / l)) * Float64(0.5 - Float64(cos(Float64(k * 2.0)) / 2.0))) / Float64(l * cos(k)))); else tmp = Float64(2.0 / Float64(t_1 * Float64((sin(k) ^ 2.0) * Float64(Float64(k / l) / Float64(l / k))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = t / cos(k); tmp = 0.0; if (k <= 2.9e-5) tmp = 2.0 / (((sin(k) * (k / l)) ^ 2.0) * t_1); elseif (k <= 1.55e+110) tmp = 2.0 / (((t * ((k ^ 2.0) / l)) * (0.5 - (cos((k * 2.0)) / 2.0))) / (l * cos(k))); else tmp = 2.0 / (t_1 * ((sin(k) ^ 2.0) * ((k / l) / (l / k)))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2.9e-5], N[(2.0 / N[(N[Power[N[(N[Sin[k], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.55e+110], N[(2.0 / N[(N[(N[(t * N[(N[Power[k, 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(0.5 - N[(N[Cos[N[(k * 2.0), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t$95$1 * N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(k / l), $MachinePrecision] / N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{t}{\cos k}\\
\mathbf{if}\;k \leq 2.9 \cdot 10^{-5}:\\
\;\;\;\;\frac{2}{{\left(\sin k \cdot \frac{k}{\ell}\right)}^{2} \cdot t_1}\\
\mathbf{elif}\;k \leq 1.55 \cdot 10^{+110}:\\
\;\;\;\;\frac{2}{\frac{\left(t \cdot \frac{{k}^{2}}{\ell}\right) \cdot \left(0.5 - \frac{\cos \left(k \cdot 2\right)}{2}\right)}{\ell \cdot \cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t_1 \cdot \left({\sin k}^{2} \cdot \frac{\frac{k}{\ell}}{\frac{\ell}{k}}\right)}\\
\end{array}
\end{array}
if k < 2.9e-5Initial program 43.4%
Simplified49.8%
Taylor expanded in t around 0 77.4%
associate-/l*78.9%
Simplified78.9%
expm1-log1p-u61.1%
expm1-udef29.9%
Applied egg-rr32.7%
expm1-def36.8%
expm1-log1p37.1%
associate-/r/37.1%
Simplified37.1%
*-commutative37.1%
unpow-prod-down37.0%
associate-/r/38.0%
unpow-prod-down34.9%
pow234.9%
add-sqr-sqrt89.5%
Applied egg-rr89.5%
associate-*r*90.1%
Simplified90.1%
Taylor expanded in k around inf 77.4%
associate-/r*77.4%
Simplified94.1%
if 2.9e-5 < k < 1.55000000000000009e110Initial program 23.1%
Simplified34.8%
associate-*l*34.8%
+-rgt-identity34.8%
*-commutative34.8%
associate-*r*34.8%
*-commutative34.8%
associate-/r*34.8%
associate-*l/34.8%
Applied egg-rr34.8%
Taylor expanded in t around 0 92.2%
times-frac99.7%
associate-*r/99.7%
Simplified99.7%
*-un-lft-identity99.7%
associate-/l/99.7%
associate-*r*99.7%
Applied egg-rr99.7%
unpow299.7%
sin-mult99.7%
Applied egg-rr99.7%
div-sub99.7%
+-inverses99.7%
cos-099.7%
metadata-eval99.7%
count-299.7%
*-commutative99.7%
Simplified99.7%
if 1.55000000000000009e110 < k Initial program 30.1%
Simplified42.9%
Taylor expanded in t around 0 69.0%
associate-/l*70.8%
Simplified70.8%
expm1-log1p-u38.5%
expm1-udef36.3%
Applied egg-rr44.2%
expm1-def48.2%
expm1-log1p48.8%
associate-/r/48.8%
Simplified48.8%
*-commutative48.8%
unpow-prod-down48.9%
associate-/r/48.8%
unpow-prod-down48.7%
pow248.7%
add-sqr-sqrt95.6%
Applied egg-rr95.6%
associate-*r*95.6%
Simplified95.6%
unpow295.6%
clear-num95.6%
un-div-inv95.7%
Applied egg-rr95.7%
Final simplification94.9%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (/ 2.0 (* (pow (* (sin k) (/ k l)) 2.0) (/ t (cos k)))))
k = abs(k);
double code(double t, double l, double k) {
return 2.0 / (pow((sin(k) * (k / l)), 2.0) * (t / cos(k)));
}
NOTE: k should be positive before calling this function
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 / (((sin(k) * (k / l)) ** 2.0d0) * (t / cos(k)))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return 2.0 / (Math.pow((Math.sin(k) * (k / l)), 2.0) * (t / Math.cos(k)));
}
k = abs(k) def code(t, l, k): return 2.0 / (math.pow((math.sin(k) * (k / l)), 2.0) * (t / math.cos(k)))
k = abs(k) function code(t, l, k) return Float64(2.0 / Float64((Float64(sin(k) * Float64(k / l)) ^ 2.0) * Float64(t / cos(k)))) end
k = abs(k) function tmp = code(t, l, k) tmp = 2.0 / (((sin(k) * (k / l)) ^ 2.0) * (t / cos(k))); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(2.0 / N[(N[Power[N[(N[Sin[k], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{2}{{\left(\sin k \cdot \frac{k}{\ell}\right)}^{2} \cdot \frac{t}{\cos k}}
\end{array}
Initial program 38.9%
Simplified47.0%
Taylor expanded in t around 0 77.3%
associate-/l*78.0%
Simplified78.0%
expm1-log1p-u56.6%
expm1-udef32.3%
Applied egg-rr35.8%
expm1-def40.1%
expm1-log1p40.6%
associate-/r/40.6%
Simplified40.6%
*-commutative40.6%
unpow-prod-down40.4%
associate-/r/41.2%
unpow-prod-down38.2%
pow238.2%
add-sqr-sqrt90.5%
Applied egg-rr90.5%
associate-*r*90.9%
Simplified90.9%
Taylor expanded in k around inf 77.3%
associate-/r*77.3%
Simplified93.8%
Final simplification93.8%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (/ 2.0 (* (pow (* (sin k) (/ k l)) 2.0) t)))
k = abs(k);
double code(double t, double l, double k) {
return 2.0 / (pow((sin(k) * (k / l)), 2.0) * t);
}
NOTE: k should be positive before calling this function
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 / (((sin(k) * (k / l)) ** 2.0d0) * t)
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return 2.0 / (Math.pow((Math.sin(k) * (k / l)), 2.0) * t);
}
k = abs(k) def code(t, l, k): return 2.0 / (math.pow((math.sin(k) * (k / l)), 2.0) * t)
k = abs(k) function code(t, l, k) return Float64(2.0 / Float64((Float64(sin(k) * Float64(k / l)) ^ 2.0) * t)) end
k = abs(k) function tmp = code(t, l, k) tmp = 2.0 / (((sin(k) * (k / l)) ^ 2.0) * t); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(2.0 / N[(N[Power[N[(N[Sin[k], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{2}{{\left(\sin k \cdot \frac{k}{\ell}\right)}^{2} \cdot t}
\end{array}
Initial program 38.9%
Simplified47.0%
Taylor expanded in t around 0 77.3%
associate-/l*78.0%
Simplified78.0%
Taylor expanded in k around 0 67.5%
Taylor expanded in k around inf 66.6%
*-commutative66.6%
associate-*l/67.8%
unpow267.8%
associate-/l/70.8%
associate-*l/72.6%
unpow272.6%
associate-*l/73.3%
associate-*l/71.6%
associate-*r/71.6%
unpow271.6%
associate-*r*72.8%
unpow272.8%
unpow272.8%
swap-sqr75.7%
*-commutative75.7%
*-commutative75.7%
unpow275.7%
Simplified75.7%
Final simplification75.7%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* l (/ 2.0 (/ (pow k 4.0) (/ l t)))))
k = abs(k);
double code(double t, double l, double k) {
return l * (2.0 / (pow(k, 4.0) / (l / t)));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = l * (2.0d0 / ((k ** 4.0d0) / (l / t)))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return l * (2.0 / (Math.pow(k, 4.0) / (l / t)));
}
k = abs(k) def code(t, l, k): return l * (2.0 / (math.pow(k, 4.0) / (l / t)))
k = abs(k) function code(t, l, k) return Float64(l * Float64(2.0 / Float64((k ^ 4.0) / Float64(l / t)))) end
k = abs(k) function tmp = code(t, l, k) tmp = l * (2.0 / ((k ^ 4.0) / (l / t))); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(l * N[(2.0 / N[(N[Power[k, 4.0], $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\ell \cdot \frac{2}{\frac{{k}^{4}}{\frac{\ell}{t}}}
\end{array}
Initial program 38.9%
Simplified47.0%
Taylor expanded in k around 0 64.0%
unpow264.0%
times-frac67.0%
Applied egg-rr67.0%
associate-*r/68.4%
Applied egg-rr68.4%
associate-/r/68.4%
*-commutative68.4%
Applied egg-rr68.4%
*-commutative68.4%
associate-*r/66.9%
*-commutative66.9%
associate-/l*67.0%
Simplified67.0%
Final simplification67.0%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* l (/ 2.0 (* t (/ (pow k 4.0) l)))))
k = abs(k);
double code(double t, double l, double k) {
return l * (2.0 / (t * (pow(k, 4.0) / l)));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = l * (2.0d0 / (t * ((k ** 4.0d0) / l)))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return l * (2.0 / (t * (Math.pow(k, 4.0) / l)));
}
k = abs(k) def code(t, l, k): return l * (2.0 / (t * (math.pow(k, 4.0) / l)))
k = abs(k) function code(t, l, k) return Float64(l * Float64(2.0 / Float64(t * Float64((k ^ 4.0) / l)))) end
k = abs(k) function tmp = code(t, l, k) tmp = l * (2.0 / (t * ((k ^ 4.0) / l))); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(l * N[(2.0 / N[(t * N[(N[Power[k, 4.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\ell \cdot \frac{2}{t \cdot \frac{{k}^{4}}{\ell}}
\end{array}
Initial program 38.9%
Simplified47.0%
Taylor expanded in k around 0 64.0%
unpow264.0%
times-frac67.0%
Applied egg-rr67.0%
associate-*r/68.4%
Applied egg-rr68.4%
associate-/r/68.4%
*-commutative68.4%
Applied egg-rr68.4%
Final simplification68.4%
herbie shell --seed 2023305
(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))))