
(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 10 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: l should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= l 6e-216) (/ 2.0 (/ (* t (pow (* (/ k l) (sin k)) 2.0)) (cos k))) (/ 2.0 (* (/ (* t (/ k l)) (/ l k)) (/ (pow (sin k) 2.0) (cos k))))))
l = abs(l);
double code(double t, double l, double k) {
double tmp;
if (l <= 6e-216) {
tmp = 2.0 / ((t * pow(((k / l) * sin(k)), 2.0)) / cos(k));
} else {
tmp = 2.0 / (((t * (k / l)) / (l / k)) * (pow(sin(k), 2.0) / cos(k)));
}
return tmp;
}
NOTE: l 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) :: tmp
if (l <= 6d-216) then
tmp = 2.0d0 / ((t * (((k / l) * sin(k)) ** 2.0d0)) / cos(k))
else
tmp = 2.0d0 / (((t * (k / l)) / (l / k)) * ((sin(k) ** 2.0d0) / cos(k)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
double tmp;
if (l <= 6e-216) {
tmp = 2.0 / ((t * Math.pow(((k / l) * Math.sin(k)), 2.0)) / Math.cos(k));
} else {
tmp = 2.0 / (((t * (k / l)) / (l / k)) * (Math.pow(Math.sin(k), 2.0) / Math.cos(k)));
}
return tmp;
}
l = abs(l) def code(t, l, k): tmp = 0 if l <= 6e-216: tmp = 2.0 / ((t * math.pow(((k / l) * math.sin(k)), 2.0)) / math.cos(k)) else: tmp = 2.0 / (((t * (k / l)) / (l / k)) * (math.pow(math.sin(k), 2.0) / math.cos(k))) return tmp
l = abs(l) function code(t, l, k) tmp = 0.0 if (l <= 6e-216) tmp = Float64(2.0 / Float64(Float64(t * (Float64(Float64(k / l) * sin(k)) ^ 2.0)) / cos(k))); else tmp = Float64(2.0 / Float64(Float64(Float64(t * Float64(k / l)) / Float64(l / k)) * Float64((sin(k) ^ 2.0) / cos(k)))); end return tmp end
l = abs(l) function tmp_2 = code(t, l, k) tmp = 0.0; if (l <= 6e-216) tmp = 2.0 / ((t * (((k / l) * sin(k)) ^ 2.0)) / cos(k)); else tmp = 2.0 / (((t * (k / l)) / (l / k)) * ((sin(k) ^ 2.0) / cos(k))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[t_, l_, k_] := If[LessEqual[l, 6e-216], N[(2.0 / N[(N[(t * N[Power[N[(N[(k / l), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(t * N[(k / l), $MachinePrecision]), $MachinePrecision] / N[(l / k), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 6 \cdot 10^{-216}:\\
\;\;\;\;\frac{2}{\frac{t \cdot {\left(\frac{k}{\ell} \cdot \sin k\right)}^{2}}{\cos k}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t \cdot \frac{k}{\ell}}{\frac{\ell}{k}} \cdot \frac{{\sin k}^{2}}{\cos k}}\\
\end{array}
\end{array}
if l < 6.00000000000000025e-216Initial program 29.8%
Taylor expanded in t around 0 70.5%
times-frac70.6%
Simplified70.6%
add-sqr-sqrt70.6%
sqrt-div70.6%
unpow270.6%
sqrt-prod38.2%
add-sqr-sqrt57.8%
pow257.8%
sqrt-prod6.8%
add-sqr-sqrt46.8%
sqrt-div46.7%
unpow246.7%
sqrt-prod14.3%
add-sqr-sqrt34.0%
pow234.0%
sqrt-prod8.8%
add-sqr-sqrt90.9%
Applied egg-rr90.9%
Taylor expanded in k around inf 70.5%
*-commutative70.5%
*-commutative70.5%
times-frac70.6%
associate-*l/70.5%
unpow270.5%
unpow270.5%
times-frac90.9%
unpow290.9%
associate-*l*91.4%
Simplified91.4%
associate-*l/91.4%
*-commutative91.4%
pow-prod-down95.3%
Applied egg-rr95.3%
if 6.00000000000000025e-216 < l Initial program 36.8%
Taylor expanded in t around 0 78.3%
times-frac82.4%
Simplified82.4%
add-sqr-sqrt82.4%
sqrt-div82.4%
unpow282.4%
sqrt-prod41.5%
add-sqr-sqrt58.2%
pow258.2%
sqrt-prod58.2%
add-sqr-sqrt58.2%
sqrt-div58.2%
unpow258.2%
sqrt-prod41.6%
add-sqr-sqrt82.6%
pow282.6%
sqrt-prod92.5%
add-sqr-sqrt92.6%
Applied egg-rr92.6%
clear-num92.6%
clear-num92.5%
frac-times92.5%
metadata-eval92.5%
Applied egg-rr92.5%
*-commutative92.5%
clear-num92.5%
associate-/r*92.6%
clear-num92.6%
frac-times97.8%
*-un-lft-identity97.8%
Applied egg-rr97.8%
*-commutative97.8%
associate-*r/97.8%
associate-/l*97.9%
associate-*r*98.8%
times-frac98.8%
*-commutative98.8%
Simplified98.8%
Final simplification96.7%
NOTE: l should be positive before calling this function (FPCore (t l k) :precision binary64 (/ 2.0 (/ (* t (pow (* (/ k l) (sin k)) 2.0)) (cos k))))
l = abs(l);
double code(double t, double l, double k) {
return 2.0 / ((t * pow(((k / l) * sin(k)), 2.0)) / cos(k));
}
NOTE: l 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 / ((t * (((k / l) * sin(k)) ** 2.0d0)) / cos(k))
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
return 2.0 / ((t * Math.pow(((k / l) * Math.sin(k)), 2.0)) / Math.cos(k));
}
l = abs(l) def code(t, l, k): return 2.0 / ((t * math.pow(((k / l) * math.sin(k)), 2.0)) / math.cos(k))
l = abs(l) function code(t, l, k) return Float64(2.0 / Float64(Float64(t * (Float64(Float64(k / l) * sin(k)) ^ 2.0)) / cos(k))) end
l = abs(l) function tmp = code(t, l, k) tmp = 2.0 / ((t * (((k / l) * sin(k)) ^ 2.0)) / cos(k)); end
NOTE: l should be positive before calling this function code[t_, l_, k_] := N[(2.0 / N[(N[(t * N[Power[N[(N[(k / l), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l = |l|\\
\\
\frac{2}{\frac{t \cdot {\left(\frac{k}{\ell} \cdot \sin k\right)}^{2}}{\cos k}}
\end{array}
Initial program 32.7%
Taylor expanded in t around 0 73.7%
times-frac75.5%
Simplified75.5%
add-sqr-sqrt75.4%
sqrt-div75.5%
unpow275.5%
sqrt-prod39.6%
add-sqr-sqrt57.9%
pow257.9%
sqrt-prod28.1%
add-sqr-sqrt51.5%
sqrt-div51.5%
unpow251.5%
sqrt-prod25.6%
add-sqr-sqrt54.1%
pow254.1%
sqrt-prod43.5%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
Taylor expanded in k around inf 73.7%
*-commutative73.7%
*-commutative73.7%
times-frac75.5%
associate-*l/75.5%
unpow275.5%
unpow275.5%
times-frac91.6%
unpow291.6%
associate-*l*91.9%
Simplified91.9%
associate-*l/91.9%
*-commutative91.9%
pow-prod-down94.2%
Applied egg-rr94.2%
Final simplification94.2%
NOTE: l should be positive before calling this function (FPCore (t l k) :precision binary64 (/ (/ 2.0 (/ t (cos k))) (pow (* (/ k l) (sin k)) 2.0)))
l = abs(l);
double code(double t, double l, double k) {
return (2.0 / (t / cos(k))) / pow(((k / l) * sin(k)), 2.0);
}
NOTE: l 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 / (t / cos(k))) / (((k / l) * sin(k)) ** 2.0d0)
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
return (2.0 / (t / Math.cos(k))) / Math.pow(((k / l) * Math.sin(k)), 2.0);
}
l = abs(l) def code(t, l, k): return (2.0 / (t / math.cos(k))) / math.pow(((k / l) * math.sin(k)), 2.0)
l = abs(l) function code(t, l, k) return Float64(Float64(2.0 / Float64(t / cos(k))) / (Float64(Float64(k / l) * sin(k)) ^ 2.0)) end
l = abs(l) function tmp = code(t, l, k) tmp = (2.0 / (t / cos(k))) / (((k / l) * sin(k)) ^ 2.0); end
NOTE: l should be positive before calling this function code[t_, l_, k_] := N[(N[(2.0 / N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(N[(k / l), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l = |l|\\
\\
\frac{\frac{2}{\frac{t}{\cos k}}}{{\left(\frac{k}{\ell} \cdot \sin k\right)}^{2}}
\end{array}
Initial program 32.7%
Taylor expanded in t around 0 73.7%
times-frac75.5%
Simplified75.5%
add-sqr-sqrt75.4%
sqrt-div75.5%
unpow275.5%
sqrt-prod39.6%
add-sqr-sqrt57.9%
pow257.9%
sqrt-prod28.1%
add-sqr-sqrt51.5%
sqrt-div51.5%
unpow251.5%
sqrt-prod25.6%
add-sqr-sqrt54.1%
pow254.1%
sqrt-prod43.5%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
Taylor expanded in k around inf 73.7%
*-commutative73.7%
*-commutative73.7%
times-frac75.5%
associate-*l/75.5%
unpow275.5%
unpow275.5%
times-frac91.6%
unpow291.6%
associate-*l*91.9%
Simplified91.9%
*-un-lft-identity91.9%
associate-/r*92.3%
*-commutative92.3%
pow-prod-down94.5%
Applied egg-rr94.5%
Final simplification94.5%
NOTE: l should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (- 0.5 (/ (cos (* 2.0 k)) 2.0))) (t_2 (* t (* k (/ k l)))))
(if (<= k 0.013)
(/
2.0
(/
t_2
(-
(+
(* l -0.5)
(+
(*
(pow k 2.0)
(+
(* l 0.041666666666666664)
(-
(* -0.3333333333333333 (- (* l -0.3333333333333333) (* l -0.5)))
(* l 0.044444444444444446))))
(/ l (pow k 2.0))))
(* l -0.3333333333333333))))
(if (<= k 7.2e+109)
(/ 2.0 (/ t_2 (* l (/ (cos k) t_1))))
(/ 2.0 (* (/ 1.0 (* (/ l k) (/ l k))) (/ (* t t_1) (cos k))))))))l = abs(l);
double code(double t, double l, double k) {
double t_1 = 0.5 - (cos((2.0 * k)) / 2.0);
double t_2 = t * (k * (k / l));
double tmp;
if (k <= 0.013) {
tmp = 2.0 / (t_2 / (((l * -0.5) + ((pow(k, 2.0) * ((l * 0.041666666666666664) + ((-0.3333333333333333 * ((l * -0.3333333333333333) - (l * -0.5))) - (l * 0.044444444444444446)))) + (l / pow(k, 2.0)))) - (l * -0.3333333333333333)));
} else if (k <= 7.2e+109) {
tmp = 2.0 / (t_2 / (l * (cos(k) / t_1)));
} else {
tmp = 2.0 / ((1.0 / ((l / k) * (l / k))) * ((t * t_1) / cos(k)));
}
return tmp;
}
NOTE: l 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) :: t_2
real(8) :: tmp
t_1 = 0.5d0 - (cos((2.0d0 * k)) / 2.0d0)
t_2 = t * (k * (k / l))
if (k <= 0.013d0) then
tmp = 2.0d0 / (t_2 / (((l * (-0.5d0)) + (((k ** 2.0d0) * ((l * 0.041666666666666664d0) + (((-0.3333333333333333d0) * ((l * (-0.3333333333333333d0)) - (l * (-0.5d0)))) - (l * 0.044444444444444446d0)))) + (l / (k ** 2.0d0)))) - (l * (-0.3333333333333333d0))))
else if (k <= 7.2d+109) then
tmp = 2.0d0 / (t_2 / (l * (cos(k) / t_1)))
else
tmp = 2.0d0 / ((1.0d0 / ((l / k) * (l / k))) * ((t * t_1) / cos(k)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
double t_1 = 0.5 - (Math.cos((2.0 * k)) / 2.0);
double t_2 = t * (k * (k / l));
double tmp;
if (k <= 0.013) {
tmp = 2.0 / (t_2 / (((l * -0.5) + ((Math.pow(k, 2.0) * ((l * 0.041666666666666664) + ((-0.3333333333333333 * ((l * -0.3333333333333333) - (l * -0.5))) - (l * 0.044444444444444446)))) + (l / Math.pow(k, 2.0)))) - (l * -0.3333333333333333)));
} else if (k <= 7.2e+109) {
tmp = 2.0 / (t_2 / (l * (Math.cos(k) / t_1)));
} else {
tmp = 2.0 / ((1.0 / ((l / k) * (l / k))) * ((t * t_1) / Math.cos(k)));
}
return tmp;
}
l = abs(l) def code(t, l, k): t_1 = 0.5 - (math.cos((2.0 * k)) / 2.0) t_2 = t * (k * (k / l)) tmp = 0 if k <= 0.013: tmp = 2.0 / (t_2 / (((l * -0.5) + ((math.pow(k, 2.0) * ((l * 0.041666666666666664) + ((-0.3333333333333333 * ((l * -0.3333333333333333) - (l * -0.5))) - (l * 0.044444444444444446)))) + (l / math.pow(k, 2.0)))) - (l * -0.3333333333333333))) elif k <= 7.2e+109: tmp = 2.0 / (t_2 / (l * (math.cos(k) / t_1))) else: tmp = 2.0 / ((1.0 / ((l / k) * (l / k))) * ((t * t_1) / math.cos(k))) return tmp
l = abs(l) function code(t, l, k) t_1 = Float64(0.5 - Float64(cos(Float64(2.0 * k)) / 2.0)) t_2 = Float64(t * Float64(k * Float64(k / l))) tmp = 0.0 if (k <= 0.013) tmp = Float64(2.0 / Float64(t_2 / Float64(Float64(Float64(l * -0.5) + Float64(Float64((k ^ 2.0) * Float64(Float64(l * 0.041666666666666664) + Float64(Float64(-0.3333333333333333 * Float64(Float64(l * -0.3333333333333333) - Float64(l * -0.5))) - Float64(l * 0.044444444444444446)))) + Float64(l / (k ^ 2.0)))) - Float64(l * -0.3333333333333333)))); elseif (k <= 7.2e+109) tmp = Float64(2.0 / Float64(t_2 / Float64(l * Float64(cos(k) / t_1)))); else tmp = Float64(2.0 / Float64(Float64(1.0 / Float64(Float64(l / k) * Float64(l / k))) * Float64(Float64(t * t_1) / cos(k)))); end return tmp end
l = abs(l) function tmp_2 = code(t, l, k) t_1 = 0.5 - (cos((2.0 * k)) / 2.0); t_2 = t * (k * (k / l)); tmp = 0.0; if (k <= 0.013) tmp = 2.0 / (t_2 / (((l * -0.5) + (((k ^ 2.0) * ((l * 0.041666666666666664) + ((-0.3333333333333333 * ((l * -0.3333333333333333) - (l * -0.5))) - (l * 0.044444444444444446)))) + (l / (k ^ 2.0)))) - (l * -0.3333333333333333))); elseif (k <= 7.2e+109) tmp = 2.0 / (t_2 / (l * (cos(k) / t_1))); else tmp = 2.0 / ((1.0 / ((l / k) * (l / k))) * ((t * t_1) / cos(k))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(0.5 - N[(N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 0.013], N[(2.0 / N[(t$95$2 / N[(N[(N[(l * -0.5), $MachinePrecision] + N[(N[(N[Power[k, 2.0], $MachinePrecision] * N[(N[(l * 0.041666666666666664), $MachinePrecision] + N[(N[(-0.3333333333333333 * N[(N[(l * -0.3333333333333333), $MachinePrecision] - N[(l * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * 0.044444444444444446), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(l / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(l * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 7.2e+109], N[(2.0 / N[(t$95$2 / N[(l * N[(N[Cos[k], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(1.0 / N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t * t$95$1), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := 0.5 - \frac{\cos \left(2 \cdot k\right)}{2}\\
t_2 := t \cdot \left(k \cdot \frac{k}{\ell}\right)\\
\mathbf{if}\;k \leq 0.013:\\
\;\;\;\;\frac{2}{\frac{t_2}{\left(\ell \cdot -0.5 + \left({k}^{2} \cdot \left(\ell \cdot 0.041666666666666664 + \left(-0.3333333333333333 \cdot \left(\ell \cdot -0.3333333333333333 - \ell \cdot -0.5\right) - \ell \cdot 0.044444444444444446\right)\right) + \frac{\ell}{{k}^{2}}\right)\right) - \ell \cdot -0.3333333333333333}}\\
\mathbf{elif}\;k \leq 7.2 \cdot 10^{+109}:\\
\;\;\;\;\frac{2}{\frac{t_2}{\ell \cdot \frac{\cos k}{t_1}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{1}{\frac{\ell}{k} \cdot \frac{\ell}{k}} \cdot \frac{t \cdot t_1}{\cos k}}\\
\end{array}
\end{array}
if k < 0.0129999999999999994Initial program 35.2%
Taylor expanded in t around 0 72.7%
times-frac75.6%
Simplified75.6%
add-sqr-sqrt75.6%
sqrt-div75.6%
unpow275.6%
sqrt-prod27.0%
add-sqr-sqrt51.8%
pow251.8%
sqrt-prod24.7%
add-sqr-sqrt48.9%
sqrt-div48.9%
unpow248.9%
sqrt-prod13.8%
add-sqr-sqrt52.4%
pow252.4%
sqrt-prod44.6%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate-*r/89.8%
associate-/l*89.8%
frac-times93.2%
Applied egg-rr93.2%
Taylor expanded in k around 0 62.5%
if 0.0129999999999999994 < k < 7.2e109Initial program 17.3%
Taylor expanded in t around 0 82.9%
times-frac74.9%
Simplified74.9%
add-sqr-sqrt74.9%
sqrt-div74.9%
unpow274.9%
sqrt-prod74.9%
add-sqr-sqrt74.9%
pow274.9%
sqrt-prod35.3%
add-sqr-sqrt48.8%
sqrt-div48.8%
unpow248.8%
sqrt-prod48.8%
add-sqr-sqrt48.8%
pow248.8%
sqrt-prod39.4%
add-sqr-sqrt83.2%
Applied egg-rr83.2%
associate-*r/83.2%
associate-/l*83.2%
frac-times95.6%
Applied egg-rr95.6%
unpow283.2%
sin-mult83.3%
Applied egg-rr95.7%
div-sub83.3%
+-inverses83.3%
cos-083.3%
metadata-eval83.3%
count-283.3%
Simplified95.7%
if 7.2e109 < k Initial program 29.8%
Taylor expanded in t around 0 73.0%
times-frac75.2%
Simplified75.2%
add-sqr-sqrt75.2%
sqrt-div75.2%
unpow275.2%
sqrt-prod75.2%
add-sqr-sqrt75.2%
pow275.2%
sqrt-prod38.7%
add-sqr-sqrt64.0%
sqrt-div64.1%
unpow264.1%
sqrt-prod64.1%
add-sqr-sqrt64.2%
pow264.2%
sqrt-prod40.8%
add-sqr-sqrt97.5%
Applied egg-rr97.5%
clear-num97.5%
clear-num97.3%
frac-times97.6%
metadata-eval97.6%
Applied egg-rr97.6%
unpow297.5%
sin-mult96.9%
Applied egg-rr97.0%
div-sub96.9%
+-inverses96.9%
cos-096.9%
metadata-eval96.9%
count-296.9%
Simplified97.0%
Final simplification71.4%
NOTE: l should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* t (* k (/ k l)))) (t_2 (- 0.5 (/ (cos (* 2.0 k)) 2.0))))
(if (<= k 0.0025)
(/ 2.0 (/ t_1 (+ (/ l (pow k 2.0)) (* l -0.16666666666666666))))
(if (<= k 5e+109)
(/ 2.0 (/ t_1 (* l (/ (cos k) t_2))))
(/ 2.0 (* (/ 1.0 (* (/ l k) (/ l k))) (/ (* t t_2) (cos k))))))))l = abs(l);
double code(double t, double l, double k) {
double t_1 = t * (k * (k / l));
double t_2 = 0.5 - (cos((2.0 * k)) / 2.0);
double tmp;
if (k <= 0.0025) {
tmp = 2.0 / (t_1 / ((l / pow(k, 2.0)) + (l * -0.16666666666666666)));
} else if (k <= 5e+109) {
tmp = 2.0 / (t_1 / (l * (cos(k) / t_2)));
} else {
tmp = 2.0 / ((1.0 / ((l / k) * (l / k))) * ((t * t_2) / cos(k)));
}
return tmp;
}
NOTE: l 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) :: t_2
real(8) :: tmp
t_1 = t * (k * (k / l))
t_2 = 0.5d0 - (cos((2.0d0 * k)) / 2.0d0)
if (k <= 0.0025d0) then
tmp = 2.0d0 / (t_1 / ((l / (k ** 2.0d0)) + (l * (-0.16666666666666666d0))))
else if (k <= 5d+109) then
tmp = 2.0d0 / (t_1 / (l * (cos(k) / t_2)))
else
tmp = 2.0d0 / ((1.0d0 / ((l / k) * (l / k))) * ((t * t_2) / cos(k)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
double t_1 = t * (k * (k / l));
double t_2 = 0.5 - (Math.cos((2.0 * k)) / 2.0);
double tmp;
if (k <= 0.0025) {
tmp = 2.0 / (t_1 / ((l / Math.pow(k, 2.0)) + (l * -0.16666666666666666)));
} else if (k <= 5e+109) {
tmp = 2.0 / (t_1 / (l * (Math.cos(k) / t_2)));
} else {
tmp = 2.0 / ((1.0 / ((l / k) * (l / k))) * ((t * t_2) / Math.cos(k)));
}
return tmp;
}
l = abs(l) def code(t, l, k): t_1 = t * (k * (k / l)) t_2 = 0.5 - (math.cos((2.0 * k)) / 2.0) tmp = 0 if k <= 0.0025: tmp = 2.0 / (t_1 / ((l / math.pow(k, 2.0)) + (l * -0.16666666666666666))) elif k <= 5e+109: tmp = 2.0 / (t_1 / (l * (math.cos(k) / t_2))) else: tmp = 2.0 / ((1.0 / ((l / k) * (l / k))) * ((t * t_2) / math.cos(k))) return tmp
l = abs(l) function code(t, l, k) t_1 = Float64(t * Float64(k * Float64(k / l))) t_2 = Float64(0.5 - Float64(cos(Float64(2.0 * k)) / 2.0)) tmp = 0.0 if (k <= 0.0025) tmp = Float64(2.0 / Float64(t_1 / Float64(Float64(l / (k ^ 2.0)) + Float64(l * -0.16666666666666666)))); elseif (k <= 5e+109) tmp = Float64(2.0 / Float64(t_1 / Float64(l * Float64(cos(k) / t_2)))); else tmp = Float64(2.0 / Float64(Float64(1.0 / Float64(Float64(l / k) * Float64(l / k))) * Float64(Float64(t * t_2) / cos(k)))); end return tmp end
l = abs(l) function tmp_2 = code(t, l, k) t_1 = t * (k * (k / l)); t_2 = 0.5 - (cos((2.0 * k)) / 2.0); tmp = 0.0; if (k <= 0.0025) tmp = 2.0 / (t_1 / ((l / (k ^ 2.0)) + (l * -0.16666666666666666))); elseif (k <= 5e+109) tmp = 2.0 / (t_1 / (l * (cos(k) / t_2))); else tmp = 2.0 / ((1.0 / ((l / k) * (l / k))) * ((t * t_2) / cos(k))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 - N[(N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 0.0025], N[(2.0 / N[(t$95$1 / N[(N[(l / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 5e+109], N[(2.0 / N[(t$95$1 / N[(l * N[(N[Cos[k], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(1.0 / N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t * t$95$2), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := t \cdot \left(k \cdot \frac{k}{\ell}\right)\\
t_2 := 0.5 - \frac{\cos \left(2 \cdot k\right)}{2}\\
\mathbf{if}\;k \leq 0.0025:\\
\;\;\;\;\frac{2}{\frac{t_1}{\frac{\ell}{{k}^{2}} + \ell \cdot -0.16666666666666666}}\\
\mathbf{elif}\;k \leq 5 \cdot 10^{+109}:\\
\;\;\;\;\frac{2}{\frac{t_1}{\ell \cdot \frac{\cos k}{t_2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{1}{\frac{\ell}{k} \cdot \frac{\ell}{k}} \cdot \frac{t \cdot t_2}{\cos k}}\\
\end{array}
\end{array}
if k < 0.00250000000000000005Initial program 35.2%
Taylor expanded in t around 0 72.7%
times-frac75.6%
Simplified75.6%
add-sqr-sqrt75.6%
sqrt-div75.6%
unpow275.6%
sqrt-prod27.0%
add-sqr-sqrt51.8%
pow251.8%
sqrt-prod24.7%
add-sqr-sqrt48.9%
sqrt-div48.9%
unpow248.9%
sqrt-prod13.8%
add-sqr-sqrt52.4%
pow252.4%
sqrt-prod44.6%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate-*r/89.8%
associate-/l*89.8%
frac-times93.2%
Applied egg-rr93.2%
Taylor expanded in k around 0 81.4%
+-commutative81.4%
associate--l+81.4%
distribute-rgt-out--81.4%
metadata-eval81.4%
Simplified81.4%
if 0.00250000000000000005 < k < 5.0000000000000001e109Initial program 17.3%
Taylor expanded in t around 0 82.9%
times-frac74.9%
Simplified74.9%
add-sqr-sqrt74.9%
sqrt-div74.9%
unpow274.9%
sqrt-prod74.9%
add-sqr-sqrt74.9%
pow274.9%
sqrt-prod35.3%
add-sqr-sqrt48.8%
sqrt-div48.8%
unpow248.8%
sqrt-prod48.8%
add-sqr-sqrt48.8%
pow248.8%
sqrt-prod39.4%
add-sqr-sqrt83.2%
Applied egg-rr83.2%
associate-*r/83.2%
associate-/l*83.2%
frac-times95.6%
Applied egg-rr95.6%
unpow283.2%
sin-mult83.3%
Applied egg-rr95.7%
div-sub83.3%
+-inverses83.3%
cos-083.3%
metadata-eval83.3%
count-283.3%
Simplified95.7%
if 5.0000000000000001e109 < k Initial program 29.8%
Taylor expanded in t around 0 73.0%
times-frac75.2%
Simplified75.2%
add-sqr-sqrt75.2%
sqrt-div75.2%
unpow275.2%
sqrt-prod75.2%
add-sqr-sqrt75.2%
pow275.2%
sqrt-prod38.7%
add-sqr-sqrt64.0%
sqrt-div64.1%
unpow264.1%
sqrt-prod64.1%
add-sqr-sqrt64.2%
pow264.2%
sqrt-prod40.8%
add-sqr-sqrt97.5%
Applied egg-rr97.5%
clear-num97.5%
clear-num97.3%
frac-times97.6%
metadata-eval97.6%
Applied egg-rr97.6%
unpow297.5%
sin-mult96.9%
Applied egg-rr97.0%
div-sub96.9%
+-inverses96.9%
cos-096.9%
metadata-eval96.9%
count-296.9%
Simplified97.0%
Final simplification85.4%
NOTE: l should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* t (* k (/ k l)))) (t_2 (- 0.5 (/ (cos (* 2.0 k)) 2.0))))
(if (<= k 0.0025)
(/ 2.0 (/ t_1 (+ (/ l (pow k 2.0)) (* l -0.16666666666666666))))
(if (<= k 5.8e+79)
(/ 2.0 (/ t_1 (* l (/ (cos k) t_2))))
(/ 2.0 (* (/ (* t t_2) (cos k)) (* (/ k l) (/ k l))))))))l = abs(l);
double code(double t, double l, double k) {
double t_1 = t * (k * (k / l));
double t_2 = 0.5 - (cos((2.0 * k)) / 2.0);
double tmp;
if (k <= 0.0025) {
tmp = 2.0 / (t_1 / ((l / pow(k, 2.0)) + (l * -0.16666666666666666)));
} else if (k <= 5.8e+79) {
tmp = 2.0 / (t_1 / (l * (cos(k) / t_2)));
} else {
tmp = 2.0 / (((t * t_2) / cos(k)) * ((k / l) * (k / l)));
}
return tmp;
}
NOTE: l 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) :: t_2
real(8) :: tmp
t_1 = t * (k * (k / l))
t_2 = 0.5d0 - (cos((2.0d0 * k)) / 2.0d0)
if (k <= 0.0025d0) then
tmp = 2.0d0 / (t_1 / ((l / (k ** 2.0d0)) + (l * (-0.16666666666666666d0))))
else if (k <= 5.8d+79) then
tmp = 2.0d0 / (t_1 / (l * (cos(k) / t_2)))
else
tmp = 2.0d0 / (((t * t_2) / cos(k)) * ((k / l) * (k / l)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
double t_1 = t * (k * (k / l));
double t_2 = 0.5 - (Math.cos((2.0 * k)) / 2.0);
double tmp;
if (k <= 0.0025) {
tmp = 2.0 / (t_1 / ((l / Math.pow(k, 2.0)) + (l * -0.16666666666666666)));
} else if (k <= 5.8e+79) {
tmp = 2.0 / (t_1 / (l * (Math.cos(k) / t_2)));
} else {
tmp = 2.0 / (((t * t_2) / Math.cos(k)) * ((k / l) * (k / l)));
}
return tmp;
}
l = abs(l) def code(t, l, k): t_1 = t * (k * (k / l)) t_2 = 0.5 - (math.cos((2.0 * k)) / 2.0) tmp = 0 if k <= 0.0025: tmp = 2.0 / (t_1 / ((l / math.pow(k, 2.0)) + (l * -0.16666666666666666))) elif k <= 5.8e+79: tmp = 2.0 / (t_1 / (l * (math.cos(k) / t_2))) else: tmp = 2.0 / (((t * t_2) / math.cos(k)) * ((k / l) * (k / l))) return tmp
l = abs(l) function code(t, l, k) t_1 = Float64(t * Float64(k * Float64(k / l))) t_2 = Float64(0.5 - Float64(cos(Float64(2.0 * k)) / 2.0)) tmp = 0.0 if (k <= 0.0025) tmp = Float64(2.0 / Float64(t_1 / Float64(Float64(l / (k ^ 2.0)) + Float64(l * -0.16666666666666666)))); elseif (k <= 5.8e+79) tmp = Float64(2.0 / Float64(t_1 / Float64(l * Float64(cos(k) / t_2)))); else tmp = Float64(2.0 / Float64(Float64(Float64(t * t_2) / cos(k)) * Float64(Float64(k / l) * Float64(k / l)))); end return tmp end
l = abs(l) function tmp_2 = code(t, l, k) t_1 = t * (k * (k / l)); t_2 = 0.5 - (cos((2.0 * k)) / 2.0); tmp = 0.0; if (k <= 0.0025) tmp = 2.0 / (t_1 / ((l / (k ^ 2.0)) + (l * -0.16666666666666666))); elseif (k <= 5.8e+79) tmp = 2.0 / (t_1 / (l * (cos(k) / t_2))); else tmp = 2.0 / (((t * t_2) / cos(k)) * ((k / l) * (k / l))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 - N[(N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 0.0025], N[(2.0 / N[(t$95$1 / N[(N[(l / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 5.8e+79], N[(2.0 / N[(t$95$1 / N[(l * N[(N[Cos[k], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(t * t$95$2), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[(N[(k / l), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
t_1 := t \cdot \left(k \cdot \frac{k}{\ell}\right)\\
t_2 := 0.5 - \frac{\cos \left(2 \cdot k\right)}{2}\\
\mathbf{if}\;k \leq 0.0025:\\
\;\;\;\;\frac{2}{\frac{t_1}{\frac{\ell}{{k}^{2}} + \ell \cdot -0.16666666666666666}}\\
\mathbf{elif}\;k \leq 5.8 \cdot 10^{+79}:\\
\;\;\;\;\frac{2}{\frac{t_1}{\ell \cdot \frac{\cos k}{t_2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t \cdot t_2}{\cos k} \cdot \left(\frac{k}{\ell} \cdot \frac{k}{\ell}\right)}\\
\end{array}
\end{array}
if k < 0.00250000000000000005Initial program 35.2%
Taylor expanded in t around 0 72.7%
times-frac75.6%
Simplified75.6%
add-sqr-sqrt75.6%
sqrt-div75.6%
unpow275.6%
sqrt-prod27.0%
add-sqr-sqrt51.8%
pow251.8%
sqrt-prod24.7%
add-sqr-sqrt48.9%
sqrt-div48.9%
unpow248.9%
sqrt-prod13.8%
add-sqr-sqrt52.4%
pow252.4%
sqrt-prod44.6%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate-*r/89.8%
associate-/l*89.8%
frac-times93.2%
Applied egg-rr93.2%
Taylor expanded in k around 0 81.4%
+-commutative81.4%
associate--l+81.4%
distribute-rgt-out--81.4%
metadata-eval81.4%
Simplified81.4%
if 0.00250000000000000005 < k < 5.79999999999999984e79Initial program 17.6%
Taylor expanded in t around 0 82.7%
times-frac71.8%
Simplified71.8%
add-sqr-sqrt71.8%
sqrt-div71.8%
unpow271.8%
sqrt-prod71.8%
add-sqr-sqrt71.8%
pow271.8%
sqrt-prod35.8%
add-sqr-sqrt48.2%
sqrt-div48.2%
unpow248.2%
sqrt-prod48.2%
add-sqr-sqrt48.2%
pow248.2%
sqrt-prod35.8%
add-sqr-sqrt77.3%
Applied egg-rr77.3%
associate-*r/77.4%
associate-/l*77.4%
frac-times94.2%
Applied egg-rr94.2%
unpow277.3%
sin-mult77.5%
Applied egg-rr94.2%
div-sub77.5%
+-inverses77.5%
cos-077.5%
metadata-eval77.5%
count-277.5%
Simplified94.2%
if 5.79999999999999984e79 < k Initial program 28.2%
Taylor expanded in t around 0 74.3%
times-frac76.2%
Simplified76.2%
add-sqr-sqrt76.2%
sqrt-div76.2%
unpow276.2%
sqrt-prod76.2%
add-sqr-sqrt76.2%
pow276.2%
sqrt-prod38.1%
add-sqr-sqrt62.4%
sqrt-div62.4%
unpow262.4%
sqrt-prod62.5%
add-sqr-sqrt62.6%
pow262.6%
sqrt-prod41.9%
add-sqr-sqrt97.7%
Applied egg-rr97.7%
unpow297.7%
sin-mult97.3%
Applied egg-rr97.3%
div-sub97.3%
+-inverses97.3%
cos-097.3%
metadata-eval97.3%
count-297.3%
Simplified97.3%
Final simplification85.4%
NOTE: l should be positive before calling this function
(FPCore (t l k)
:precision binary64
(if (<= k 0.017)
(/
2.0
(/ (* t (* k (/ k l))) (+ (/ l (pow k 2.0)) (* l -0.16666666666666666))))
(/
2.0
(*
(/ (* t (- 0.5 (/ (cos (* 2.0 k)) 2.0))) (cos k))
(* (/ k l) (/ k l))))))l = abs(l);
double code(double t, double l, double k) {
double tmp;
if (k <= 0.017) {
tmp = 2.0 / ((t * (k * (k / l))) / ((l / pow(k, 2.0)) + (l * -0.16666666666666666)));
} else {
tmp = 2.0 / (((t * (0.5 - (cos((2.0 * k)) / 2.0))) / cos(k)) * ((k / l) * (k / l)));
}
return tmp;
}
NOTE: l 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) :: tmp
if (k <= 0.017d0) then
tmp = 2.0d0 / ((t * (k * (k / l))) / ((l / (k ** 2.0d0)) + (l * (-0.16666666666666666d0))))
else
tmp = 2.0d0 / (((t * (0.5d0 - (cos((2.0d0 * k)) / 2.0d0))) / cos(k)) * ((k / l) * (k / l)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
double tmp;
if (k <= 0.017) {
tmp = 2.0 / ((t * (k * (k / l))) / ((l / Math.pow(k, 2.0)) + (l * -0.16666666666666666)));
} else {
tmp = 2.0 / (((t * (0.5 - (Math.cos((2.0 * k)) / 2.0))) / Math.cos(k)) * ((k / l) * (k / l)));
}
return tmp;
}
l = abs(l) def code(t, l, k): tmp = 0 if k <= 0.017: tmp = 2.0 / ((t * (k * (k / l))) / ((l / math.pow(k, 2.0)) + (l * -0.16666666666666666))) else: tmp = 2.0 / (((t * (0.5 - (math.cos((2.0 * k)) / 2.0))) / math.cos(k)) * ((k / l) * (k / l))) return tmp
l = abs(l) function code(t, l, k) tmp = 0.0 if (k <= 0.017) tmp = Float64(2.0 / Float64(Float64(t * Float64(k * Float64(k / l))) / Float64(Float64(l / (k ^ 2.0)) + Float64(l * -0.16666666666666666)))); else tmp = Float64(2.0 / Float64(Float64(Float64(t * Float64(0.5 - Float64(cos(Float64(2.0 * k)) / 2.0))) / cos(k)) * Float64(Float64(k / l) * Float64(k / l)))); end return tmp end
l = abs(l) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 0.017) tmp = 2.0 / ((t * (k * (k / l))) / ((l / (k ^ 2.0)) + (l * -0.16666666666666666))); else tmp = 2.0 / (((t * (0.5 - (cos((2.0 * k)) / 2.0))) / cos(k)) * ((k / l) * (k / l))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 0.017], N[(2.0 / N[(N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(l / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(t * N[(0.5 - N[(N[Cos[N[(2.0 * k), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[(N[(k / l), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.017:\\
\;\;\;\;\frac{2}{\frac{t \cdot \left(k \cdot \frac{k}{\ell}\right)}{\frac{\ell}{{k}^{2}} + \ell \cdot -0.16666666666666666}}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t \cdot \left(0.5 - \frac{\cos \left(2 \cdot k\right)}{2}\right)}{\cos k} \cdot \left(\frac{k}{\ell} \cdot \frac{k}{\ell}\right)}\\
\end{array}
\end{array}
if k < 0.017000000000000001Initial program 35.2%
Taylor expanded in t around 0 72.7%
times-frac75.6%
Simplified75.6%
add-sqr-sqrt75.6%
sqrt-div75.6%
unpow275.6%
sqrt-prod27.0%
add-sqr-sqrt51.8%
pow251.8%
sqrt-prod24.7%
add-sqr-sqrt48.9%
sqrt-div48.9%
unpow248.9%
sqrt-prod13.8%
add-sqr-sqrt52.4%
pow252.4%
sqrt-prod44.6%
add-sqr-sqrt91.2%
Applied egg-rr91.2%
associate-*r/89.8%
associate-/l*89.8%
frac-times93.2%
Applied egg-rr93.2%
Taylor expanded in k around 0 81.4%
+-commutative81.4%
associate--l+81.4%
distribute-rgt-out--81.4%
metadata-eval81.4%
Simplified81.4%
if 0.017000000000000001 < k Initial program 25.5%
Taylor expanded in t around 0 76.4%
times-frac75.1%
Simplified75.1%
add-sqr-sqrt75.1%
sqrt-div75.1%
unpow275.1%
sqrt-prod75.1%
add-sqr-sqrt75.1%
pow275.1%
sqrt-prod37.5%
add-sqr-sqrt58.8%
sqrt-div58.8%
unpow258.8%
sqrt-prod58.9%
add-sqr-sqrt58.9%
pow258.9%
sqrt-prod40.3%
add-sqr-sqrt92.6%
Applied egg-rr92.6%
unpow292.6%
sin-mult92.3%
Applied egg-rr92.3%
div-sub92.3%
+-inverses92.3%
cos-092.3%
metadata-eval92.3%
count-292.3%
Simplified92.3%
Final simplification84.3%
NOTE: l should be positive before calling this function (FPCore (t l k) :precision binary64 (/ 2.0 (/ (* t (* k (/ k l))) (+ (/ l (pow k 2.0)) (* l -0.16666666666666666)))))
l = abs(l);
double code(double t, double l, double k) {
return 2.0 / ((t * (k * (k / l))) / ((l / pow(k, 2.0)) + (l * -0.16666666666666666)));
}
NOTE: l 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 / ((t * (k * (k / l))) / ((l / (k ** 2.0d0)) + (l * (-0.16666666666666666d0))))
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
return 2.0 / ((t * (k * (k / l))) / ((l / Math.pow(k, 2.0)) + (l * -0.16666666666666666)));
}
l = abs(l) def code(t, l, k): return 2.0 / ((t * (k * (k / l))) / ((l / math.pow(k, 2.0)) + (l * -0.16666666666666666)))
l = abs(l) function code(t, l, k) return Float64(2.0 / Float64(Float64(t * Float64(k * Float64(k / l))) / Float64(Float64(l / (k ^ 2.0)) + Float64(l * -0.16666666666666666)))) end
l = abs(l) function tmp = code(t, l, k) tmp = 2.0 / ((t * (k * (k / l))) / ((l / (k ^ 2.0)) + (l * -0.16666666666666666))); end
NOTE: l should be positive before calling this function code[t_, l_, k_] := N[(2.0 / N[(N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(l / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l = |l|\\
\\
\frac{2}{\frac{t \cdot \left(k \cdot \frac{k}{\ell}\right)}{\frac{\ell}{{k}^{2}} + \ell \cdot -0.16666666666666666}}
\end{array}
Initial program 32.7%
Taylor expanded in t around 0 73.7%
times-frac75.5%
Simplified75.5%
add-sqr-sqrt75.4%
sqrt-div75.5%
unpow275.5%
sqrt-prod39.6%
add-sqr-sqrt57.9%
pow257.9%
sqrt-prod28.1%
add-sqr-sqrt51.5%
sqrt-div51.5%
unpow251.5%
sqrt-prod25.6%
add-sqr-sqrt54.1%
pow254.1%
sqrt-prod43.5%
add-sqr-sqrt91.6%
Applied egg-rr91.6%
associate-*r/89.8%
associate-/l*89.8%
frac-times92.4%
Applied egg-rr92.4%
Taylor expanded in k around 0 75.2%
+-commutative75.2%
associate--l+75.2%
distribute-rgt-out--75.2%
metadata-eval75.2%
Simplified75.2%
Final simplification75.2%
NOTE: l should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= k 4.5e+17) (/ 2.0 (/ (* t (* k (/ k l))) (/ l (pow k 2.0)))) (/ -0.3333333333333333 (* t (* (/ k l) (/ k l))))))
l = abs(l);
double code(double t, double l, double k) {
double tmp;
if (k <= 4.5e+17) {
tmp = 2.0 / ((t * (k * (k / l))) / (l / pow(k, 2.0)));
} else {
tmp = -0.3333333333333333 / (t * ((k / l) * (k / l)));
}
return tmp;
}
NOTE: l 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) :: tmp
if (k <= 4.5d+17) then
tmp = 2.0d0 / ((t * (k * (k / l))) / (l / (k ** 2.0d0)))
else
tmp = (-0.3333333333333333d0) / (t * ((k / l) * (k / l)))
end if
code = tmp
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
double tmp;
if (k <= 4.5e+17) {
tmp = 2.0 / ((t * (k * (k / l))) / (l / Math.pow(k, 2.0)));
} else {
tmp = -0.3333333333333333 / (t * ((k / l) * (k / l)));
}
return tmp;
}
l = abs(l) def code(t, l, k): tmp = 0 if k <= 4.5e+17: tmp = 2.0 / ((t * (k * (k / l))) / (l / math.pow(k, 2.0))) else: tmp = -0.3333333333333333 / (t * ((k / l) * (k / l))) return tmp
l = abs(l) function code(t, l, k) tmp = 0.0 if (k <= 4.5e+17) tmp = Float64(2.0 / Float64(Float64(t * Float64(k * Float64(k / l))) / Float64(l / (k ^ 2.0)))); else tmp = Float64(-0.3333333333333333 / Float64(t * Float64(Float64(k / l) * Float64(k / l)))); end return tmp end
l = abs(l) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 4.5e+17) tmp = 2.0 / ((t * (k * (k / l))) / (l / (k ^ 2.0))); else tmp = -0.3333333333333333 / (t * ((k / l) * (k / l))); end tmp_2 = tmp; end
NOTE: l should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 4.5e+17], N[(2.0 / N[(N[(t * N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l / N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 / N[(t * N[(N[(k / l), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
l = |l|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{2}{\frac{t \cdot \left(k \cdot \frac{k}{\ell}\right)}{\frac{\ell}{{k}^{2}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.3333333333333333}{t \cdot \left(\frac{k}{\ell} \cdot \frac{k}{\ell}\right)}\\
\end{array}
\end{array}
if k < 4.5e17Initial program 34.8%
Taylor expanded in t around 0 72.9%
times-frac75.7%
Simplified75.7%
add-sqr-sqrt75.7%
sqrt-div75.7%
unpow275.7%
sqrt-prod28.3%
add-sqr-sqrt52.6%
pow252.6%
sqrt-prod25.1%
add-sqr-sqrt49.2%
sqrt-div49.2%
unpow249.2%
sqrt-prod15.0%
add-sqr-sqrt52.6%
pow252.6%
sqrt-prod44.5%
add-sqr-sqrt91.0%
Applied egg-rr91.0%
associate-*r/89.5%
associate-/l*89.6%
frac-times93.4%
Applied egg-rr93.4%
Taylor expanded in k around 0 77.7%
if 4.5e17 < k Initial program 26.0%
associate-/r*26.0%
associate-*l/26.0%
associate--l+26.0%
Simplified26.0%
Taylor expanded in k around 0 51.4%
Taylor expanded in k around inf 57.8%
pow257.8%
associate-*r/57.8%
pow257.8%
*-commutative57.8%
Applied egg-rr57.8%
associate-/l*57.8%
*-commutative57.8%
unpow257.8%
associate-/r*60.1%
associate-*l/60.1%
unpow260.1%
associate-*l/60.2%
associate-*l/60.2%
associate-*r/60.4%
unpow260.4%
Simplified60.4%
pow260.4%
Applied egg-rr60.4%
Final simplification73.5%
NOTE: l should be positive before calling this function (FPCore (t l k) :precision binary64 (/ -0.3333333333333333 (* t (* (/ k l) (/ k l)))))
l = abs(l);
double code(double t, double l, double k) {
return -0.3333333333333333 / (t * ((k / l) * (k / l)));
}
NOTE: l 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 = (-0.3333333333333333d0) / (t * ((k / l) * (k / l)))
end function
l = Math.abs(l);
public static double code(double t, double l, double k) {
return -0.3333333333333333 / (t * ((k / l) * (k / l)));
}
l = abs(l) def code(t, l, k): return -0.3333333333333333 / (t * ((k / l) * (k / l)))
l = abs(l) function code(t, l, k) return Float64(-0.3333333333333333 / Float64(t * Float64(Float64(k / l) * Float64(k / l)))) end
l = abs(l) function tmp = code(t, l, k) tmp = -0.3333333333333333 / (t * ((k / l) * (k / l))); end
NOTE: l should be positive before calling this function code[t_, l_, k_] := N[(-0.3333333333333333 / N[(t * N[(N[(k / l), $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
l = |l|\\
\\
\frac{-0.3333333333333333}{t \cdot \left(\frac{k}{\ell} \cdot \frac{k}{\ell}\right)}
\end{array}
Initial program 32.7%
associate-/r*32.7%
associate-*l/32.4%
associate--l+32.4%
Simplified32.4%
Taylor expanded in k around 0 39.2%
Taylor expanded in k around inf 35.0%
pow235.0%
associate-*r/35.0%
pow235.0%
*-commutative35.0%
Applied egg-rr35.0%
associate-/l*35.0%
*-commutative35.0%
unpow235.0%
associate-/r*36.5%
associate-*l/36.8%
unpow236.8%
associate-*l/37.0%
associate-*l/36.9%
associate-*r/37.0%
unpow237.0%
Simplified37.0%
pow237.0%
Applied egg-rr37.0%
Final simplification37.0%
herbie shell --seed 2023309
(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))))