
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U) :precision binary64 (+ (* (* J (log1p (expm1 (* l 2.0)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * log1p(expm1((l * 2.0)))) * cos((K / 2.0))) + U;
}
public static double code(double J, double l, double K, double U) {
return ((J * Math.log1p(Math.expm1((l * 2.0)))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * math.log1p(math.expm1((l * 2.0)))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * log1p(expm1(Float64(l * 2.0)))) * cos(Float64(K / 2.0))) + U) end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[Log[1 + N[(Exp[N[(l * 2.0), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Initial program 87.6%
Taylor expanded in l around 0 62.4%
*-commutative62.4%
associate-*l*62.4%
Simplified62.4%
log1p-expm1-u99.6%
Applied egg-rr99.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* 0.3333333333333333 (* l l))))))))
(t_1 (+ U (* J (- (exp l) (exp (- l)))))))
(if (<= l -2.5e+124)
t_0
(if (<= l -0.000108)
t_1
(if (<= l 2.8e-11)
(+ U (* (* J (cos (* K 0.5))) (* l 2.0)))
(if (<= l 5.3e+88) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
double t_1 = U + (J * (exp(l) - exp(-l)));
double tmp;
if (l <= -2.5e+124) {
tmp = t_0;
} else if (l <= -0.000108) {
tmp = t_1;
} else if (l <= 2.8e-11) {
tmp = U + ((J * cos((K * 0.5))) * (l * 2.0));
} else if (l <= 5.3e+88) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
t_1 = u + (j * (exp(l) - exp(-l)))
if (l <= (-2.5d+124)) then
tmp = t_0
else if (l <= (-0.000108d0)) then
tmp = t_1
else if (l <= 2.8d-11) then
tmp = u + ((j * cos((k * 0.5d0))) * (l * 2.0d0))
else if (l <= 5.3d+88) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
double t_1 = U + (J * (Math.exp(l) - Math.exp(-l)));
double tmp;
if (l <= -2.5e+124) {
tmp = t_0;
} else if (l <= -0.000108) {
tmp = t_1;
} else if (l <= 2.8e-11) {
tmp = U + ((J * Math.cos((K * 0.5))) * (l * 2.0));
} else if (l <= 5.3e+88) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) t_1 = U + (J * (math.exp(l) - math.exp(-l))) tmp = 0 if l <= -2.5e+124: tmp = t_0 elif l <= -0.000108: tmp = t_1 elif l <= 2.8e-11: tmp = U + ((J * math.cos((K * 0.5))) * (l * 2.0)) elif l <= 5.3e+88: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))) t_1 = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))) tmp = 0.0 if (l <= -2.5e+124) tmp = t_0; elseif (l <= -0.000108) tmp = t_1; elseif (l <= 2.8e-11) tmp = Float64(U + Float64(Float64(J * cos(Float64(K * 0.5))) * Float64(l * 2.0))); elseif (l <= 5.3e+88) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); t_1 = U + (J * (exp(l) - exp(-l))); tmp = 0.0; if (l <= -2.5e+124) tmp = t_0; elseif (l <= -0.000108) tmp = t_1; elseif (l <= 2.8e-11) tmp = U + ((J * cos((K * 0.5))) * (l * 2.0)); elseif (l <= 5.3e+88) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.5e+124], t$95$0, If[LessEqual[l, -0.000108], t$95$1, If[LessEqual[l, 2.8e-11], N[(U + N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.3e+88], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
t_1 := U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+124}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.000108:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 2.8 \cdot 10^{-11}:\\
\;\;\;\;U + \left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \left(\ell \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 5.3 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -2.4999999999999998e124 or 5.29999999999999987e88 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
unpow2100.0%
Applied egg-rr100.0%
if -2.4999999999999998e124 < l < -1.08e-4 or 2.8e-11 < l < 5.29999999999999987e88Initial program 100.0%
Taylor expanded in K around 0 86.9%
if -1.08e-4 < l < 2.8e-11Initial program 72.4%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification97.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= l -3.5)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (<= l 2.8e-11)
(+ U (* (* J (cos (* K 0.5))) (* l 2.0)))
(if (<= l 5.3e+88)
(+ U (* J (- (exp l) t_0)))
(+ U (* t_1 (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l))))))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -3.5) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 2.8e-11) {
tmp = U + ((J * cos((K * 0.5))) * (l * 2.0));
} else if (l <= 5.3e+88) {
tmp = U + (J * (exp(l) - t_0));
} else {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-3.5d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if (l <= 2.8d-11) then
tmp = u + ((j * cos((k * 0.5d0))) * (l * 2.0d0))
else if (l <= 5.3d+88) then
tmp = u + (j * (exp(l) - t_0))
else
tmp = u + (t_1 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -3.5) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 2.8e-11) {
tmp = U + ((J * Math.cos((K * 0.5))) * (l * 2.0));
} else if (l <= 5.3e+88) {
tmp = U + (J * (Math.exp(l) - t_0));
} else {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -3.5: tmp = U + (t_1 * (J * (27.0 - t_0))) elif l <= 2.8e-11: tmp = U + ((J * math.cos((K * 0.5))) * (l * 2.0)) elif l <= 5.3e+88: tmp = U + (J * (math.exp(l) - t_0)) else: tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -3.5) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif (l <= 2.8e-11) tmp = Float64(U + Float64(Float64(J * cos(Float64(K * 0.5))) * Float64(l * 2.0))); elseif (l <= 5.3e+88) tmp = Float64(U + Float64(J * Float64(exp(l) - t_0))); else tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -3.5) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif (l <= 2.8e-11) tmp = U + ((J * cos((K * 0.5))) * (l * 2.0)); elseif (l <= 5.3e+88) tmp = U + (J * (exp(l) - t_0)); else tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.5], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.8e-11], N[(U + N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.3e+88], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -3.5:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 2.8 \cdot 10^{-11}:\\
\;\;\;\;U + \left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \left(\ell \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 5.3 \cdot 10^{+88}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\end{array}
\end{array}
if l < -3.5Initial program 100.0%
Applied egg-rr100.0%
if -3.5 < l < 2.8e-11Initial program 72.4%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if 2.8e-11 < l < 5.29999999999999987e88Initial program 100.0%
Taylor expanded in K around 0 83.3%
if 5.29999999999999987e88 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
unpow2100.0%
Applied egg-rr100.0%
Final simplification98.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.75) (* U (+ 1.0 (* 2.0 (* J (/ (* l (cos (* K 0.5))) U))))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.75) {
tmp = U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / U))));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.75d0) then
tmp = u * (1.0d0 + (2.0d0 * (j * ((l * cos((k * 0.5d0))) / u))))
else
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.75) {
tmp = U * (1.0 + (2.0 * (J * ((l * Math.cos((K * 0.5))) / U))));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.75: tmp = U * (1.0 + (2.0 * (J * ((l * math.cos((K * 0.5))) / U)))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.75) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(Float64(l * cos(Float64(K * 0.5))) / U))))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.75) tmp = U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / U)))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.75], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.75:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell \cdot \cos \left(K \cdot 0.5\right)}{U}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.75Initial program 85.6%
Taylor expanded in l around 0 65.9%
*-commutative65.9%
associate-*l*65.9%
Simplified65.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in U around inf 68.2%
associate-*r*68.2%
*-commutative68.2%
associate-*r/68.2%
associate-*r*68.2%
*-commutative68.2%
Simplified68.2%
Taylor expanded in J around 0 68.2%
associate-/l*74.1%
*-commutative74.1%
Simplified74.1%
if 0.75 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.5%
Taylor expanded in l around 0 90.1%
Taylor expanded in K around 0 89.7%
Final simplification84.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (+ U (* J (* 2.0 (* l (cos (* K 0.5)))))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = U + (J * (2.0 * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.05d0)) then
tmp = u + (j * (2.0d0 * (l * cos((k * 0.5d0)))))
else
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.05) {
tmp = U + (J * (2.0 * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.05: tmp = U + (J * (2.0 * (l * math.cos((K * 0.5))))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = Float64(U + Float64(J * Float64(2.0 * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.05) tmp = U + (J * (2.0 * (l * cos((K * 0.5))))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(U + N[(J * N[(2.0 * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;U + J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 86.7%
Taylor expanded in l around 0 62.5%
*-commutative62.5%
associate-*l*62.5%
*-commutative62.5%
*-commutative62.5%
Simplified62.5%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.7%
Taylor expanded in l around 0 89.5%
Taylor expanded in K around 0 86.4%
Final simplification83.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.54) (+ U (* (* J (cos (* K 0.5))) (* l 2.0))) (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.54) {
tmp = U + ((J * cos((K * 0.5))) * (l * 2.0));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.54d0) then
tmp = u + ((j * cos((k * 0.5d0))) * (l * 2.0d0))
else
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.54) {
tmp = U + ((J * Math.cos((K * 0.5))) * (l * 2.0));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.54: tmp = U + ((J * math.cos((K * 0.5))) * (l * 2.0)) else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.54) tmp = Float64(U + Float64(Float64(J * cos(Float64(K * 0.5))) * Float64(l * 2.0))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.54) tmp = U + ((J * cos((K * 0.5))) * (l * 2.0)); else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.54], N[(U + N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.54:\\
\;\;\;\;U + \left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.54000000000000004Initial program 85.2%
Taylor expanded in l around 0 65.7%
*-commutative65.7%
associate-*l*65.7%
Simplified65.7%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in J around 0 65.7%
associate-*r*65.7%
*-commutative65.7%
*-commutative65.7%
associate-*r*65.7%
*-commutative65.7%
associate-*r*65.7%
*-commutative65.7%
associate-*l*65.7%
Simplified65.7%
if 0.54000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.5%
Taylor expanded in l around 0 61.2%
*-commutative61.2%
associate-*l*61.2%
Simplified61.2%
Taylor expanded in K around 0 60.3%
Taylor expanded in U around inf 67.9%
associate-/l*74.2%
Simplified74.2%
Final simplification71.8%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l))))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)
\end{array}
Initial program 87.6%
Taylor expanded in l around 0 89.5%
unpow289.5%
Applied egg-rr89.5%
Final simplification89.5%
(FPCore (J l K U) :precision binary64 (if (<= K 1.365e+20) (* U (+ 1.0 (* 2.0 (* J (/ l U))))) (+ U (* J (* 2.0 (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 1.365e+20) {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
} else {
tmp = U + (J * (2.0 * (l * cos((K * 0.5)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (k <= 1.365d+20) then
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
else
tmp = u + (j * (2.0d0 * (l * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (K <= 1.365e+20) {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
} else {
tmp = U + (J * (2.0 * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if K <= 1.365e+20: tmp = U * (1.0 + (2.0 * (J * (l / U)))) else: tmp = U + (J * (2.0 * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (K <= 1.365e+20) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); else tmp = Float64(U + Float64(J * Float64(2.0 * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (K <= 1.365e+20) tmp = U * (1.0 + (2.0 * (J * (l / U)))); else tmp = U + (J * (2.0 * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[K, 1.365e+20], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(2.0 * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 1.365 \cdot 10^{+20}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if K < 1.365e20Initial program 86.6%
Taylor expanded in l around 0 60.4%
*-commutative60.4%
associate-*l*60.4%
Simplified60.4%
Taylor expanded in K around 0 55.5%
Taylor expanded in U around inf 62.1%
associate-/l*68.4%
Simplified68.4%
if 1.365e20 < K Initial program 90.8%
Taylor expanded in l around 0 69.2%
*-commutative69.2%
associate-*l*69.2%
*-commutative69.2%
*-commutative69.2%
Simplified69.2%
Final simplification68.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4e+68) (not (<= l 9e+33))) (* J (+ (* l 2.0) (/ U J))) (+ U (* 2.0 (* J l)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4e+68) || !(l <= 9e+33)) {
tmp = J * ((l * 2.0) + (U / J));
} else {
tmp = U + (2.0 * (J * l));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-4d+68)) .or. (.not. (l <= 9d+33))) then
tmp = j * ((l * 2.0d0) + (u / j))
else
tmp = u + (2.0d0 * (j * l))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4e+68) || !(l <= 9e+33)) {
tmp = J * ((l * 2.0) + (U / J));
} else {
tmp = U + (2.0 * (J * l));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4e+68) or not (l <= 9e+33): tmp = J * ((l * 2.0) + (U / J)) else: tmp = U + (2.0 * (J * l)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4e+68) || !(l <= 9e+33)) tmp = Float64(J * Float64(Float64(l * 2.0) + Float64(U / J))); else tmp = Float64(U + Float64(2.0 * Float64(J * l))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -4e+68) || ~((l <= 9e+33))) tmp = J * ((l * 2.0) + (U / J)); else tmp = U + (2.0 * (J * l)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4e+68], N[Not[LessEqual[l, 9e+33]], $MachinePrecision]], N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4 \cdot 10^{+68} \lor \neg \left(\ell \leq 9 \cdot 10^{+33}\right):\\
\;\;\;\;J \cdot \left(\ell \cdot 2 + \frac{U}{J}\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \ell\right)\\
\end{array}
\end{array}
if l < -3.99999999999999981e68 or 9.0000000000000001e33 < l Initial program 100.0%
Taylor expanded in l around 0 33.0%
*-commutative33.0%
associate-*l*33.0%
Simplified33.0%
Taylor expanded in K around 0 26.8%
Taylor expanded in J around inf 35.4%
if -3.99999999999999981e68 < l < 9.0000000000000001e33Initial program 76.8%
Taylor expanded in l around 0 88.0%
*-commutative88.0%
associate-*l*88.0%
Simplified88.0%
Taylor expanded in K around 0 79.4%
Final simplification59.0%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.65e-79) (not (<= l 1.7e+33))) (* l (* J 2.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.65e-79) || !(l <= 1.7e+33)) {
tmp = l * (J * 2.0);
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.65d-79)) .or. (.not. (l <= 1.7d+33))) then
tmp = l * (j * 2.0d0)
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.65e-79) || !(l <= 1.7e+33)) {
tmp = l * (J * 2.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.65e-79) or not (l <= 1.7e+33): tmp = l * (J * 2.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.65e-79) || !(l <= 1.7e+33)) tmp = Float64(l * Float64(J * 2.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.65e-79) || ~((l <= 1.7e+33))) tmp = l * (J * 2.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.65e-79], N[Not[LessEqual[l, 1.7e+33]], $MachinePrecision]], N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.65 \cdot 10^{-79} \lor \neg \left(\ell \leq 1.7 \cdot 10^{+33}\right):\\
\;\;\;\;\ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.6499999999999999e-79 or 1.7e33 < l Initial program 94.6%
Taylor expanded in l around 0 37.3%
*-commutative37.3%
associate-*l*37.3%
Simplified37.3%
Taylor expanded in K around 0 31.0%
Taylor expanded in l around inf 30.3%
Taylor expanded in J around inf 28.7%
if -1.6499999999999999e-79 < l < 1.7e33Initial program 78.6%
Applied egg-rr47.5%
Taylor expanded in U around inf 73.1%
Final simplification48.1%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* 2.0 (* J (/ l U))))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l / U))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u * (1.0d0 + (2.0d0 * (j * (l / u))))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l / U))));
}
def code(J, l, K, U): return U * (1.0 + (2.0 * (J * (l / U))))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (2.0 * (J * (l / U)))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)
\end{array}
Initial program 87.6%
Taylor expanded in l around 0 62.4%
*-commutative62.4%
associate-*l*62.4%
Simplified62.4%
Taylor expanded in K around 0 55.0%
Taylor expanded in U around inf 60.7%
associate-/l*66.0%
Simplified66.0%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J l))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * l));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (j * l))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * l));
}
def code(J, l, K, U): return U + (2.0 * (J * l))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * l))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * l)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \ell\right)
\end{array}
Initial program 87.6%
Taylor expanded in l around 0 62.4%
*-commutative62.4%
associate-*l*62.4%
Simplified62.4%
Taylor expanded in K around 0 55.0%
Final simplification55.0%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 87.6%
Applied egg-rr23.0%
Taylor expanded in U around inf 34.5%
(FPCore (J l K U) :precision binary64 8.0)
double code(double J, double l, double K, double U) {
return 8.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 8.0d0
end function
public static double code(double J, double l, double K, double U) {
return 8.0;
}
def code(J, l, K, U): return 8.0
function code(J, l, K, U) return 8.0 end
function tmp = code(J, l, K, U) tmp = 8.0; end
code[J_, l_, K_, U_] := 8.0
\begin{array}{l}
\\
8
\end{array}
Initial program 87.6%
Applied egg-rr23.1%
Taylor expanded in U around 0 2.8%
(FPCore (J l K U) :precision binary64 -4.0)
double code(double J, double l, double K, double U) {
return -4.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = -4.0d0
end function
public static double code(double J, double l, double K, double U) {
return -4.0;
}
def code(J, l, K, U): return -4.0
function code(J, l, K, U) return -4.0 end
function tmp = code(J, l, K, U) tmp = -4.0; end
code[J_, l_, K_, U_] := -4.0
\begin{array}{l}
\\
-4
\end{array}
Initial program 87.6%
Applied egg-rr23.0%
Taylor expanded in U around 0 2.6%
herbie shell --seed 2024184
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))