
(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}
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(let* ((t_1 (* k_m (/ 1.0 l))) (t_2 (* l (pow k_m -2.0))))
(if (<= k_m 0.000105)
(* 2.0 (* t_2 (/ t_2 t)))
(/
2.0
(*
(/ t_1 (cos k_m))
(/ t_1 (/ 1.0 (* t (- 0.5 (/ (cos (* 2.0 k_m)) 2.0))))))))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double t_1 = k_m * (1.0 / l);
double t_2 = l * pow(k_m, -2.0);
double tmp;
if (k_m <= 0.000105) {
tmp = 2.0 * (t_2 * (t_2 / t));
} else {
tmp = 2.0 / ((t_1 / cos(k_m)) * (t_1 / (1.0 / (t * (0.5 - (cos((2.0 * k_m)) / 2.0))))));
}
return tmp;
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = k_m * (1.0d0 / l)
t_2 = l * (k_m ** (-2.0d0))
if (k_m <= 0.000105d0) then
tmp = 2.0d0 * (t_2 * (t_2 / t))
else
tmp = 2.0d0 / ((t_1 / cos(k_m)) * (t_1 / (1.0d0 / (t * (0.5d0 - (cos((2.0d0 * k_m)) / 2.0d0))))))
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double t_1 = k_m * (1.0 / l);
double t_2 = l * Math.pow(k_m, -2.0);
double tmp;
if (k_m <= 0.000105) {
tmp = 2.0 * (t_2 * (t_2 / t));
} else {
tmp = 2.0 / ((t_1 / Math.cos(k_m)) * (t_1 / (1.0 / (t * (0.5 - (Math.cos((2.0 * k_m)) / 2.0))))));
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): t_1 = k_m * (1.0 / l) t_2 = l * math.pow(k_m, -2.0) tmp = 0 if k_m <= 0.000105: tmp = 2.0 * (t_2 * (t_2 / t)) else: tmp = 2.0 / ((t_1 / math.cos(k_m)) * (t_1 / (1.0 / (t * (0.5 - (math.cos((2.0 * k_m)) / 2.0)))))) return tmp
k_m = abs(k) function code(t, l, k_m) t_1 = Float64(k_m * Float64(1.0 / l)) t_2 = Float64(l * (k_m ^ -2.0)) tmp = 0.0 if (k_m <= 0.000105) tmp = Float64(2.0 * Float64(t_2 * Float64(t_2 / t))); else tmp = Float64(2.0 / Float64(Float64(t_1 / cos(k_m)) * Float64(t_1 / Float64(1.0 / Float64(t * Float64(0.5 - Float64(cos(Float64(2.0 * k_m)) / 2.0))))))); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) t_1 = k_m * (1.0 / l); t_2 = l * (k_m ^ -2.0); tmp = 0.0; if (k_m <= 0.000105) tmp = 2.0 * (t_2 * (t_2 / t)); else tmp = 2.0 / ((t_1 / cos(k_m)) * (t_1 / (1.0 / (t * (0.5 - (cos((2.0 * k_m)) / 2.0)))))); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := Block[{t$95$1 = N[(k$95$m * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(l * N[Power[k$95$m, -2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k$95$m, 0.000105], N[(2.0 * N[(t$95$2 * N[(t$95$2 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t$95$1 / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[(1.0 / N[(t * N[(0.5 - N[(N[Cos[N[(2.0 * k$95$m), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
t_1 := k_m \cdot \frac{1}{\ell}\\
t_2 := \ell \cdot {k_m}^{-2}\\
\mathbf{if}\;k_m \leq 0.000105:\\
\;\;\;\;2 \cdot \left(t_2 \cdot \frac{t_2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t_1}{\cos k_m} \cdot \frac{t_1}{\frac{1}{t \cdot \left(0.5 - \frac{\cos \left(2 \cdot k_m\right)}{2}\right)}}}\\
\end{array}
\end{array}
if k < 1.05e-4Initial program 34.9%
associate-*l*35.0%
associate-/r*35.0%
sub-neg35.0%
distribute-rgt-in30.6%
unpow230.6%
times-frac22.5%
sqr-neg22.5%
times-frac30.6%
unpow230.6%
distribute-rgt-in35.0%
+-commutative35.0%
associate-+l+38.8%
Simplified38.8%
Taylor expanded in k around 0 58.0%
associate-/r*57.6%
Simplified57.6%
expm1-log1p-u57.5%
expm1-udef55.5%
div-inv55.5%
pow-flip55.5%
metadata-eval55.5%
Applied egg-rr55.5%
expm1-def57.5%
expm1-log1p57.6%
Simplified57.6%
*-un-lft-identity57.6%
rem-cbrt-cube55.9%
unpow1/355.9%
sqr-pow55.9%
times-frac55.9%
pow-pow55.9%
metadata-eval55.9%
metadata-eval55.9%
pow1/255.9%
sqrt-prod55.9%
unpow255.9%
sqrt-prod26.5%
add-sqr-sqrt37.7%
sqrt-pow137.7%
metadata-eval37.7%
Applied egg-rr74.4%
if 1.05e-4 < k Initial program 31.2%
associate-*l*31.2%
associate--l+31.2%
Simplified31.2%
Taylor expanded in t around 0 76.2%
times-frac77.8%
Simplified77.8%
associate-*r/77.7%
div-inv77.7%
pow-flip77.7%
metadata-eval77.7%
Applied egg-rr77.7%
associate-/l*77.7%
Simplified77.7%
add-sqr-sqrt77.7%
div-inv77.8%
times-frac77.7%
sqrt-prod77.7%
unpow277.7%
sqrt-prod77.8%
add-sqr-sqrt77.7%
sqrt-pow166.6%
metadata-eval66.6%
unpow-166.6%
sqrt-prod67.8%
unpow267.8%
sqrt-prod69.3%
add-sqr-sqrt69.4%
sqrt-pow199.0%
metadata-eval99.0%
unpow-199.0%
Applied egg-rr99.0%
unpow299.0%
sin-mult98.9%
Applied egg-rr98.9%
div-sub98.9%
+-inverses98.9%
cos-098.9%
metadata-eval98.9%
count-298.9%
*-commutative98.9%
Simplified98.9%
Final simplification81.3%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (/ 2.0 (* (/ (* k_m (/ 1.0 l)) (cos k_m)) (* (pow (sin k_m) 2.0) (* t (/ k_m l))))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return 2.0 / (((k_m * (1.0 / l)) / cos(k_m)) * (pow(sin(k_m), 2.0) * (t * (k_m / l))));
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = 2.0d0 / (((k_m * (1.0d0 / l)) / cos(k_m)) * ((sin(k_m) ** 2.0d0) * (t * (k_m / l))))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return 2.0 / (((k_m * (1.0 / l)) / Math.cos(k_m)) * (Math.pow(Math.sin(k_m), 2.0) * (t * (k_m / l))));
}
k_m = math.fabs(k) def code(t, l, k_m): return 2.0 / (((k_m * (1.0 / l)) / math.cos(k_m)) * (math.pow(math.sin(k_m), 2.0) * (t * (k_m / l))))
k_m = abs(k) function code(t, l, k_m) return Float64(2.0 / Float64(Float64(Float64(k_m * Float64(1.0 / l)) / cos(k_m)) * Float64((sin(k_m) ^ 2.0) * Float64(t * Float64(k_m / l))))) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = 2.0 / (((k_m * (1.0 / l)) / cos(k_m)) * ((sin(k_m) ^ 2.0) * (t * (k_m / l)))); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(2.0 / N[(N[(N[(k$95$m * N[(1.0 / l), $MachinePrecision]), $MachinePrecision] / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision] * N[(t * N[(k$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\frac{2}{\frac{k_m \cdot \frac{1}{\ell}}{\cos k_m} \cdot \left({\sin k_m}^{2} \cdot \left(t \cdot \frac{k_m}{\ell}\right)\right)}
\end{array}
Initial program 33.9%
associate-*l*33.9%
associate--l+33.9%
Simplified33.9%
Taylor expanded in t around 0 70.8%
times-frac73.8%
Simplified73.8%
associate-*r/73.7%
div-inv73.4%
pow-flip73.4%
metadata-eval73.4%
Applied egg-rr73.4%
associate-/l*73.4%
Simplified73.4%
add-sqr-sqrt73.4%
div-inv73.4%
times-frac73.4%
sqrt-prod73.4%
unpow273.4%
sqrt-prod41.8%
add-sqr-sqrt56.7%
sqrt-pow151.6%
metadata-eval51.6%
unpow-151.6%
sqrt-prod52.0%
unpow252.0%
sqrt-prod28.5%
add-sqr-sqrt53.5%
sqrt-pow197.6%
metadata-eval97.6%
unpow-197.6%
Applied egg-rr97.6%
Taylor expanded in k around inf 93.4%
associate-*l/97.7%
*-commutative97.7%
*-commutative97.7%
associate-*l*98.0%
Simplified98.0%
Final simplification98.0%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (/ 2.0 (* (/ (/ k_m l) (cos k_m)) (* (/ k_m l) (* (pow (sin k_m) 2.0) t)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return 2.0 / (((k_m / l) / cos(k_m)) * ((k_m / l) * (pow(sin(k_m), 2.0) * t)));
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = 2.0d0 / (((k_m / l) / cos(k_m)) * ((k_m / l) * ((sin(k_m) ** 2.0d0) * t)))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return 2.0 / (((k_m / l) / Math.cos(k_m)) * ((k_m / l) * (Math.pow(Math.sin(k_m), 2.0) * t)));
}
k_m = math.fabs(k) def code(t, l, k_m): return 2.0 / (((k_m / l) / math.cos(k_m)) * ((k_m / l) * (math.pow(math.sin(k_m), 2.0) * t)))
k_m = abs(k) function code(t, l, k_m) return Float64(2.0 / Float64(Float64(Float64(k_m / l) / cos(k_m)) * Float64(Float64(k_m / l) * Float64((sin(k_m) ^ 2.0) * t)))) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = 2.0 / (((k_m / l) / cos(k_m)) * ((k_m / l) * ((sin(k_m) ^ 2.0) * t))); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(2.0 / N[(N[(N[(k$95$m / l), $MachinePrecision] / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[(k$95$m / l), $MachinePrecision] * N[(N[Power[N[Sin[k$95$m], $MachinePrecision], 2.0], $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
\frac{2}{\frac{\frac{k_m}{\ell}}{\cos k_m} \cdot \left(\frac{k_m}{\ell} \cdot \left({\sin k_m}^{2} \cdot t\right)\right)}
\end{array}
Initial program 33.9%
associate-*l*33.9%
associate--l+33.9%
Simplified33.9%
Taylor expanded in t around 0 70.8%
times-frac73.8%
Simplified73.8%
associate-*r/73.7%
div-inv73.4%
pow-flip73.4%
metadata-eval73.4%
Applied egg-rr73.4%
associate-/l*73.4%
Simplified73.4%
add-sqr-sqrt73.4%
pow273.4%
sqrt-prod73.4%
unpow273.4%
sqrt-prod42.2%
add-sqr-sqrt76.5%
sqrt-pow192.1%
metadata-eval92.1%
unpow-192.1%
Applied egg-rr92.1%
unpow292.1%
div-inv92.2%
frac-times97.6%
un-div-inv97.6%
div-inv97.6%
un-div-inv97.6%
inv-pow97.6%
pow-flip97.6%
metadata-eval97.6%
pow197.6%
Applied egg-rr97.6%
Final simplification97.6%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (let* ((t_1 (* k_m (/ 1.0 l)))) (/ 2.0 (* (/ t_1 (cos k_m)) (/ t_1 (/ 1.0 (* t (pow k_m 2.0))))))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double t_1 = k_m * (1.0 / l);
return 2.0 / ((t_1 / cos(k_m)) * (t_1 / (1.0 / (t * pow(k_m, 2.0)))));
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: t_1
t_1 = k_m * (1.0d0 / l)
code = 2.0d0 / ((t_1 / cos(k_m)) * (t_1 / (1.0d0 / (t * (k_m ** 2.0d0)))))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double t_1 = k_m * (1.0 / l);
return 2.0 / ((t_1 / Math.cos(k_m)) * (t_1 / (1.0 / (t * Math.pow(k_m, 2.0)))));
}
k_m = math.fabs(k) def code(t, l, k_m): t_1 = k_m * (1.0 / l) return 2.0 / ((t_1 / math.cos(k_m)) * (t_1 / (1.0 / (t * math.pow(k_m, 2.0)))))
k_m = abs(k) function code(t, l, k_m) t_1 = Float64(k_m * Float64(1.0 / l)) return Float64(2.0 / Float64(Float64(t_1 / cos(k_m)) * Float64(t_1 / Float64(1.0 / Float64(t * (k_m ^ 2.0)))))) end
k_m = abs(k); function tmp = code(t, l, k_m) t_1 = k_m * (1.0 / l); tmp = 2.0 / ((t_1 / cos(k_m)) * (t_1 / (1.0 / (t * (k_m ^ 2.0))))); end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := Block[{t$95$1 = N[(k$95$m * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]}, N[(2.0 / N[(N[(t$95$1 / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[(1.0 / N[(t * N[Power[k$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
t_1 := k_m \cdot \frac{1}{\ell}\\
\frac{2}{\frac{t_1}{\cos k_m} \cdot \frac{t_1}{\frac{1}{t \cdot {k_m}^{2}}}}
\end{array}
\end{array}
Initial program 33.9%
associate-*l*33.9%
associate--l+33.9%
Simplified33.9%
Taylor expanded in t around 0 70.8%
times-frac73.8%
Simplified73.8%
associate-*r/73.7%
div-inv73.4%
pow-flip73.4%
metadata-eval73.4%
Applied egg-rr73.4%
associate-/l*73.4%
Simplified73.4%
add-sqr-sqrt73.4%
div-inv73.4%
times-frac73.4%
sqrt-prod73.4%
unpow273.4%
sqrt-prod41.8%
add-sqr-sqrt56.7%
sqrt-pow151.6%
metadata-eval51.6%
unpow-151.6%
sqrt-prod52.0%
unpow252.0%
sqrt-prod28.5%
add-sqr-sqrt53.5%
sqrt-pow197.6%
metadata-eval97.6%
unpow-197.6%
Applied egg-rr97.6%
Taylor expanded in k around 0 70.8%
Final simplification70.8%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(let* ((t_1 (* l (pow k_m -2.0))))
(if (<= k_m 1.15)
(* 2.0 (* t_1 (/ t_1 t)))
(/ 2.0 (* (/ (* k_m (/ 1.0 l)) (cos k_m)) (* t (/ (pow k_m 3.0) l)))))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double t_1 = l * pow(k_m, -2.0);
double tmp;
if (k_m <= 1.15) {
tmp = 2.0 * (t_1 * (t_1 / t));
} else {
tmp = 2.0 / (((k_m * (1.0 / l)) / cos(k_m)) * (t * (pow(k_m, 3.0) / l)));
}
return tmp;
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: t_1
real(8) :: tmp
t_1 = l * (k_m ** (-2.0d0))
if (k_m <= 1.15d0) then
tmp = 2.0d0 * (t_1 * (t_1 / t))
else
tmp = 2.0d0 / (((k_m * (1.0d0 / l)) / cos(k_m)) * (t * ((k_m ** 3.0d0) / l)))
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double t_1 = l * Math.pow(k_m, -2.0);
double tmp;
if (k_m <= 1.15) {
tmp = 2.0 * (t_1 * (t_1 / t));
} else {
tmp = 2.0 / (((k_m * (1.0 / l)) / Math.cos(k_m)) * (t * (Math.pow(k_m, 3.0) / l)));
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): t_1 = l * math.pow(k_m, -2.0) tmp = 0 if k_m <= 1.15: tmp = 2.0 * (t_1 * (t_1 / t)) else: tmp = 2.0 / (((k_m * (1.0 / l)) / math.cos(k_m)) * (t * (math.pow(k_m, 3.0) / l))) return tmp
k_m = abs(k) function code(t, l, k_m) t_1 = Float64(l * (k_m ^ -2.0)) tmp = 0.0 if (k_m <= 1.15) tmp = Float64(2.0 * Float64(t_1 * Float64(t_1 / t))); else tmp = Float64(2.0 / Float64(Float64(Float64(k_m * Float64(1.0 / l)) / cos(k_m)) * Float64(t * Float64((k_m ^ 3.0) / l)))); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) t_1 = l * (k_m ^ -2.0); tmp = 0.0; if (k_m <= 1.15) tmp = 2.0 * (t_1 * (t_1 / t)); else tmp = 2.0 / (((k_m * (1.0 / l)) / cos(k_m)) * (t * ((k_m ^ 3.0) / l))); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := Block[{t$95$1 = N[(l * N[Power[k$95$m, -2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k$95$m, 1.15], N[(2.0 * N[(t$95$1 * N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k$95$m * N[(1.0 / l), $MachinePrecision]), $MachinePrecision] / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(t * N[(N[Power[k$95$m, 3.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
t_1 := \ell \cdot {k_m}^{-2}\\
\mathbf{if}\;k_m \leq 1.15:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \frac{t_1}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{k_m \cdot \frac{1}{\ell}}{\cos k_m} \cdot \left(t \cdot \frac{{k_m}^{3}}{\ell}\right)}\\
\end{array}
\end{array}
if k < 1.1499999999999999Initial program 34.9%
associate-*l*35.0%
associate-/r*35.0%
sub-neg35.0%
distribute-rgt-in30.6%
unpow230.6%
times-frac22.5%
sqr-neg22.5%
times-frac30.6%
unpow230.6%
distribute-rgt-in35.0%
+-commutative35.0%
associate-+l+38.8%
Simplified38.8%
Taylor expanded in k around 0 58.0%
associate-/r*57.6%
Simplified57.6%
expm1-log1p-u57.5%
expm1-udef55.5%
div-inv55.5%
pow-flip55.5%
metadata-eval55.5%
Applied egg-rr55.5%
expm1-def57.5%
expm1-log1p57.6%
Simplified57.6%
*-un-lft-identity57.6%
rem-cbrt-cube55.9%
unpow1/355.9%
sqr-pow55.9%
times-frac55.9%
pow-pow55.9%
metadata-eval55.9%
metadata-eval55.9%
pow1/255.9%
sqrt-prod55.9%
unpow255.9%
sqrt-prod26.5%
add-sqr-sqrt37.7%
sqrt-pow137.7%
metadata-eval37.7%
Applied egg-rr74.4%
if 1.1499999999999999 < k Initial program 31.2%
associate-*l*31.2%
associate--l+31.2%
Simplified31.2%
Taylor expanded in t around 0 76.2%
times-frac77.8%
Simplified77.8%
associate-*r/77.7%
div-inv77.7%
pow-flip77.7%
metadata-eval77.7%
Applied egg-rr77.7%
associate-/l*77.7%
Simplified77.7%
add-sqr-sqrt77.7%
div-inv77.8%
times-frac77.7%
sqrt-prod77.7%
unpow277.7%
sqrt-prod77.8%
add-sqr-sqrt77.7%
sqrt-pow166.6%
metadata-eval66.6%
unpow-166.6%
sqrt-prod67.8%
unpow267.8%
sqrt-prod69.3%
add-sqr-sqrt69.4%
sqrt-pow199.0%
metadata-eval99.0%
unpow-199.0%
Applied egg-rr99.0%
Taylor expanded in k around 0 62.4%
associate-/l*64.8%
associate-/r/62.4%
Simplified62.4%
Final simplification71.0%
k_m = (fabs.f64 k)
(FPCore (t l k_m)
:precision binary64
(let* ((t_1 (* l (pow k_m -2.0))))
(if (<= k_m 1.25)
(* 2.0 (* t_1 (/ t_1 t)))
(/ 2.0 (* (/ (* k_m (/ 1.0 l)) (cos k_m)) (/ (pow k_m 3.0) (/ l t)))))))k_m = fabs(k);
double code(double t, double l, double k_m) {
double t_1 = l * pow(k_m, -2.0);
double tmp;
if (k_m <= 1.25) {
tmp = 2.0 * (t_1 * (t_1 / t));
} else {
tmp = 2.0 / (((k_m * (1.0 / l)) / cos(k_m)) * (pow(k_m, 3.0) / (l / t)));
}
return tmp;
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: t_1
real(8) :: tmp
t_1 = l * (k_m ** (-2.0d0))
if (k_m <= 1.25d0) then
tmp = 2.0d0 * (t_1 * (t_1 / t))
else
tmp = 2.0d0 / (((k_m * (1.0d0 / l)) / cos(k_m)) * ((k_m ** 3.0d0) / (l / t)))
end if
code = tmp
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double t_1 = l * Math.pow(k_m, -2.0);
double tmp;
if (k_m <= 1.25) {
tmp = 2.0 * (t_1 * (t_1 / t));
} else {
tmp = 2.0 / (((k_m * (1.0 / l)) / Math.cos(k_m)) * (Math.pow(k_m, 3.0) / (l / t)));
}
return tmp;
}
k_m = math.fabs(k) def code(t, l, k_m): t_1 = l * math.pow(k_m, -2.0) tmp = 0 if k_m <= 1.25: tmp = 2.0 * (t_1 * (t_1 / t)) else: tmp = 2.0 / (((k_m * (1.0 / l)) / math.cos(k_m)) * (math.pow(k_m, 3.0) / (l / t))) return tmp
k_m = abs(k) function code(t, l, k_m) t_1 = Float64(l * (k_m ^ -2.0)) tmp = 0.0 if (k_m <= 1.25) tmp = Float64(2.0 * Float64(t_1 * Float64(t_1 / t))); else tmp = Float64(2.0 / Float64(Float64(Float64(k_m * Float64(1.0 / l)) / cos(k_m)) * Float64((k_m ^ 3.0) / Float64(l / t)))); end return tmp end
k_m = abs(k); function tmp_2 = code(t, l, k_m) t_1 = l * (k_m ^ -2.0); tmp = 0.0; if (k_m <= 1.25) tmp = 2.0 * (t_1 * (t_1 / t)); else tmp = 2.0 / (((k_m * (1.0 / l)) / cos(k_m)) * ((k_m ^ 3.0) / (l / t))); end tmp_2 = tmp; end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := Block[{t$95$1 = N[(l * N[Power[k$95$m, -2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k$95$m, 1.25], N[(2.0 * N[(t$95$1 * N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(N[(k$95$m * N[(1.0 / l), $MachinePrecision]), $MachinePrecision] / N[Cos[k$95$m], $MachinePrecision]), $MachinePrecision] * N[(N[Power[k$95$m, 3.0], $MachinePrecision] / N[(l / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
t_1 := \ell \cdot {k_m}^{-2}\\
\mathbf{if}\;k_m \leq 1.25:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \frac{t_1}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{k_m \cdot \frac{1}{\ell}}{\cos k_m} \cdot \frac{{k_m}^{3}}{\frac{\ell}{t}}}\\
\end{array}
\end{array}
if k < 1.25Initial program 34.9%
associate-*l*35.0%
associate-/r*35.0%
sub-neg35.0%
distribute-rgt-in30.6%
unpow230.6%
times-frac22.5%
sqr-neg22.5%
times-frac30.6%
unpow230.6%
distribute-rgt-in35.0%
+-commutative35.0%
associate-+l+38.8%
Simplified38.8%
Taylor expanded in k around 0 58.0%
associate-/r*57.6%
Simplified57.6%
expm1-log1p-u57.5%
expm1-udef55.5%
div-inv55.5%
pow-flip55.5%
metadata-eval55.5%
Applied egg-rr55.5%
expm1-def57.5%
expm1-log1p57.6%
Simplified57.6%
*-un-lft-identity57.6%
rem-cbrt-cube55.9%
unpow1/355.9%
sqr-pow55.9%
times-frac55.9%
pow-pow55.9%
metadata-eval55.9%
metadata-eval55.9%
pow1/255.9%
sqrt-prod55.9%
unpow255.9%
sqrt-prod26.5%
add-sqr-sqrt37.7%
sqrt-pow137.7%
metadata-eval37.7%
Applied egg-rr74.4%
if 1.25 < k Initial program 31.2%
associate-*l*31.2%
associate--l+31.2%
Simplified31.2%
Taylor expanded in t around 0 76.2%
times-frac77.8%
Simplified77.8%
associate-*r/77.7%
div-inv77.7%
pow-flip77.7%
metadata-eval77.7%
Applied egg-rr77.7%
associate-/l*77.7%
Simplified77.7%
add-sqr-sqrt77.7%
div-inv77.8%
times-frac77.7%
sqrt-prod77.7%
unpow277.7%
sqrt-prod77.8%
add-sqr-sqrt77.7%
sqrt-pow166.6%
metadata-eval66.6%
unpow-166.6%
sqrt-prod67.8%
unpow267.8%
sqrt-prod69.3%
add-sqr-sqrt69.4%
sqrt-pow199.0%
metadata-eval99.0%
unpow-199.0%
Applied egg-rr99.0%
Taylor expanded in k around 0 62.4%
associate-/l*64.8%
Simplified64.8%
Final simplification71.7%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (let* ((t_1 (* l (pow k_m -2.0)))) (* 2.0 (* t_1 (/ t_1 t)))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
double t_1 = l * pow(k_m, -2.0);
return 2.0 * (t_1 * (t_1 / t));
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
real(8) :: t_1
t_1 = l * (k_m ** (-2.0d0))
code = 2.0d0 * (t_1 * (t_1 / t))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
double t_1 = l * Math.pow(k_m, -2.0);
return 2.0 * (t_1 * (t_1 / t));
}
k_m = math.fabs(k) def code(t, l, k_m): t_1 = l * math.pow(k_m, -2.0) return 2.0 * (t_1 * (t_1 / t))
k_m = abs(k) function code(t, l, k_m) t_1 = Float64(l * (k_m ^ -2.0)) return Float64(2.0 * Float64(t_1 * Float64(t_1 / t))) end
k_m = abs(k); function tmp = code(t, l, k_m) t_1 = l * (k_m ^ -2.0); tmp = 2.0 * (t_1 * (t_1 / t)); end
k_m = N[Abs[k], $MachinePrecision]
code[t_, l_, k$95$m_] := Block[{t$95$1 = N[(l * N[Power[k$95$m, -2.0], $MachinePrecision]), $MachinePrecision]}, N[(2.0 * N[(t$95$1 * N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k_m = \left|k\right|
\\
\begin{array}{l}
t_1 := \ell \cdot {k_m}^{-2}\\
2 \cdot \left(t_1 \cdot \frac{t_1}{t}\right)
\end{array}
\end{array}
Initial program 33.9%
associate-*l*33.9%
associate-/r*33.9%
sub-neg33.9%
distribute-rgt-in30.8%
unpow230.8%
times-frac22.6%
sqr-neg22.6%
times-frac30.8%
unpow230.8%
distribute-rgt-in33.9%
+-commutative33.9%
associate-+l+39.4%
Simplified39.4%
Taylor expanded in k around 0 57.4%
associate-/r*57.1%
Simplified57.1%
expm1-log1p-u57.1%
expm1-udef55.6%
div-inv55.6%
pow-flip55.7%
metadata-eval55.7%
Applied egg-rr55.7%
expm1-def57.1%
expm1-log1p57.2%
Simplified57.2%
*-un-lft-identity57.2%
rem-cbrt-cube56.0%
unpow1/356.0%
sqr-pow56.0%
times-frac56.0%
pow-pow56.0%
metadata-eval56.0%
metadata-eval56.0%
pow1/256.0%
sqrt-prod56.0%
unpow256.0%
sqrt-prod25.5%
add-sqr-sqrt43.6%
sqrt-pow143.6%
metadata-eval43.6%
Applied egg-rr69.5%
Final simplification69.5%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* 2.0 (* (pow k_m -4.0) (/ (pow l 2.0) t))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return 2.0 * (pow(k_m, -4.0) * (pow(l, 2.0) / t));
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = 2.0d0 * ((k_m ** (-4.0d0)) * ((l ** 2.0d0) / t))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return 2.0 * (Math.pow(k_m, -4.0) * (Math.pow(l, 2.0) / t));
}
k_m = math.fabs(k) def code(t, l, k_m): return 2.0 * (math.pow(k_m, -4.0) * (math.pow(l, 2.0) / t))
k_m = abs(k) function code(t, l, k_m) return Float64(2.0 * Float64((k_m ^ -4.0) * Float64((l ^ 2.0) / t))) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = 2.0 * ((k_m ^ -4.0) * ((l ^ 2.0) / t)); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(2.0 * N[(N[Power[k$95$m, -4.0], $MachinePrecision] * N[(N[Power[l, 2.0], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
2 \cdot \left({k_m}^{-4} \cdot \frac{{\ell}^{2}}{t}\right)
\end{array}
Initial program 33.9%
associate-*l*33.9%
associate-/r*33.9%
sub-neg33.9%
distribute-rgt-in30.8%
unpow230.8%
times-frac22.6%
sqr-neg22.6%
times-frac30.8%
unpow230.8%
distribute-rgt-in33.9%
+-commutative33.9%
associate-+l+39.4%
Simplified39.4%
Taylor expanded in k around 0 57.4%
associate-/r*57.1%
Simplified57.1%
expm1-log1p-u57.1%
expm1-udef55.6%
div-inv55.6%
pow-flip55.7%
metadata-eval55.7%
Applied egg-rr55.7%
expm1-def57.1%
expm1-log1p57.2%
Simplified57.2%
expm1-log1p-u40.5%
expm1-udef39.5%
associate-/l*39.8%
Applied egg-rr39.8%
expm1-def40.8%
expm1-log1p57.5%
associate-/r/56.7%
*-commutative56.7%
Simplified56.7%
Final simplification56.7%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* 2.0 (* (pow l 2.0) (/ (pow k_m -4.0) t))))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return 2.0 * (pow(l, 2.0) * (pow(k_m, -4.0) / t));
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = 2.0d0 * ((l ** 2.0d0) * ((k_m ** (-4.0d0)) / t))
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return 2.0 * (Math.pow(l, 2.0) * (Math.pow(k_m, -4.0) / t));
}
k_m = math.fabs(k) def code(t, l, k_m): return 2.0 * (math.pow(l, 2.0) * (math.pow(k_m, -4.0) / t))
k_m = abs(k) function code(t, l, k_m) return Float64(2.0 * Float64((l ^ 2.0) * Float64((k_m ^ -4.0) / t))) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = 2.0 * ((l ^ 2.0) * ((k_m ^ -4.0) / t)); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(2.0 * N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[Power[k$95$m, -4.0], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
2 \cdot \left({\ell}^{2} \cdot \frac{{k_m}^{-4}}{t}\right)
\end{array}
Initial program 33.9%
associate-*l*33.9%
associate-/r*33.9%
sub-neg33.9%
distribute-rgt-in30.8%
unpow230.8%
times-frac22.6%
sqr-neg22.6%
times-frac30.8%
unpow230.8%
distribute-rgt-in33.9%
+-commutative33.9%
associate-+l+39.4%
Simplified39.4%
Taylor expanded in k around 0 57.4%
associate-/r*57.1%
Simplified57.1%
expm1-log1p-u57.1%
expm1-udef55.6%
div-inv55.6%
pow-flip55.7%
metadata-eval55.7%
Applied egg-rr55.7%
expm1-def57.1%
expm1-log1p57.2%
Simplified57.2%
expm1-log1p-u40.5%
expm1-udef39.5%
associate-/l*39.8%
Applied egg-rr39.8%
expm1-def40.8%
expm1-log1p57.5%
associate-/l*57.2%
associate-*r/57.5%
Simplified57.5%
Final simplification57.5%
k_m = (fabs.f64 k) (FPCore (t l k_m) :precision binary64 (* 2.0 (/ (pow (* l (pow k_m -2.0)) 2.0) t)))
k_m = fabs(k);
double code(double t, double l, double k_m) {
return 2.0 * (pow((l * pow(k_m, -2.0)), 2.0) / t);
}
k_m = abs(k)
real(8) function code(t, l, k_m)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k_m
code = 2.0d0 * (((l * (k_m ** (-2.0d0))) ** 2.0d0) / t)
end function
k_m = Math.abs(k);
public static double code(double t, double l, double k_m) {
return 2.0 * (Math.pow((l * Math.pow(k_m, -2.0)), 2.0) / t);
}
k_m = math.fabs(k) def code(t, l, k_m): return 2.0 * (math.pow((l * math.pow(k_m, -2.0)), 2.0) / t)
k_m = abs(k) function code(t, l, k_m) return Float64(2.0 * Float64((Float64(l * (k_m ^ -2.0)) ^ 2.0) / t)) end
k_m = abs(k); function tmp = code(t, l, k_m) tmp = 2.0 * (((l * (k_m ^ -2.0)) ^ 2.0) / t); end
k_m = N[Abs[k], $MachinePrecision] code[t_, l_, k$95$m_] := N[(2.0 * N[(N[Power[N[(l * N[Power[k$95$m, -2.0], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k_m = \left|k\right|
\\
2 \cdot \frac{{\left(\ell \cdot {k_m}^{-2}\right)}^{2}}{t}
\end{array}
Initial program 33.9%
associate-*l*33.9%
associate-/r*33.9%
sub-neg33.9%
distribute-rgt-in30.8%
unpow230.8%
times-frac22.6%
sqr-neg22.6%
times-frac30.8%
unpow230.8%
distribute-rgt-in33.9%
+-commutative33.9%
associate-+l+39.4%
Simplified39.4%
Taylor expanded in k around 0 57.4%
associate-/r*57.1%
Simplified57.1%
expm1-log1p-u57.1%
expm1-udef55.6%
div-inv55.6%
pow-flip55.7%
metadata-eval55.7%
Applied egg-rr55.7%
expm1-def57.1%
expm1-log1p57.2%
Simplified57.2%
rem-cbrt-cube56.0%
unpow1/356.0%
sqr-pow56.0%
pow256.0%
pow-pow57.2%
metadata-eval57.2%
metadata-eval57.2%
pow1/257.2%
sqrt-prod57.2%
unpow257.2%
sqrt-prod30.3%
add-sqr-sqrt63.8%
sqrt-pow167.6%
metadata-eval67.6%
Applied egg-rr67.6%
Final simplification67.6%
herbie shell --seed 2024020
(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))))