
(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 16 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
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 5e-9)))
(* J (* t_0 (cos (* K 0.5))))
(+
U
(*
(* l (+ (* 0.3333333333333333 (* J (pow l 2.0))) (* 2.0 J)))
(cos (/ K 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 5e-9)) {
tmp = J * (t_0 * cos((K * 0.5)));
} else {
tmp = U + ((l * ((0.3333333333333333 * (J * pow(l, 2.0))) + (2.0 * J))) * cos((K / 2.0)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 5e-9)) {
tmp = J * (t_0 * Math.cos((K * 0.5)));
} else {
tmp = U + ((l * ((0.3333333333333333 * (J * Math.pow(l, 2.0))) + (2.0 * J))) * Math.cos((K / 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 5e-9): tmp = J * (t_0 * math.cos((K * 0.5))) else: tmp = U + ((l * ((0.3333333333333333 * (J * math.pow(l, 2.0))) + (2.0 * J))) * math.cos((K / 2.0))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 5e-9)) tmp = Float64(J * Float64(t_0 * cos(Float64(K * 0.5)))); else tmp = Float64(U + Float64(Float64(l * Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 2.0))) + Float64(2.0 * J))) * cos(Float64(K / 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 5e-9))) tmp = J * (t_0 * cos((K * 0.5))); else tmp = U + ((l * ((0.3333333333333333 * (J * (l ^ 2.0))) + (2.0 * J))) * cos((K / 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 5e-9]], $MachinePrecision]], N[(J * N[(t$95$0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(l * N[(N[(0.3333333333333333 * N[(J * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -\infty \lor \neg \left(t\_0 \leq 5 \cdot 10^{-9}\right):\\
\;\;\;\;J \cdot \left(t\_0 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{2}\right) + 2 \cdot J\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 5.0000000000000001e-9 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in J around 0 100.0%
Taylor expanded in J around inf 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 5.0000000000000001e-9Initial program 73.0%
Taylor expanded in l around 0 99.3%
Final simplification99.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.04)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(+ U (* 2.0 (* J (log1p (expm1 l))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.04) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else {
tmp = U + (2.0 * (J * log1p(expm1(l))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= 0.04) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else {
tmp = U + (2.0 * (J * Math.log1p(Math.expm1(l))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.04: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) else: tmp = U + (2.0 * (J * math.log1p(math.expm1(l)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.04) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); else tmp = Float64(U + Float64(2.0 * Float64(J * log1p(expm1(l))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.04], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[Log[1 + N[(Exp[l] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.04:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell\right)\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.0400000000000000008Initial program 85.7%
Taylor expanded in l around 0 89.9%
if 0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.1%
Taylor expanded in l around 0 59.0%
log1p-expm1-u100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 88.0%
expm1-define96.1%
Simplified96.1%
Final simplification94.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.04) (* U (+ 1.0 (* 2.0 (* J (/ (* l (cos (* K 0.5))) U))))) (+ U (* 2.0 (* J (log1p (expm1 l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.04) {
tmp = U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / U))));
} else {
tmp = U + (2.0 * (J * log1p(expm1(l))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.04) {
tmp = U * (1.0 + (2.0 * (J * ((l * Math.cos((K * 0.5))) / U))));
} else {
tmp = U + (2.0 * (J * Math.log1p(Math.expm1(l))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.04: tmp = U * (1.0 + (2.0 * (J * ((l * math.cos((K * 0.5))) / U)))) else: tmp = U + (2.0 * (J * math.log1p(math.expm1(l)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.04) 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(2.0 * Float64(J * log1p(expm1(l))))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.04], 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[(2.0 * N[(J * N[Log[1 + N[(Exp[l] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.04:\\
\;\;\;\;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 + 2 \cdot \left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell\right)\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.0400000000000000008Initial program 85.7%
Taylor expanded in l around 0 66.5%
Taylor expanded in U around inf 70.0%
associate-/l*77.2%
Simplified77.2%
if 0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.1%
Taylor expanded in l around 0 59.0%
log1p-expm1-u100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 88.0%
expm1-define96.1%
Simplified96.1%
Final simplification92.1%
(FPCore (J l K U) :precision binary64 (+ (* 2.0 (* J (log1p (expm1 (* l (cos (* K 0.5))))))) U))
double code(double J, double l, double K, double U) {
return (2.0 * (J * log1p(expm1((l * cos((K * 0.5))))))) + U;
}
public static double code(double J, double l, double K, double U) {
return (2.0 * (J * Math.log1p(Math.expm1((l * Math.cos((K * 0.5))))))) + U;
}
def code(J, l, K, U): return (2.0 * (J * math.log1p(math.expm1((l * math.cos((K * 0.5))))))) + U
function code(J, l, K, U) return Float64(Float64(2.0 * Float64(J * log1p(expm1(Float64(l * cos(Float64(K * 0.5))))))) + U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * N[(J * N[Log[1 + N[(Exp[N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\right) + U
\end{array}
Initial program 87.6%
Taylor expanded in l around 0 60.6%
log1p-expm1-u99.7%
*-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.04) (* U (+ 1.0 (* 2.0 (* J (/ (* l (cos (* K 0.5))) U))))) (* U (+ 1.0 (/ (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))) U)))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.04) {
tmp = U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / U))));
} else {
tmp = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))) / 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.04d0) then
tmp = u * (1.0d0 + (2.0d0 * (j * ((l * cos((k * 0.5d0))) / u))))
else
tmp = u * (1.0d0 + ((j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))) / 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.04) {
tmp = U * (1.0 + (2.0 * (J * ((l * Math.cos((K * 0.5))) / U))));
} else {
tmp = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))) / U));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.04: tmp = U * (1.0 + (2.0 * (J * ((l * math.cos((K * 0.5))) / U)))) else: tmp = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) / U)) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.04) 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(1.0 + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))) / U))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.04) tmp = U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / U)))); else tmp = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))) / U)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.04], 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[(1.0 + N[(N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.04:\\
\;\;\;\;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 \cdot \left(1 + \frac{J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)}{U}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.0400000000000000008Initial program 85.7%
Taylor expanded in l around 0 66.5%
Taylor expanded in U around inf 70.0%
associate-/l*77.2%
Simplified77.2%
if 0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.1%
Taylor expanded in l around 0 88.2%
Taylor expanded in K around 0 84.3%
Taylor expanded in U around inf 85.0%
Final simplification83.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.04) (* 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.04) {
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.04d0) 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.04) {
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.04: 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.04) 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.04) 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.04], 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.04:\\
\;\;\;\;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.0400000000000000008Initial program 85.7%
Taylor expanded in l around 0 66.5%
Taylor expanded in U around inf 70.0%
associate-/l*77.2%
Simplified77.2%
if 0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.1%
Taylor expanded in l around 0 88.2%
Taylor expanded in K around 0 84.3%
Final simplification82.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.04) (+ U (* 2.0 (* J (* 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.04) {
tmp = U + (2.0 * (J * (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.04d0) then
tmp = u + (2.0d0 * (j * (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.04) {
tmp = U + (2.0 * (J * (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.04: tmp = U + (2.0 * (J * (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.04) tmp = Float64(U + Float64(2.0 * Float64(J * 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.04) tmp = U + (2.0 * (J * (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.04], N[(U + N[(2.0 * N[(J * 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.04:\\
\;\;\;\;U + 2 \cdot \left(J \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.0400000000000000008Initial program 85.7%
Taylor expanded in l around 0 66.5%
if 0.0400000000000000008 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.1%
Taylor expanded in l around 0 88.2%
Taylor expanded in K around 0 84.3%
Final simplification80.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (pow l 3.0) (* J 0.3333333333333333))))
(if (<= l -3.9e+129)
t_0
(if (<= l -1.45e+112)
(+ U (* J (+ -0.5 (* (pow K 2.0) 0.0625))))
(if (or (<= l -920000000.0) (not (<= l 2.9e+30)))
t_0
(+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = pow(l, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -3.9e+129) {
tmp = t_0;
} else if (l <= -1.45e+112) {
tmp = U + (J * (-0.5 + (pow(K, 2.0) * 0.0625)));
} else if ((l <= -920000000.0) || !(l <= 2.9e+30)) {
tmp = t_0;
} else {
tmp = U + (2.0 * (J * (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) :: t_0
real(8) :: tmp
t_0 = (l ** 3.0d0) * (j * 0.3333333333333333d0)
if (l <= (-3.9d+129)) then
tmp = t_0
else if (l <= (-1.45d+112)) then
tmp = u + (j * ((-0.5d0) + ((k ** 2.0d0) * 0.0625d0)))
else if ((l <= (-920000000.0d0)) .or. (.not. (l <= 2.9d+30))) then
tmp = t_0
else
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.pow(l, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -3.9e+129) {
tmp = t_0;
} else if (l <= -1.45e+112) {
tmp = U + (J * (-0.5 + (Math.pow(K, 2.0) * 0.0625)));
} else if ((l <= -920000000.0) || !(l <= 2.9e+30)) {
tmp = t_0;
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.pow(l, 3.0) * (J * 0.3333333333333333) tmp = 0 if l <= -3.9e+129: tmp = t_0 elif l <= -1.45e+112: tmp = U + (J * (-0.5 + (math.pow(K, 2.0) * 0.0625))) elif (l <= -920000000.0) or not (l <= 2.9e+30): tmp = t_0 else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) t_0 = Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) tmp = 0.0 if (l <= -3.9e+129) tmp = t_0; elseif (l <= -1.45e+112) tmp = Float64(U + Float64(J * Float64(-0.5 + Float64((K ^ 2.0) * 0.0625)))); elseif ((l <= -920000000.0) || !(l <= 2.9e+30)) tmp = t_0; else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (l ^ 3.0) * (J * 0.3333333333333333); tmp = 0.0; if (l <= -3.9e+129) tmp = t_0; elseif (l <= -1.45e+112) tmp = U + (J * (-0.5 + ((K ^ 2.0) * 0.0625))); elseif ((l <= -920000000.0) || ~((l <= 2.9e+30))) tmp = t_0; else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.9e+129], t$95$0, If[LessEqual[l, -1.45e+112], N[(U + N[(J * N[(-0.5 + N[(N[Power[K, 2.0], $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -920000000.0], N[Not[LessEqual[l, 2.9e+30]], $MachinePrecision]], t$95$0, N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -3.9 \cdot 10^{+129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -1.45 \cdot 10^{+112}:\\
\;\;\;\;U + J \cdot \left(-0.5 + {K}^{2} \cdot 0.0625\right)\\
\mathbf{elif}\;\ell \leq -920000000 \lor \neg \left(\ell \leq 2.9 \cdot 10^{+30}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -3.8999999999999997e129 or -1.4500000000000001e112 < l < -9.2e8 or 2.8999999999999998e30 < l Initial program 100.0%
Taylor expanded in l around 0 81.4%
Taylor expanded in K around 0 69.5%
Taylor expanded in l around inf 69.6%
*-commutative69.6%
*-commutative69.6%
associate-*r*69.6%
Simplified69.6%
if -3.8999999999999997e129 < l < -1.4500000000000001e112Initial program 100.0%
Applied egg-rr3.8%
Taylor expanded in K around 0 80.5%
*-commutative80.5%
*-commutative80.5%
associate-*l*80.5%
distribute-lft-out80.5%
Simplified80.5%
if -9.2e8 < l < 2.8999999999999998e30Initial program 74.1%
Taylor expanded in l around 0 95.4%
Final simplification82.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (pow l 3.0) (* J 0.3333333333333333))))
(if (<= l -3.9e+129)
t_0
(if (<= l -1.45e+112)
(+ U (* J (+ -0.5 (* (pow K 2.0) 0.0625))))
(if (or (<= l -8.6e+42) (not (<= l 1.9e+92)))
t_0
(* U (+ 1.0 (* 2.0 (* J (/ l U))))))))))
double code(double J, double l, double K, double U) {
double t_0 = pow(l, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -3.9e+129) {
tmp = t_0;
} else if (l <= -1.45e+112) {
tmp = U + (J * (-0.5 + (pow(K, 2.0) * 0.0625)));
} else if ((l <= -8.6e+42) || !(l <= 1.9e+92)) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (l ** 3.0d0) * (j * 0.3333333333333333d0)
if (l <= (-3.9d+129)) then
tmp = t_0
else if (l <= (-1.45d+112)) then
tmp = u + (j * ((-0.5d0) + ((k ** 2.0d0) * 0.0625d0)))
else if ((l <= (-8.6d+42)) .or. (.not. (l <= 1.9d+92))) then
tmp = t_0
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 t_0 = Math.pow(l, 3.0) * (J * 0.3333333333333333);
double tmp;
if (l <= -3.9e+129) {
tmp = t_0;
} else if (l <= -1.45e+112) {
tmp = U + (J * (-0.5 + (Math.pow(K, 2.0) * 0.0625)));
} else if ((l <= -8.6e+42) || !(l <= 1.9e+92)) {
tmp = t_0;
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.pow(l, 3.0) * (J * 0.3333333333333333) tmp = 0 if l <= -3.9e+129: tmp = t_0 elif l <= -1.45e+112: tmp = U + (J * (-0.5 + (math.pow(K, 2.0) * 0.0625))) elif (l <= -8.6e+42) or not (l <= 1.9e+92): tmp = t_0 else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) t_0 = Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) tmp = 0.0 if (l <= -3.9e+129) tmp = t_0; elseif (l <= -1.45e+112) tmp = Float64(U + Float64(J * Float64(-0.5 + Float64((K ^ 2.0) * 0.0625)))); elseif ((l <= -8.6e+42) || !(l <= 1.9e+92)) tmp = t_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) t_0 = (l ^ 3.0) * (J * 0.3333333333333333); tmp = 0.0; if (l <= -3.9e+129) tmp = t_0; elseif (l <= -1.45e+112) tmp = U + (J * (-0.5 + ((K ^ 2.0) * 0.0625))); elseif ((l <= -8.6e+42) || ~((l <= 1.9e+92))) tmp = t_0; else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.9e+129], t$95$0, If[LessEqual[l, -1.45e+112], N[(U + N[(J * N[(-0.5 + N[(N[Power[K, 2.0], $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -8.6e+42], N[Not[LessEqual[l, 1.9e+92]], $MachinePrecision]], t$95$0, N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -3.9 \cdot 10^{+129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -1.45 \cdot 10^{+112}:\\
\;\;\;\;U + J \cdot \left(-0.5 + {K}^{2} \cdot 0.0625\right)\\
\mathbf{elif}\;\ell \leq -8.6 \cdot 10^{+42} \lor \neg \left(\ell \leq 1.9 \cdot 10^{+92}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if l < -3.8999999999999997e129 or -1.4500000000000001e112 < l < -8.5999999999999996e42 or 1.9e92 < l Initial program 100.0%
Taylor expanded in l around 0 90.2%
Taylor expanded in K around 0 75.9%
Taylor expanded in l around inf 75.9%
*-commutative75.9%
*-commutative75.9%
associate-*r*75.9%
Simplified75.9%
if -3.8999999999999997e129 < l < -1.4500000000000001e112Initial program 100.0%
Applied egg-rr3.8%
Taylor expanded in K around 0 80.5%
*-commutative80.5%
*-commutative80.5%
associate-*l*80.5%
distribute-lft-out80.5%
Simplified80.5%
if -8.5999999999999996e42 < l < 1.9e92Initial program 78.0%
Taylor expanded in l around 0 82.3%
Taylor expanded in K around 0 71.4%
+-commutative71.4%
*-commutative71.4%
associate-*r*71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in U around inf 75.0%
associate-/l*76.2%
Simplified76.2%
Final simplification76.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.5e+43) (not (<= l 1.7e+92))) (* (pow l 3.0) (* J 0.3333333333333333)) (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.5e+43) || !(l <= 1.7e+92)) {
tmp = pow(l, 3.0) * (J * 0.3333333333333333);
} 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 ((l <= (-1.5d+43)) .or. (.not. (l <= 1.7d+92))) then
tmp = (l ** 3.0d0) * (j * 0.3333333333333333d0)
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 ((l <= -1.5e+43) || !(l <= 1.7e+92)) {
tmp = Math.pow(l, 3.0) * (J * 0.3333333333333333);
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.5e+43) or not (l <= 1.7e+92): tmp = math.pow(l, 3.0) * (J * 0.3333333333333333) else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.5e+43) || !(l <= 1.7e+92)) tmp = Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)); 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 ((l <= -1.5e+43) || ~((l <= 1.7e+92))) tmp = (l ^ 3.0) * (J * 0.3333333333333333); else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.5e+43], N[Not[LessEqual[l, 1.7e+92]], $MachinePrecision]], N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $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}\;\ell \leq -1.5 \cdot 10^{+43} \lor \neg \left(\ell \leq 1.7 \cdot 10^{+92}\right):\\
\;\;\;\;{\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if l < -1.50000000000000008e43 or 1.6999999999999999e92 < l Initial program 100.0%
Taylor expanded in l around 0 90.6%
Taylor expanded in K around 0 72.5%
Taylor expanded in l around inf 72.5%
*-commutative72.5%
*-commutative72.5%
associate-*r*72.5%
Simplified72.5%
if -1.50000000000000008e43 < l < 1.6999999999999999e92Initial program 78.0%
Taylor expanded in l around 0 82.3%
Taylor expanded in K around 0 71.4%
+-commutative71.4%
*-commutative71.4%
associate-*r*71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in U around inf 75.0%
associate-/l*76.2%
Simplified76.2%
Final simplification74.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1000.0) (not (<= l 6.4e-28))) (* l (* 2.0 J)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1000.0) || !(l <= 6.4e-28)) {
tmp = l * (2.0 * J);
} 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 <= (-1000.0d0)) .or. (.not. (l <= 6.4d-28))) then
tmp = l * (2.0d0 * j)
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 <= -1000.0) || !(l <= 6.4e-28)) {
tmp = l * (2.0 * J);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1000.0) or not (l <= 6.4e-28): tmp = l * (2.0 * J) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1000.0) || !(l <= 6.4e-28)) tmp = Float64(l * Float64(2.0 * J)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1000.0) || ~((l <= 6.4e-28))) tmp = l * (2.0 * J); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1000.0], N[Not[LessEqual[l, 6.4e-28]], $MachinePrecision]], N[(l * N[(2.0 * J), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1000 \lor \neg \left(\ell \leq 6.4 \cdot 10^{-28}\right):\\
\;\;\;\;\ell \cdot \left(2 \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1e3 or 6.39999999999999964e-28 < l Initial program 98.2%
Taylor expanded in l around 0 29.5%
Taylor expanded in K around 0 24.2%
+-commutative24.2%
*-commutative24.2%
associate-*r*24.2%
*-commutative24.2%
Simplified24.2%
Taylor expanded in J around inf 23.9%
associate-*r*23.9%
*-commutative23.9%
Simplified23.9%
if -1e3 < l < 6.39999999999999964e-28Initial program 74.3%
Taylor expanded in J around 0 73.2%
Final simplification45.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.4e+43) (not (<= l 1.7e-9))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.4e+43) || !(l <= 1.7e-9)) {
tmp = U * U;
} 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 <= (-2.4d+43)) .or. (.not. (l <= 1.7d-9))) then
tmp = u * u
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 <= -2.4e+43) || !(l <= 1.7e-9)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.4e+43) or not (l <= 1.7e-9): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.4e+43) || !(l <= 1.7e-9)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.4e+43) || ~((l <= 1.7e-9))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.4e+43], N[Not[LessEqual[l, 1.7e-9]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+43} \lor \neg \left(\ell \leq 1.7 \cdot 10^{-9}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -2.40000000000000023e43 or 1.6999999999999999e-9 < l Initial program 99.3%
Applied egg-rr13.7%
if -2.40000000000000023e43 < l < 1.6999999999999999e-9Initial program 75.2%
Taylor expanded in J around 0 67.1%
Final simplification39.7%
(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 60.6%
Taylor expanded in K around 0 51.4%
+-commutative51.4%
*-commutative51.4%
associate-*r*51.4%
*-commutative51.4%
Simplified51.4%
Taylor expanded in U around inf 58.9%
associate-/l*61.5%
Simplified61.5%
Final simplification61.5%
(FPCore (J l K U) :precision binary64 (+ U (* J (* 2.0 l))))
double code(double J, double l, double K, double U) {
return U + (J * (2.0 * 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 + (j * (2.0d0 * l))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (2.0 * l));
}
def code(J, l, K, U): return U + (J * (2.0 * l))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(2.0 * l))) end
function tmp = code(J, l, K, U) tmp = U + (J * (2.0 * l)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(2 \cdot \ell\right)
\end{array}
Initial program 87.6%
Taylor expanded in l around 0 60.6%
Taylor expanded in K around 0 51.4%
+-commutative51.4%
*-commutative51.4%
associate-*r*51.4%
*-commutative51.4%
Simplified51.4%
Final simplification51.4%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.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 = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 87.6%
Applied egg-rr2.8%
*-inverses2.8%
Simplified2.8%
Final simplification2.8%
(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%
Taylor expanded in J around 0 33.8%
Final simplification33.8%
herbie shell --seed 2024076
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))