
(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 13 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}
(FPCore (t l k) :precision binary64 (* (/ (/ l k) (sin k)) (* (/ 2.0 t) (/ (cos k) (* k (/ (sin k) l))))))
double code(double t, double l, double k) {
return ((l / k) / sin(k)) * ((2.0 / t) * (cos(k) / (k * (sin(k) / l))));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = ((l / k) / sin(k)) * ((2.0d0 / t) * (cos(k) / (k * (sin(k) / l))))
end function
public static double code(double t, double l, double k) {
return ((l / k) / Math.sin(k)) * ((2.0 / t) * (Math.cos(k) / (k * (Math.sin(k) / l))));
}
def code(t, l, k): return ((l / k) / math.sin(k)) * ((2.0 / t) * (math.cos(k) / (k * (math.sin(k) / l))))
function code(t, l, k) return Float64(Float64(Float64(l / k) / sin(k)) * Float64(Float64(2.0 / t) * Float64(cos(k) / Float64(k * Float64(sin(k) / l))))) end
function tmp = code(t, l, k) tmp = ((l / k) / sin(k)) * ((2.0 / t) * (cos(k) / (k * (sin(k) / l)))); end
code[t_, l_, k_] := N[(N[(N[(l / k), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 / t), $MachinePrecision] * N[(N[Cos[k], $MachinePrecision] / N[(k * N[(N[Sin[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\ell}{k}}{\sin k} \cdot \left(\frac{2}{t} \cdot \frac{\cos k}{k \cdot \frac{\sin k}{\ell}}\right)
\end{array}
Initial program 36.4%
Applied egg-rr14.6%
mul0-rgt28.0%
+-rgt-identity28.0%
associate-*r*28.0%
Simplified28.0%
Taylor expanded in k around inf 47.4%
associate-/l*47.7%
Simplified47.7%
*-un-lft-identity47.7%
*-commutative47.7%
unpow-prod-down45.9%
pow245.9%
add-sqr-sqrt94.3%
associate-*r/94.1%
Applied egg-rr94.1%
*-lft-identity94.1%
associate-/r*94.1%
associate-/r/94.1%
associate-/l*94.3%
Simplified94.3%
*-un-lft-identity94.3%
unpow294.3%
times-frac99.6%
associate-*r/98.6%
clear-num98.6%
Applied egg-rr98.6%
associate-/r*99.7%
associate-/l*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (t l k) :precision binary64 (if (<= k 1.25e-12) (* 2.0 (pow (* k (* (/ k l) (sqrt t))) -2.0)) (* (* (/ 2.0 t) (cos k)) (pow (* k (/ (sin k) l)) -2.0))))
double code(double t, double l, double k) {
double tmp;
if (k <= 1.25e-12) {
tmp = 2.0 * pow((k * ((k / l) * sqrt(t))), -2.0);
} else {
tmp = ((2.0 / t) * cos(k)) * pow((k * (sin(k) / l)), -2.0);
}
return tmp;
}
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 <= 1.25d-12) then
tmp = 2.0d0 * ((k * ((k / l) * sqrt(t))) ** (-2.0d0))
else
tmp = ((2.0d0 / t) * cos(k)) * ((k * (sin(k) / l)) ** (-2.0d0))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 1.25e-12) {
tmp = 2.0 * Math.pow((k * ((k / l) * Math.sqrt(t))), -2.0);
} else {
tmp = ((2.0 / t) * Math.cos(k)) * Math.pow((k * (Math.sin(k) / l)), -2.0);
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 1.25e-12: tmp = 2.0 * math.pow((k * ((k / l) * math.sqrt(t))), -2.0) else: tmp = ((2.0 / t) * math.cos(k)) * math.pow((k * (math.sin(k) / l)), -2.0) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 1.25e-12) tmp = Float64(2.0 * (Float64(k * Float64(Float64(k / l) * sqrt(t))) ^ -2.0)); else tmp = Float64(Float64(Float64(2.0 / t) * cos(k)) * (Float64(k * Float64(sin(k) / l)) ^ -2.0)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.25e-12) tmp = 2.0 * ((k * ((k / l) * sqrt(t))) ^ -2.0); else tmp = ((2.0 / t) * cos(k)) * ((k * (sin(k) / l)) ^ -2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 1.25e-12], N[(2.0 * N[Power[N[(k * N[(N[(k / l), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / t), $MachinePrecision] * N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[Power[N[(k * N[(N[Sin[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.25 \cdot 10^{-12}:\\
\;\;\;\;2 \cdot {\left(k \cdot \left(\frac{k}{\ell} \cdot \sqrt{t}\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{2}{t} \cdot \cos k\right) \cdot {\left(k \cdot \frac{\sin k}{\ell}\right)}^{-2}\\
\end{array}
\end{array}
if k < 1.24999999999999992e-12Initial program 38.1%
Applied egg-rr17.2%
mul0-rgt33.6%
+-rgt-identity33.6%
associate-*r*33.6%
Simplified33.6%
Taylor expanded in k around inf 49.3%
associate-/l*49.8%
Simplified49.8%
div-inv49.8%
pow-flip50.1%
associate-*l*49.7%
metadata-eval49.7%
Applied egg-rr49.7%
Taylor expanded in k around 0 44.8%
if 1.24999999999999992e-12 < k Initial program 31.9%
Applied egg-rr7.4%
mul0-rgt12.0%
+-rgt-identity12.0%
associate-*r*12.0%
Simplified12.0%
Taylor expanded in k around inf 42.0%
associate-/l*41.9%
Simplified41.9%
*-un-lft-identity41.9%
*-commutative41.9%
unpow-prod-down40.5%
pow240.5%
add-sqr-sqrt93.9%
associate-*r/94.0%
Applied egg-rr94.0%
*-lft-identity94.0%
associate-/r*94.0%
associate-/r/93.9%
associate-/l*93.9%
Simplified93.9%
div-inv91.3%
pow-flip92.3%
metadata-eval92.3%
Applied egg-rr92.3%
Final simplification57.3%
(FPCore (t l k) :precision binary64 (if (<= k 1.12e-12) (* 2.0 (pow (* k (* (/ k l) (sqrt t))) -2.0)) (/ 2.0 (* t (/ (pow (* k (/ (sin k) l)) 2.0) (cos k))))))
double code(double t, double l, double k) {
double tmp;
if (k <= 1.12e-12) {
tmp = 2.0 * pow((k * ((k / l) * sqrt(t))), -2.0);
} else {
tmp = 2.0 / (t * (pow((k * (sin(k) / l)), 2.0) / cos(k)));
}
return tmp;
}
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 <= 1.12d-12) then
tmp = 2.0d0 * ((k * ((k / l) * sqrt(t))) ** (-2.0d0))
else
tmp = 2.0d0 / (t * (((k * (sin(k) / l)) ** 2.0d0) / cos(k)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 1.12e-12) {
tmp = 2.0 * Math.pow((k * ((k / l) * Math.sqrt(t))), -2.0);
} else {
tmp = 2.0 / (t * (Math.pow((k * (Math.sin(k) / l)), 2.0) / Math.cos(k)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 1.12e-12: tmp = 2.0 * math.pow((k * ((k / l) * math.sqrt(t))), -2.0) else: tmp = 2.0 / (t * (math.pow((k * (math.sin(k) / l)), 2.0) / math.cos(k))) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 1.12e-12) tmp = Float64(2.0 * (Float64(k * Float64(Float64(k / l) * sqrt(t))) ^ -2.0)); else tmp = Float64(2.0 / Float64(t * Float64((Float64(k * Float64(sin(k) / l)) ^ 2.0) / cos(k)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.12e-12) tmp = 2.0 * ((k * ((k / l) * sqrt(t))) ^ -2.0); else tmp = 2.0 / (t * (((k * (sin(k) / l)) ^ 2.0) / cos(k))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 1.12e-12], N[(2.0 * N[Power[N[(k * N[(N[(k / l), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(t * N[(N[Power[N[(k * N[(N[Sin[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.12 \cdot 10^{-12}:\\
\;\;\;\;2 \cdot {\left(k \cdot \left(\frac{k}{\ell} \cdot \sqrt{t}\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot \frac{{\left(k \cdot \frac{\sin k}{\ell}\right)}^{2}}{\cos k}}\\
\end{array}
\end{array}
if k < 1.1200000000000001e-12Initial program 38.1%
Applied egg-rr17.2%
mul0-rgt33.6%
+-rgt-identity33.6%
associate-*r*33.6%
Simplified33.6%
Taylor expanded in k around inf 49.3%
associate-/l*49.8%
Simplified49.8%
div-inv49.8%
pow-flip50.1%
associate-*l*49.7%
metadata-eval49.7%
Applied egg-rr49.7%
Taylor expanded in k around 0 44.8%
if 1.1200000000000001e-12 < k Initial program 31.9%
Applied egg-rr7.4%
mul0-rgt12.0%
+-rgt-identity12.0%
associate-*r*12.0%
Simplified12.0%
Taylor expanded in k around inf 42.0%
associate-/l*41.9%
Simplified41.9%
*-un-lft-identity41.9%
*-commutative41.9%
unpow-prod-down40.5%
pow240.5%
add-sqr-sqrt93.9%
associate-*r/94.0%
Applied egg-rr94.0%
*-lft-identity94.0%
associate-/r*94.0%
associate-/r/93.9%
associate-/l*93.9%
Simplified93.9%
associate-*l/94.0%
*-un-lft-identity94.0%
times-frac94.0%
metadata-eval94.0%
clear-num94.0%
div-inv94.0%
associate-*r/94.0%
associate-/r*94.0%
clear-num94.0%
inv-pow94.0%
div-inv94.0%
*-commutative94.0%
associate-*r/93.9%
metadata-eval93.9%
Applied egg-rr93.9%
unpow-193.9%
*-commutative93.9%
associate-/r*93.9%
metadata-eval93.9%
associate-*r/94.0%
*-commutative94.0%
associate-/l*93.9%
Simplified93.9%
Final simplification57.7%
(FPCore (t l k) :precision binary64 (if (<= k 6.2e-13) (* 2.0 (pow (* k (* (/ k l) (sqrt t))) -2.0)) (/ 2.0 (* (/ t (cos k)) (pow (* k (/ (sin k) l)) 2.0)))))
double code(double t, double l, double k) {
double tmp;
if (k <= 6.2e-13) {
tmp = 2.0 * pow((k * ((k / l) * sqrt(t))), -2.0);
} else {
tmp = 2.0 / ((t / cos(k)) * pow((k * (sin(k) / l)), 2.0));
}
return tmp;
}
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 <= 6.2d-13) then
tmp = 2.0d0 * ((k * ((k / l) * sqrt(t))) ** (-2.0d0))
else
tmp = 2.0d0 / ((t / cos(k)) * ((k * (sin(k) / l)) ** 2.0d0))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 6.2e-13) {
tmp = 2.0 * Math.pow((k * ((k / l) * Math.sqrt(t))), -2.0);
} else {
tmp = 2.0 / ((t / Math.cos(k)) * Math.pow((k * (Math.sin(k) / l)), 2.0));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 6.2e-13: tmp = 2.0 * math.pow((k * ((k / l) * math.sqrt(t))), -2.0) else: tmp = 2.0 / ((t / math.cos(k)) * math.pow((k * (math.sin(k) / l)), 2.0)) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 6.2e-13) tmp = Float64(2.0 * (Float64(k * Float64(Float64(k / l) * sqrt(t))) ^ -2.0)); else tmp = Float64(2.0 / Float64(Float64(t / cos(k)) * (Float64(k * Float64(sin(k) / l)) ^ 2.0))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 6.2e-13) tmp = 2.0 * ((k * ((k / l) * sqrt(t))) ^ -2.0); else tmp = 2.0 / ((t / cos(k)) * ((k * (sin(k) / l)) ^ 2.0)); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 6.2e-13], N[(2.0 * N[Power[N[(k * N[(N[(k / l), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[Power[N[(k * N[(N[Sin[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.2 \cdot 10^{-13}:\\
\;\;\;\;2 \cdot {\left(k \cdot \left(\frac{k}{\ell} \cdot \sqrt{t}\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t}{\cos k} \cdot {\left(k \cdot \frac{\sin k}{\ell}\right)}^{2}}\\
\end{array}
\end{array}
if k < 6.1999999999999998e-13Initial program 38.1%
Applied egg-rr17.2%
mul0-rgt33.6%
+-rgt-identity33.6%
associate-*r*33.6%
Simplified33.6%
Taylor expanded in k around inf 49.3%
associate-/l*49.8%
Simplified49.8%
div-inv49.8%
pow-flip50.1%
associate-*l*49.7%
metadata-eval49.7%
Applied egg-rr49.7%
Taylor expanded in k around 0 44.8%
if 6.1999999999999998e-13 < k Initial program 31.9%
Applied egg-rr7.4%
mul0-rgt12.0%
+-rgt-identity12.0%
associate-*r*12.0%
Simplified12.0%
Taylor expanded in k around inf 42.0%
associate-/l*41.9%
Simplified41.9%
*-un-lft-identity41.9%
*-commutative41.9%
unpow-prod-down40.5%
pow240.5%
add-sqr-sqrt93.9%
associate-*r/94.0%
Applied egg-rr94.0%
*-lft-identity94.0%
associate-/l*93.9%
Simplified93.9%
Final simplification57.7%
(FPCore (t l k) :precision binary64 (if (<= k 1.4e-12) (* 2.0 (pow (* k (* (/ k l) (sqrt t))) -2.0)) (/ 2.0 (* (/ t (cos k)) (pow (/ (* k (sin k)) l) 2.0)))))
double code(double t, double l, double k) {
double tmp;
if (k <= 1.4e-12) {
tmp = 2.0 * pow((k * ((k / l) * sqrt(t))), -2.0);
} else {
tmp = 2.0 / ((t / cos(k)) * pow(((k * sin(k)) / l), 2.0));
}
return tmp;
}
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 <= 1.4d-12) then
tmp = 2.0d0 * ((k * ((k / l) * sqrt(t))) ** (-2.0d0))
else
tmp = 2.0d0 / ((t / cos(k)) * (((k * sin(k)) / l) ** 2.0d0))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 1.4e-12) {
tmp = 2.0 * Math.pow((k * ((k / l) * Math.sqrt(t))), -2.0);
} else {
tmp = 2.0 / ((t / Math.cos(k)) * Math.pow(((k * Math.sin(k)) / l), 2.0));
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 1.4e-12: tmp = 2.0 * math.pow((k * ((k / l) * math.sqrt(t))), -2.0) else: tmp = 2.0 / ((t / math.cos(k)) * math.pow(((k * math.sin(k)) / l), 2.0)) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 1.4e-12) tmp = Float64(2.0 * (Float64(k * Float64(Float64(k / l) * sqrt(t))) ^ -2.0)); else tmp = Float64(2.0 / Float64(Float64(t / cos(k)) * (Float64(Float64(k * sin(k)) / l) ^ 2.0))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.4e-12) tmp = 2.0 * ((k * ((k / l) * sqrt(t))) ^ -2.0); else tmp = 2.0 / ((t / cos(k)) * (((k * sin(k)) / l) ^ 2.0)); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 1.4e-12], N[(2.0 * N[Power[N[(k * N[(N[(k / l), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(k * N[Sin[k], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.4 \cdot 10^{-12}:\\
\;\;\;\;2 \cdot {\left(k \cdot \left(\frac{k}{\ell} \cdot \sqrt{t}\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t}{\cos k} \cdot {\left(\frac{k \cdot \sin k}{\ell}\right)}^{2}}\\
\end{array}
\end{array}
if k < 1.4000000000000001e-12Initial program 38.1%
Applied egg-rr17.2%
mul0-rgt33.6%
+-rgt-identity33.6%
associate-*r*33.6%
Simplified33.6%
Taylor expanded in k around inf 49.3%
associate-/l*49.8%
Simplified49.8%
div-inv49.8%
pow-flip50.1%
associate-*l*49.7%
metadata-eval49.7%
Applied egg-rr49.7%
Taylor expanded in k around 0 44.8%
if 1.4000000000000001e-12 < k Initial program 31.9%
Applied egg-rr7.4%
mul0-rgt12.0%
+-rgt-identity12.0%
associate-*r*12.0%
Simplified12.0%
Taylor expanded in k around inf 42.0%
associate-/l*41.9%
Simplified41.9%
unpow-prod-down40.5%
associate-*r/40.5%
pow240.5%
add-sqr-sqrt94.0%
Applied egg-rr94.0%
Final simplification57.7%
(FPCore (t l k) :precision binary64 (if (<= k 1.35e-12) (* 2.0 (pow (* k (* (/ k l) (sqrt t))) -2.0)) (/ (* (/ 2.0 t) (cos k)) (pow (* k (/ (sin k) l)) 2.0))))
double code(double t, double l, double k) {
double tmp;
if (k <= 1.35e-12) {
tmp = 2.0 * pow((k * ((k / l) * sqrt(t))), -2.0);
} else {
tmp = ((2.0 / t) * cos(k)) / pow((k * (sin(k) / l)), 2.0);
}
return tmp;
}
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 <= 1.35d-12) then
tmp = 2.0d0 * ((k * ((k / l) * sqrt(t))) ** (-2.0d0))
else
tmp = ((2.0d0 / t) * cos(k)) / ((k * (sin(k) / l)) ** 2.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 1.35e-12) {
tmp = 2.0 * Math.pow((k * ((k / l) * Math.sqrt(t))), -2.0);
} else {
tmp = ((2.0 / t) * Math.cos(k)) / Math.pow((k * (Math.sin(k) / l)), 2.0);
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 1.35e-12: tmp = 2.0 * math.pow((k * ((k / l) * math.sqrt(t))), -2.0) else: tmp = ((2.0 / t) * math.cos(k)) / math.pow((k * (math.sin(k) / l)), 2.0) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 1.35e-12) tmp = Float64(2.0 * (Float64(k * Float64(Float64(k / l) * sqrt(t))) ^ -2.0)); else tmp = Float64(Float64(Float64(2.0 / t) * cos(k)) / (Float64(k * Float64(sin(k) / l)) ^ 2.0)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.35e-12) tmp = 2.0 * ((k * ((k / l) * sqrt(t))) ^ -2.0); else tmp = ((2.0 / t) * cos(k)) / ((k * (sin(k) / l)) ^ 2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 1.35e-12], N[(2.0 * N[Power[N[(k * N[(N[(k / l), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / t), $MachinePrecision] * N[Cos[k], $MachinePrecision]), $MachinePrecision] / N[Power[N[(k * N[(N[Sin[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.35 \cdot 10^{-12}:\\
\;\;\;\;2 \cdot {\left(k \cdot \left(\frac{k}{\ell} \cdot \sqrt{t}\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{t} \cdot \cos k}{{\left(k \cdot \frac{\sin k}{\ell}\right)}^{2}}\\
\end{array}
\end{array}
if k < 1.3499999999999999e-12Initial program 38.1%
Applied egg-rr17.2%
mul0-rgt33.6%
+-rgt-identity33.6%
associate-*r*33.6%
Simplified33.6%
Taylor expanded in k around inf 49.3%
associate-/l*49.8%
Simplified49.8%
div-inv49.8%
pow-flip50.1%
associate-*l*49.7%
metadata-eval49.7%
Applied egg-rr49.7%
Taylor expanded in k around 0 44.8%
if 1.3499999999999999e-12 < k Initial program 31.9%
Applied egg-rr7.4%
mul0-rgt12.0%
+-rgt-identity12.0%
associate-*r*12.0%
Simplified12.0%
Taylor expanded in k around inf 42.0%
associate-/l*41.9%
Simplified41.9%
*-un-lft-identity41.9%
*-commutative41.9%
unpow-prod-down40.5%
pow240.5%
add-sqr-sqrt93.9%
associate-*r/94.0%
Applied egg-rr94.0%
*-lft-identity94.0%
associate-/r*94.0%
associate-/r/93.9%
associate-/l*93.9%
Simplified93.9%
Final simplification57.7%
(FPCore (t l k) :precision binary64 (if (<= k 1.12e-12) (* 2.0 (pow (* k (* (/ k l) (sqrt t))) -2.0)) (/ (/ 2.0 (/ t (cos k))) (pow (* k (/ (sin k) l)) 2.0))))
double code(double t, double l, double k) {
double tmp;
if (k <= 1.12e-12) {
tmp = 2.0 * pow((k * ((k / l) * sqrt(t))), -2.0);
} else {
tmp = (2.0 / (t / cos(k))) / pow((k * (sin(k) / l)), 2.0);
}
return tmp;
}
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 <= 1.12d-12) then
tmp = 2.0d0 * ((k * ((k / l) * sqrt(t))) ** (-2.0d0))
else
tmp = (2.0d0 / (t / cos(k))) / ((k * (sin(k) / l)) ** 2.0d0)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 1.12e-12) {
tmp = 2.0 * Math.pow((k * ((k / l) * Math.sqrt(t))), -2.0);
} else {
tmp = (2.0 / (t / Math.cos(k))) / Math.pow((k * (Math.sin(k) / l)), 2.0);
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 1.12e-12: tmp = 2.0 * math.pow((k * ((k / l) * math.sqrt(t))), -2.0) else: tmp = (2.0 / (t / math.cos(k))) / math.pow((k * (math.sin(k) / l)), 2.0) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 1.12e-12) tmp = Float64(2.0 * (Float64(k * Float64(Float64(k / l) * sqrt(t))) ^ -2.0)); else tmp = Float64(Float64(2.0 / Float64(t / cos(k))) / (Float64(k * Float64(sin(k) / l)) ^ 2.0)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 1.12e-12) tmp = 2.0 * ((k * ((k / l) * sqrt(t))) ^ -2.0); else tmp = (2.0 / (t / cos(k))) / ((k * (sin(k) / l)) ^ 2.0); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 1.12e-12], N[(2.0 * N[Power[N[(k * N[(N[(k / l), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(t / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(k * N[(N[Sin[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.12 \cdot 10^{-12}:\\
\;\;\;\;2 \cdot {\left(k \cdot \left(\frac{k}{\ell} \cdot \sqrt{t}\right)\right)}^{-2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{\frac{t}{\cos k}}}{{\left(k \cdot \frac{\sin k}{\ell}\right)}^{2}}\\
\end{array}
\end{array}
if k < 1.1200000000000001e-12Initial program 38.1%
Applied egg-rr17.2%
mul0-rgt33.6%
+-rgt-identity33.6%
associate-*r*33.6%
Simplified33.6%
Taylor expanded in k around inf 49.3%
associate-/l*49.8%
Simplified49.8%
div-inv49.8%
pow-flip50.1%
associate-*l*49.7%
metadata-eval49.7%
Applied egg-rr49.7%
Taylor expanded in k around 0 44.8%
if 1.1200000000000001e-12 < k Initial program 31.9%
Applied egg-rr7.4%
mul0-rgt12.0%
+-rgt-identity12.0%
associate-*r*12.0%
Simplified12.0%
Taylor expanded in k around inf 42.0%
associate-/l*41.9%
Simplified41.9%
*-un-lft-identity41.9%
*-commutative41.9%
unpow-prod-down40.5%
pow240.5%
add-sqr-sqrt93.9%
associate-*r/94.0%
Applied egg-rr94.0%
*-lft-identity94.0%
associate-/r*94.0%
associate-/r/93.9%
associate-/l*93.9%
Simplified93.9%
associate-*l/94.0%
*-un-lft-identity94.0%
times-frac94.0%
metadata-eval94.0%
clear-num94.0%
div-inv94.0%
Applied egg-rr94.0%
Final simplification57.7%
(FPCore (t l k) :precision binary64 (let* ((t_1 (* k (/ (sin k) l)))) (* (/ (cos k) t_1) (/ (/ 2.0 t) t_1))))
double code(double t, double l, double k) {
double t_1 = k * (sin(k) / l);
return (cos(k) / t_1) * ((2.0 / t) / t_1);
}
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
t_1 = k * (sin(k) / l)
code = (cos(k) / t_1) * ((2.0d0 / t) / t_1)
end function
public static double code(double t, double l, double k) {
double t_1 = k * (Math.sin(k) / l);
return (Math.cos(k) / t_1) * ((2.0 / t) / t_1);
}
def code(t, l, k): t_1 = k * (math.sin(k) / l) return (math.cos(k) / t_1) * ((2.0 / t) / t_1)
function code(t, l, k) t_1 = Float64(k * Float64(sin(k) / l)) return Float64(Float64(cos(k) / t_1) * Float64(Float64(2.0 / t) / t_1)) end
function tmp = code(t, l, k) t_1 = k * (sin(k) / l); tmp = (cos(k) / t_1) * ((2.0 / t) / t_1); end
code[t_, l_, k_] := Block[{t$95$1 = N[(k * N[(N[Sin[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Cos[k], $MachinePrecision] / t$95$1), $MachinePrecision] * N[(N[(2.0 / t), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := k \cdot \frac{\sin k}{\ell}\\
\frac{\cos k}{t\_1} \cdot \frac{\frac{2}{t}}{t\_1}
\end{array}
\end{array}
Initial program 36.4%
Applied egg-rr14.6%
mul0-rgt28.0%
+-rgt-identity28.0%
associate-*r*28.0%
Simplified28.0%
Taylor expanded in k around inf 47.4%
associate-/l*47.7%
Simplified47.7%
*-un-lft-identity47.7%
*-commutative47.7%
unpow-prod-down45.9%
pow245.9%
add-sqr-sqrt94.3%
associate-*r/94.1%
Applied egg-rr94.1%
*-lft-identity94.1%
associate-/r*94.1%
associate-/r/94.1%
associate-/l*94.3%
Simplified94.3%
unpow294.3%
times-frac99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (t l k) :precision binary64 (* 2.0 (pow (* k (* k (/ (sqrt t) l))) -2.0)))
double code(double t, double l, double k) {
return 2.0 * pow((k * (k * (sqrt(t) / l))), -2.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 * ((k * (k * (sqrt(t) / l))) ** (-2.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 * Math.pow((k * (k * (Math.sqrt(t) / l))), -2.0);
}
def code(t, l, k): return 2.0 * math.pow((k * (k * (math.sqrt(t) / l))), -2.0)
function code(t, l, k) return Float64(2.0 * (Float64(k * Float64(k * Float64(sqrt(t) / l))) ^ -2.0)) end
function tmp = code(t, l, k) tmp = 2.0 * ((k * (k * (sqrt(t) / l))) ^ -2.0); end
code[t_, l_, k_] := N[(2.0 * N[Power[N[(k * N[(k * N[(N[Sqrt[t], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot {\left(k \cdot \left(k \cdot \frac{\sqrt{t}}{\ell}\right)\right)}^{-2}
\end{array}
Initial program 36.4%
Applied egg-rr14.6%
mul0-rgt28.0%
+-rgt-identity28.0%
associate-*r*28.0%
Simplified28.0%
Taylor expanded in k around inf 47.4%
associate-/l*47.7%
Simplified47.7%
div-inv47.7%
pow-flip48.2%
associate-*l*47.9%
metadata-eval47.9%
Applied egg-rr47.9%
Taylor expanded in k around 0 40.3%
associate-*l/40.3%
associate-*r/39.1%
Simplified39.1%
Final simplification39.1%
(FPCore (t l k) :precision binary64 (* 2.0 (pow (* k (* (/ k l) (sqrt t))) -2.0)))
double code(double t, double l, double k) {
return 2.0 * pow((k * ((k / l) * sqrt(t))), -2.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 * ((k * ((k / l) * sqrt(t))) ** (-2.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 * Math.pow((k * ((k / l) * Math.sqrt(t))), -2.0);
}
def code(t, l, k): return 2.0 * math.pow((k * ((k / l) * math.sqrt(t))), -2.0)
function code(t, l, k) return Float64(2.0 * (Float64(k * Float64(Float64(k / l) * sqrt(t))) ^ -2.0)) end
function tmp = code(t, l, k) tmp = 2.0 * ((k * ((k / l) * sqrt(t))) ^ -2.0); end
code[t_, l_, k_] := N[(2.0 * N[Power[N[(k * N[(N[(k / l), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot {\left(k \cdot \left(\frac{k}{\ell} \cdot \sqrt{t}\right)\right)}^{-2}
\end{array}
Initial program 36.4%
Applied egg-rr14.6%
mul0-rgt28.0%
+-rgt-identity28.0%
associate-*r*28.0%
Simplified28.0%
Taylor expanded in k around inf 47.4%
associate-/l*47.7%
Simplified47.7%
div-inv47.7%
pow-flip48.2%
associate-*l*47.9%
metadata-eval47.9%
Applied egg-rr47.9%
Taylor expanded in k around 0 40.3%
Final simplification40.3%
(FPCore (t l k) :precision binary64 (/ (* (* 2.0 (pow k -4.0)) (pow l 2.0)) t))
double code(double t, double l, double k) {
return ((2.0 * pow(k, -4.0)) * pow(l, 2.0)) / t;
}
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 * (k ** (-4.0d0))) * (l ** 2.0d0)) / t
end function
public static double code(double t, double l, double k) {
return ((2.0 * Math.pow(k, -4.0)) * Math.pow(l, 2.0)) / t;
}
def code(t, l, k): return ((2.0 * math.pow(k, -4.0)) * math.pow(l, 2.0)) / t
function code(t, l, k) return Float64(Float64(Float64(2.0 * (k ^ -4.0)) * (l ^ 2.0)) / t) end
function tmp = code(t, l, k) tmp = ((2.0 * (k ^ -4.0)) * (l ^ 2.0)) / t; end
code[t_, l_, k_] := N[(N[(N[(2.0 * N[Power[k, -4.0], $MachinePrecision]), $MachinePrecision] * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(2 \cdot {k}^{-4}\right) \cdot {\ell}^{2}}{t}
\end{array}
Initial program 36.4%
Simplified47.1%
Taylor expanded in k around 0 64.6%
associate-/r*64.6%
Simplified64.6%
associate-*l/65.1%
div-inv65.1%
pow-flip65.5%
metadata-eval65.5%
pow265.5%
Applied egg-rr65.5%
Final simplification65.5%
(FPCore (t l k) :precision binary64 (* (/ 1.0 (/ t (* 2.0 (pow k -4.0)))) (* l l)))
double code(double t, double l, double k) {
return (1.0 / (t / (2.0 * pow(k, -4.0)))) * (l * l);
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (1.0d0 / (t / (2.0d0 * (k ** (-4.0d0))))) * (l * l)
end function
public static double code(double t, double l, double k) {
return (1.0 / (t / (2.0 * Math.pow(k, -4.0)))) * (l * l);
}
def code(t, l, k): return (1.0 / (t / (2.0 * math.pow(k, -4.0)))) * (l * l)
function code(t, l, k) return Float64(Float64(1.0 / Float64(t / Float64(2.0 * (k ^ -4.0)))) * Float64(l * l)) end
function tmp = code(t, l, k) tmp = (1.0 / (t / (2.0 * (k ^ -4.0)))) * (l * l); end
code[t_, l_, k_] := N[(N[(1.0 / N[(t / N[(2.0 * N[Power[k, -4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(l * l), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{t}{2 \cdot {k}^{-4}}} \cdot \left(\ell \cdot \ell\right)
\end{array}
Initial program 36.4%
Simplified47.1%
Taylor expanded in k around 0 64.6%
associate-/r*64.6%
Simplified64.6%
div-inv64.6%
div-inv64.6%
pow-flip65.0%
metadata-eval65.0%
Applied egg-rr65.0%
associate-*r/65.0%
*-rgt-identity65.0%
*-commutative65.0%
associate-/l*65.0%
Simplified65.0%
associate-*r/65.0%
clear-num65.0%
Applied egg-rr65.0%
Final simplification65.0%
(FPCore (t l k) :precision binary64 (* (* l l) (* (/ 2.0 t) (pow k -4.0))))
double code(double t, double l, double k) {
return (l * l) * ((2.0 / t) * pow(k, -4.0));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = (l * l) * ((2.0d0 / t) * (k ** (-4.0d0)))
end function
public static double code(double t, double l, double k) {
return (l * l) * ((2.0 / t) * Math.pow(k, -4.0));
}
def code(t, l, k): return (l * l) * ((2.0 / t) * math.pow(k, -4.0))
function code(t, l, k) return Float64(Float64(l * l) * Float64(Float64(2.0 / t) * (k ^ -4.0))) end
function tmp = code(t, l, k) tmp = (l * l) * ((2.0 / t) * (k ^ -4.0)); end
code[t_, l_, k_] := N[(N[(l * l), $MachinePrecision] * N[(N[(2.0 / t), $MachinePrecision] * N[Power[k, -4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\ell \cdot \ell\right) \cdot \left(\frac{2}{t} \cdot {k}^{-4}\right)
\end{array}
Initial program 36.4%
Simplified47.1%
Taylor expanded in k around 0 64.6%
associate-/r*64.6%
Simplified64.6%
div-inv64.6%
div-inv64.6%
pow-flip65.0%
metadata-eval65.0%
Applied egg-rr65.0%
associate-*r/65.0%
*-rgt-identity65.0%
*-commutative65.0%
associate-/l*65.0%
Simplified65.0%
Final simplification65.0%
herbie shell --seed 2024054
(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))))