
(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 25 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))) (t_1 (- (exp l) t_0)) (t_2 (* J (cos (* 0.5 K)))))
(if (<= t_1 -0.5)
(+ (* t_1 t_2) U)
(if (<= t_1 1e-9)
(fma l (* t_2 (fma 0.3333333333333333 (pow l 2.0) 2.0)) U)
(- U (* (cos (/ K 2.0)) (* J (- t_0 (exp l)))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = exp(l) - t_0;
double t_2 = J * cos((0.5 * K));
double tmp;
if (t_1 <= -0.5) {
tmp = (t_1 * t_2) + U;
} else if (t_1 <= 1e-9) {
tmp = fma(l, (t_2 * fma(0.3333333333333333, pow(l, 2.0), 2.0)), U);
} else {
tmp = U - (cos((K / 2.0)) * (J * (t_0 - exp(l))));
}
return tmp;
}
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = Float64(exp(l) - t_0) t_2 = Float64(J * cos(Float64(0.5 * K))) tmp = 0.0 if (t_1 <= -0.5) tmp = Float64(Float64(t_1 * t_2) + U); elseif (t_1 <= 1e-9) tmp = fma(l, Float64(t_2 * fma(0.3333333333333333, (l ^ 2.0), 2.0)), U); else tmp = Float64(U - Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(t_0 - exp(l))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.5], N[(N[(t$95$1 * t$95$2), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$1, 1e-9], N[(l * N[(t$95$2 * N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U - N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(t$95$0 - N[Exp[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := e^{\ell} - t\_0\\
t_2 := J \cdot \cos \left(0.5 \cdot K\right)\\
\mathbf{if}\;t\_1 \leq -0.5:\\
\;\;\;\;t\_1 \cdot t\_2 + U\\
\mathbf{elif}\;t\_1 \leq 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\ell, t\_2 \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{2}, 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;U - \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(t\_0 - e^{\ell}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.5Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -0.5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.00000000000000006e-9Initial program 66.9%
Taylor expanded in l around 0 99.9%
+-commutative99.9%
fma-define99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
distribute-lft-out99.9%
fma-define99.9%
Simplified99.9%
if 1.00000000000000006e-9 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (- (exp l) t_0)))
(if (or (<= t_1 -0.5) (not (<= t_1 1e-9)))
(- U (* (cos (/ K 2.0)) (* J (- t_0 (exp l)))))
(+ U (* (* J (cos (* 0.5 K))) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = exp(l) - t_0;
double tmp;
if ((t_1 <= -0.5) || !(t_1 <= 1e-9)) {
tmp = U - (cos((K / 2.0)) * (J * (t_0 - exp(l))));
} else {
tmp = U + ((J * cos((0.5 * K))) * (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-l)
t_1 = exp(l) - t_0
if ((t_1 <= (-0.5d0)) .or. (.not. (t_1 <= 1d-9))) then
tmp = u - (cos((k / 2.0d0)) * (j * (t_0 - exp(l))))
else
tmp = u + ((j * cos((0.5d0 * k))) * (l * 2.0d0))
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.exp(l) - t_0;
double tmp;
if ((t_1 <= -0.5) || !(t_1 <= 1e-9)) {
tmp = U - (Math.cos((K / 2.0)) * (J * (t_0 - Math.exp(l))));
} else {
tmp = U + ((J * Math.cos((0.5 * K))) * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.exp(l) - t_0 tmp = 0 if (t_1 <= -0.5) or not (t_1 <= 1e-9): tmp = U - (math.cos((K / 2.0)) * (J * (t_0 - math.exp(l)))) else: tmp = U + ((J * math.cos((0.5 * K))) * (l * 2.0)) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = Float64(exp(l) - t_0) tmp = 0.0 if ((t_1 <= -0.5) || !(t_1 <= 1e-9)) tmp = Float64(U - Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(t_0 - exp(l))))); else tmp = Float64(U + Float64(Float64(J * cos(Float64(0.5 * K))) * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = exp(l) - t_0; tmp = 0.0; if ((t_1 <= -0.5) || ~((t_1 <= 1e-9))) tmp = U - (cos((K / 2.0)) * (J * (t_0 - exp(l)))); else tmp = U + ((J * cos((0.5 * K))) * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -0.5], N[Not[LessEqual[t$95$1, 1e-9]], $MachinePrecision]], N[(U - N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(t$95$0 - N[Exp[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := e^{\ell} - t\_0\\
\mathbf{if}\;t\_1 \leq -0.5 \lor \neg \left(t\_1 \leq 10^{-9}\right):\\
\;\;\;\;U - \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(t\_0 - e^{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.5 or 1.00000000000000006e-9 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -0.5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.00000000000000006e-9Initial program 66.9%
Taylor expanded in J around 0 66.9%
associate-*r*66.9%
*-commutative66.9%
Simplified66.9%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (- (exp l) t_0)) (t_2 (* J (cos (* 0.5 K)))))
(if (<= t_1 -0.5)
(+ (* t_1 t_2) U)
(if (<= t_1 1e-9)
(+ U (* t_2 (* l 2.0)))
(- U (* (cos (/ K 2.0)) (* J (- t_0 (exp l)))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = exp(l) - t_0;
double t_2 = J * cos((0.5 * K));
double tmp;
if (t_1 <= -0.5) {
tmp = (t_1 * t_2) + U;
} else if (t_1 <= 1e-9) {
tmp = U + (t_2 * (l * 2.0));
} else {
tmp = U - (cos((K / 2.0)) * (J * (t_0 - exp(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) :: t_2
real(8) :: tmp
t_0 = exp(-l)
t_1 = exp(l) - t_0
t_2 = j * cos((0.5d0 * k))
if (t_1 <= (-0.5d0)) then
tmp = (t_1 * t_2) + u
else if (t_1 <= 1d-9) then
tmp = u + (t_2 * (l * 2.0d0))
else
tmp = u - (cos((k / 2.0d0)) * (j * (t_0 - exp(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.exp(l) - t_0;
double t_2 = J * Math.cos((0.5 * K));
double tmp;
if (t_1 <= -0.5) {
tmp = (t_1 * t_2) + U;
} else if (t_1 <= 1e-9) {
tmp = U + (t_2 * (l * 2.0));
} else {
tmp = U - (Math.cos((K / 2.0)) * (J * (t_0 - Math.exp(l))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.exp(l) - t_0 t_2 = J * math.cos((0.5 * K)) tmp = 0 if t_1 <= -0.5: tmp = (t_1 * t_2) + U elif t_1 <= 1e-9: tmp = U + (t_2 * (l * 2.0)) else: tmp = U - (math.cos((K / 2.0)) * (J * (t_0 - math.exp(l)))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = Float64(exp(l) - t_0) t_2 = Float64(J * cos(Float64(0.5 * K))) tmp = 0.0 if (t_1 <= -0.5) tmp = Float64(Float64(t_1 * t_2) + U); elseif (t_1 <= 1e-9) tmp = Float64(U + Float64(t_2 * Float64(l * 2.0))); else tmp = Float64(U - Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(t_0 - exp(l))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = exp(l) - t_0; t_2 = J * cos((0.5 * K)); tmp = 0.0; if (t_1 <= -0.5) tmp = (t_1 * t_2) + U; elseif (t_1 <= 1e-9) tmp = U + (t_2 * (l * 2.0)); else tmp = U - (cos((K / 2.0)) * (J * (t_0 - exp(l)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.5], N[(N[(t$95$1 * t$95$2), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$1, 1e-9], N[(U + N[(t$95$2 * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U - N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(t$95$0 - N[Exp[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := e^{\ell} - t\_0\\
t_2 := J \cdot \cos \left(0.5 \cdot K\right)\\
\mathbf{if}\;t\_1 \leq -0.5:\\
\;\;\;\;t\_1 \cdot t\_2 + U\\
\mathbf{elif}\;t\_1 \leq 10^{-9}:\\
\;\;\;\;U + t\_2 \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U - \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(t\_0 - e^{\ell}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.5Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -0.5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.00000000000000006e-9Initial program 66.9%
Taylor expanded in J around 0 66.9%
associate-*r*66.9%
*-commutative66.9%
Simplified66.9%
Taylor expanded in l around 0 99.9%
if 1.00000000000000006e-9 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* 0.5 K))) (t_1 (cos (/ K 2.0))))
(if (<= t_1 -0.25)
(+ U (* (* J t_0) (* l 2.0)))
(if (<= t_1 -0.004)
(+ U (* J (* l (+ 2.0 (* -0.25 (pow K 2.0))))))
(if (<= t_1 -0.001)
(* J (* 2.0 (* l t_0)))
(+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((0.5 * K));
double t_1 = cos((K / 2.0));
double tmp;
if (t_1 <= -0.25) {
tmp = U + ((J * t_0) * (l * 2.0));
} else if (t_1 <= -0.004) {
tmp = U + (J * (l * (2.0 + (-0.25 * pow(K, 2.0)))));
} else if (t_1 <= -0.001) {
tmp = J * (2.0 * (l * t_0));
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((0.5d0 * k))
t_1 = cos((k / 2.0d0))
if (t_1 <= (-0.25d0)) then
tmp = u + ((j * t_0) * (l * 2.0d0))
else if (t_1 <= (-0.004d0)) then
tmp = u + (j * (l * (2.0d0 + ((-0.25d0) * (k ** 2.0d0)))))
else if (t_1 <= (-0.001d0)) then
tmp = j * (2.0d0 * (l * t_0))
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 t_0 = Math.cos((0.5 * K));
double t_1 = Math.cos((K / 2.0));
double tmp;
if (t_1 <= -0.25) {
tmp = U + ((J * t_0) * (l * 2.0));
} else if (t_1 <= -0.004) {
tmp = U + (J * (l * (2.0 + (-0.25 * Math.pow(K, 2.0)))));
} else if (t_1 <= -0.001) {
tmp = J * (2.0 * (l * t_0));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((0.5 * K)) t_1 = math.cos((K / 2.0)) tmp = 0 if t_1 <= -0.25: tmp = U + ((J * t_0) * (l * 2.0)) elif t_1 <= -0.004: tmp = U + (J * (l * (2.0 + (-0.25 * math.pow(K, 2.0))))) elif t_1 <= -0.001: tmp = J * (2.0 * (l * t_0)) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(0.5 * K)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_1 <= -0.25) tmp = Float64(U + Float64(Float64(J * t_0) * Float64(l * 2.0))); elseif (t_1 <= -0.004) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(-0.25 * (K ^ 2.0)))))); elseif (t_1 <= -0.001) tmp = Float64(J * Float64(2.0 * Float64(l * t_0))); 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) t_0 = cos((0.5 * K)); t_1 = cos((K / 2.0)); tmp = 0.0; if (t_1 <= -0.25) tmp = U + ((J * t_0) * (l * 2.0)); elseif (t_1 <= -0.004) tmp = U + (J * (l * (2.0 + (-0.25 * (K ^ 2.0))))); elseif (t_1 <= -0.001) tmp = J * (2.0 * (l * t_0)); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -0.25], N[(U + N[(N[(J * t$95$0), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.004], N[(U + N[(J * N[(l * N[(2.0 + N[(-0.25 * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.001], N[(J * N[(2.0 * N[(l * t$95$0), $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}
t_0 := \cos \left(0.5 \cdot K\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_1 \leq -0.25:\\
\;\;\;\;U + \left(J \cdot t\_0\right) \cdot \left(\ell \cdot 2\right)\\
\mathbf{elif}\;t\_1 \leq -0.004:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + -0.25 \cdot {K}^{2}\right)\right)\\
\mathbf{elif}\;t\_1 \leq -0.001:\\
\;\;\;\;J \cdot \left(2 \cdot \left(\ell \cdot t\_0\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.25Initial program 77.4%
Taylor expanded in J around 0 77.4%
associate-*r*77.4%
*-commutative77.4%
Simplified77.4%
Taylor expanded in l around 0 77.3%
if -0.25 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0040000000000000001Initial program 100.0%
Taylor expanded in l around 0 35.9%
associate-*r*35.9%
*-commutative35.9%
associate-*r*35.9%
*-commutative35.9%
associate-*r*35.9%
Simplified35.9%
Taylor expanded in J around inf 45.9%
Taylor expanded in K around 0 66.9%
distribute-lft-in66.9%
associate-+r+66.9%
*-commutative66.9%
associate-*l*66.9%
associate-*r*66.9%
*-commutative66.9%
distribute-lft-out78.0%
+-commutative78.0%
associate-*r*78.0%
*-commutative78.0%
distribute-rgt-out78.0%
*-commutative78.0%
associate-/l*78.8%
*-commutative78.8%
associate-/l*89.2%
*-inverses89.2%
*-rgt-identity89.2%
Simplified89.2%
if -0.0040000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -1e-3Initial program 1.3%
Taylor expanded in l around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*98.4%
*-commutative98.4%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in J around inf 100.0%
Taylor expanded in l around inf 100.0%
if -1e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in l around 0 88.5%
Taylor expanded in K around 0 84.5%
Final simplification83.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_1 (- U (* J (- (exp (- l)) (exp l))))))
(if (<= l -1.02e+120)
t_0
(if (<= l -40.0)
t_1
(if (<= l 0.00042)
(+ U (* (* J (cos (* 0.5 K))) (* l 2.0)))
(if (<= l 4e+91) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = U - (J * (exp(-l) - exp(l)));
double tmp;
if (l <= -1.02e+120) {
tmp = t_0;
} else if (l <= -40.0) {
tmp = t_1;
} else if (l <= 0.00042) {
tmp = U + ((J * cos((0.5 * K))) * (l * 2.0));
} else if (l <= 4e+91) {
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)) * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_1 = u - (j * (exp(-l) - exp(l)))
if (l <= (-1.02d+120)) then
tmp = t_0
else if (l <= (-40.0d0)) then
tmp = t_1
else if (l <= 0.00042d0) then
tmp = u + ((j * cos((0.5d0 * k))) * (l * 2.0d0))
else if (l <= 4d+91) 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)) * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = U - (J * (Math.exp(-l) - Math.exp(l)));
double tmp;
if (l <= -1.02e+120) {
tmp = t_0;
} else if (l <= -40.0) {
tmp = t_1;
} else if (l <= 0.00042) {
tmp = U + ((J * Math.cos((0.5 * K))) * (l * 2.0));
} else if (l <= 4e+91) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (math.pow(l, 3.0) * (J * 0.3333333333333333))) t_1 = U - (J * (math.exp(-l) - math.exp(l))) tmp = 0 if l <= -1.02e+120: tmp = t_0 elif l <= -40.0: tmp = t_1 elif l <= 0.00042: tmp = U + ((J * math.cos((0.5 * K))) * (l * 2.0)) elif l <= 4e+91: 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((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_1 = Float64(U - Float64(J * Float64(exp(Float64(-l)) - exp(l)))) tmp = 0.0 if (l <= -1.02e+120) tmp = t_0; elseif (l <= -40.0) tmp = t_1; elseif (l <= 0.00042) tmp = Float64(U + Float64(Float64(J * cos(Float64(0.5 * K))) * Float64(l * 2.0))); elseif (l <= 4e+91) 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)) * ((l ^ 3.0) * (J * 0.3333333333333333))); t_1 = U - (J * (exp(-l) - exp(l))); tmp = 0.0; if (l <= -1.02e+120) tmp = t_0; elseif (l <= -40.0) tmp = t_1; elseif (l <= 0.00042) tmp = U + ((J * cos((0.5 * K))) * (l * 2.0)); elseif (l <= 4e+91) 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[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $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, -1.02e+120], t$95$0, If[LessEqual[l, -40.0], t$95$1, If[LessEqual[l, 0.00042], N[(U + N[(N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4e+91], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_1 := U - J \cdot \left(e^{-\ell} - e^{\ell}\right)\\
\mathbf{if}\;\ell \leq -1.02 \cdot 10^{+120}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -40:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 0.00042:\\
\;\;\;\;U + \left(J \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \left(\ell \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 4 \cdot 10^{+91}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.01999999999999997e120 or 4.00000000000000032e91 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -1.01999999999999997e120 < l < -40 or 4.2000000000000002e-4 < l < 4.00000000000000032e91Initial program 100.0%
Taylor expanded in K around 0 80.0%
if -40 < l < 4.2000000000000002e-4Initial program 67.7%
Taylor expanded in J around 0 67.7%
associate-*r*67.7%
*-commutative67.7%
Simplified67.7%
Taylor expanded in l around 0 98.6%
Final simplification95.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_2 (- U (* J (- (exp (- l)) (exp l))))))
(if (<= l -1.02e+120)
t_1
(if (<= l -40.0)
t_2
(if (<= l 0.00046)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(if (<= l 4e+91) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = U - (J * (exp(-l) - exp(l)));
double tmp;
if (l <= -1.02e+120) {
tmp = t_1;
} else if (l <= -40.0) {
tmp = t_2;
} else if (l <= 0.00046) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else if (l <= 4e+91) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_2 = u - (j * (exp(-l) - exp(l)))
if (l <= (-1.02d+120)) then
tmp = t_1
else if (l <= (-40.0d0)) then
tmp = t_2
else if (l <= 0.00046d0) then
tmp = u + (t_0 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
else if (l <= 4d+91) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (t_0 * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = U - (J * (Math.exp(-l) - Math.exp(l)));
double tmp;
if (l <= -1.02e+120) {
tmp = t_1;
} else if (l <= -40.0) {
tmp = t_2;
} else if (l <= 0.00046) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else if (l <= 4e+91) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (math.pow(l, 3.0) * (J * 0.3333333333333333))) t_2 = U - (J * (math.exp(-l) - math.exp(l))) tmp = 0 if l <= -1.02e+120: tmp = t_1 elif l <= -40.0: tmp = t_2 elif l <= 0.00046: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) elif l <= 4e+91: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_2 = Float64(U - Float64(J * Float64(exp(Float64(-l)) - exp(l)))) tmp = 0.0 if (l <= -1.02e+120) tmp = t_1; elseif (l <= -40.0) tmp = t_2; elseif (l <= 0.00046) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); elseif (l <= 4e+91) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * ((l ^ 3.0) * (J * 0.3333333333333333))); t_2 = U - (J * (exp(-l) - exp(l))); tmp = 0.0; if (l <= -1.02e+120) tmp = t_1; elseif (l <= -40.0) tmp = t_2; elseif (l <= 0.00046) tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); elseif (l <= 4e+91) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U - N[(J * N[(N[Exp[(-l)], $MachinePrecision] - N[Exp[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.02e+120], t$95$1, If[LessEqual[l, -40.0], t$95$2, If[LessEqual[l, 0.00046], 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], If[LessEqual[l, 4e+91], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t\_0 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_2 := U - J \cdot \left(e^{-\ell} - e^{\ell}\right)\\
\mathbf{if}\;\ell \leq -1.02 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -40:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq 0.00046:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 4 \cdot 10^{+91}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -1.01999999999999997e120 or 4.00000000000000032e91 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -1.01999999999999997e120 < l < -40 or 4.6000000000000001e-4 < l < 4.00000000000000032e91Initial program 100.0%
Taylor expanded in K around 0 80.0%
if -40 < l < 4.6000000000000001e-4Initial program 67.7%
Taylor expanded in l around 0 98.7%
Final simplification95.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.001) (* J (* U (- (/ 1.0 J) (* -2.0 (* l (/ (cos (* 0.5 K)) 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.001) {
tmp = J * (U * ((1.0 / J) - (-2.0 * (l * (cos((0.5 * K)) / 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.001d0)) then
tmp = j * (u * ((1.0d0 / j) - ((-2.0d0) * (l * (cos((0.5d0 * k)) / 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.001) {
tmp = J * (U * ((1.0 / J) - (-2.0 * (l * (Math.cos((0.5 * K)) / 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.001: tmp = J * (U * ((1.0 / J) - (-2.0 * (l * (math.cos((0.5 * K)) / 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.001) tmp = Float64(J * Float64(U * Float64(Float64(1.0 / J) - Float64(-2.0 * Float64(l * Float64(cos(Float64(0.5 * K)) / 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.001) tmp = J * (U * ((1.0 / J) - (-2.0 * (l * (cos((0.5 * K)) / 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.001], N[(J * N[(U * N[(N[(1.0 / J), $MachinePrecision] - N[(-2.0 * N[(l * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] / U), $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.001:\\
\;\;\;\;J \cdot \left(U \cdot \left(\frac{1}{J} - -2 \cdot \left(\ell \cdot \frac{\cos \left(0.5 \cdot K\right)}{U}\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))) < -1e-3Initial program 79.5%
Taylor expanded in l around 0 71.5%
associate-*r*71.5%
*-commutative71.5%
associate-*r*71.6%
*-commutative71.6%
associate-*r*71.6%
Simplified71.6%
Taylor expanded in J around inf 73.0%
Taylor expanded in U around -inf 76.1%
associate-*r*76.1%
neg-mul-176.1%
associate-/l*76.1%
Simplified76.1%
if -1e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in l around 0 88.5%
Taylor expanded in K around 0 84.5%
Final simplification82.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.33) (* U (+ 1.0 (* 2.0 (* J (* l (/ (cos (* 0.5 K)) 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.33) {
tmp = U * (1.0 + (2.0 * (J * (l * (cos((0.5 * K)) / 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.33d0) then
tmp = u * (1.0d0 + (2.0d0 * (j * (l * (cos((0.5d0 * k)) / 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.33) {
tmp = U * (1.0 + (2.0 * (J * (l * (Math.cos((0.5 * K)) / 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.33: tmp = U * (1.0 + (2.0 * (J * (l * (math.cos((0.5 * K)) / 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.33) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l * Float64(cos(Float64(0.5 * K)) / 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.33) tmp = U * (1.0 + (2.0 * (J * (l * (cos((0.5 * K)) / 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.33], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] / U), $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.33:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \left(\ell \cdot \frac{\cos \left(0.5 \cdot K\right)}{U}\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.330000000000000016Initial program 78.9%
Taylor expanded in l around 0 70.9%
associate-*r*70.9%
*-commutative70.9%
associate-*r*70.9%
*-commutative70.9%
associate-*r*71.0%
Simplified71.0%
Taylor expanded in J around inf 69.5%
Taylor expanded in U around inf 70.9%
associate-/l*73.6%
associate-/l*73.6%
Simplified73.6%
if 0.330000000000000016 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.7%
Taylor expanded in l around 0 88.2%
Taylor expanded in K around 0 85.3%
Final simplification82.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.001) (* J (+ (* 2.0 (* l (cos (* 0.5 K)))) (/ U J))) (+ 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.001) {
tmp = J * ((2.0 * (l * cos((0.5 * K)))) + (U / J));
} 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.001d0)) then
tmp = j * ((2.0d0 * (l * cos((0.5d0 * k)))) + (u / j))
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.001) {
tmp = J * ((2.0 * (l * Math.cos((0.5 * K)))) + (U / J));
} 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.001: tmp = J * ((2.0 * (l * math.cos((0.5 * K)))) + (U / J)) 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.001) tmp = Float64(J * Float64(Float64(2.0 * Float64(l * cos(Float64(0.5 * K)))) + Float64(U / J))); 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.001) tmp = J * ((2.0 * (l * cos((0.5 * K)))) + (U / J)); 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.001], N[(J * N[(N[(2.0 * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(U / J), $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.001:\\
\;\;\;\;J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right) + \frac{U}{J}\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))) < -1e-3Initial program 79.5%
Taylor expanded in l around 0 71.5%
associate-*r*71.5%
*-commutative71.5%
associate-*r*71.6%
*-commutative71.6%
associate-*r*71.6%
Simplified71.6%
Taylor expanded in J around inf 73.0%
if -1e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in l around 0 88.5%
Taylor expanded in K around 0 84.5%
Final simplification81.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.001) (+ U (* (cos (* 0.5 K)) (* l (* J 2.0)))) (+ 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.001) {
tmp = U + (cos((0.5 * K)) * (l * (J * 2.0)));
} 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.001d0)) then
tmp = u + (cos((0.5d0 * k)) * (l * (j * 2.0d0)))
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.001) {
tmp = U + (Math.cos((0.5 * K)) * (l * (J * 2.0)));
} 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.001: tmp = U + (math.cos((0.5 * K)) * (l * (J * 2.0))) 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.001) tmp = Float64(U + Float64(cos(Float64(0.5 * K)) * Float64(l * Float64(J * 2.0)))); 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.001) tmp = U + (cos((0.5 * K)) * (l * (J * 2.0))); 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.001], N[(U + N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $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.001:\\
\;\;\;\;U + \cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot \left(J \cdot 2\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))) < -1e-3Initial program 79.5%
Taylor expanded in l around 0 71.5%
associate-*r*71.5%
*-commutative71.5%
associate-*r*71.6%
*-commutative71.6%
associate-*r*71.6%
Simplified71.6%
if -1e-3 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.1%
Taylor expanded in l around 0 88.5%
Taylor expanded in K around 0 84.5%
Final simplification81.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -40.0) (not (<= l 0.00031))) (- U (* J (- (exp (- l)) (exp l)))) (+ U (* (* J (cos (* 0.5 K))) (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -40.0) || !(l <= 0.00031)) {
tmp = U - (J * (exp(-l) - exp(l)));
} else {
tmp = U + ((J * cos((0.5 * K))) * (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 ((l <= (-40.0d0)) .or. (.not. (l <= 0.00031d0))) then
tmp = u - (j * (exp(-l) - exp(l)))
else
tmp = u + ((j * cos((0.5d0 * k))) * (l * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -40.0) || !(l <= 0.00031)) {
tmp = U - (J * (Math.exp(-l) - Math.exp(l)));
} else {
tmp = U + ((J * Math.cos((0.5 * K))) * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -40.0) or not (l <= 0.00031): tmp = U - (J * (math.exp(-l) - math.exp(l))) else: tmp = U + ((J * math.cos((0.5 * K))) * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -40.0) || !(l <= 0.00031)) tmp = Float64(U - Float64(J * Float64(exp(Float64(-l)) - exp(l)))); else tmp = Float64(U + Float64(Float64(J * cos(Float64(0.5 * K))) * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -40.0) || ~((l <= 0.00031))) tmp = U - (J * (exp(-l) - exp(l))); else tmp = U + ((J * cos((0.5 * K))) * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -40.0], N[Not[LessEqual[l, 0.00031]], $MachinePrecision]], N[(U - N[(J * N[(N[Exp[(-l)], $MachinePrecision] - N[Exp[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -40 \lor \neg \left(\ell \leq 0.00031\right):\\
\;\;\;\;U - J \cdot \left(e^{-\ell} - e^{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -40 or 3.1e-4 < l Initial program 100.0%
Taylor expanded in K around 0 81.2%
if -40 < l < 3.1e-4Initial program 67.7%
Taylor expanded in J around 0 67.7%
associate-*r*67.7%
*-commutative67.7%
Simplified67.7%
Taylor expanded in l around 0 98.6%
Final simplification89.6%
(FPCore (J l K U) :precision binary64 (if (or (<= J -4.4e+205) (not (<= J 4.7e+82))) (* J (* 2.0 (* l (cos (* 0.5 K))))) (+ U (* 2.0 (* l J)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -4.4e+205) || !(J <= 4.7e+82)) {
tmp = J * (2.0 * (l * cos((0.5 * K))));
} else {
tmp = U + (2.0 * (l * J));
}
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 ((j <= (-4.4d+205)) .or. (.not. (j <= 4.7d+82))) then
tmp = j * (2.0d0 * (l * cos((0.5d0 * k))))
else
tmp = u + (2.0d0 * (l * j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -4.4e+205) || !(J <= 4.7e+82)) {
tmp = J * (2.0 * (l * Math.cos((0.5 * K))));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -4.4e+205) or not (J <= 4.7e+82): tmp = J * (2.0 * (l * math.cos((0.5 * K)))) else: tmp = U + (2.0 * (l * J)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -4.4e+205) || !(J <= 4.7e+82)) tmp = Float64(J * Float64(2.0 * Float64(l * cos(Float64(0.5 * K))))); else tmp = Float64(U + Float64(2.0 * Float64(l * J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -4.4e+205) || ~((J <= 4.7e+82))) tmp = J * (2.0 * (l * cos((0.5 * K)))); else tmp = U + (2.0 * (l * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -4.4e+205], N[Not[LessEqual[J, 4.7e+82]], $MachinePrecision]], N[(J * N[(2.0 * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -4.4 \cdot 10^{+205} \lor \neg \left(J \leq 4.7 \cdot 10^{+82}\right):\\
\;\;\;\;J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if J < -4.3999999999999997e205 or 4.7e82 < J Initial program 70.2%
Taylor expanded in l around 0 84.0%
associate-*r*84.0%
*-commutative84.0%
associate-*r*84.0%
*-commutative84.0%
associate-*r*84.1%
Simplified84.1%
Taylor expanded in J around inf 84.0%
Taylor expanded in l around inf 73.9%
if -4.3999999999999997e205 < J < 4.7e82Initial program 90.5%
Taylor expanded in l around 0 56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r*56.3%
Simplified56.3%
Taylor expanded in K around 0 51.7%
Final simplification58.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* 0.5 K))))
(if (<= J -9.2e+208)
(* J (* 2.0 (* l t_0)))
(if (<= J 4.7e+82) (+ U (* 2.0 (* l J))) (* l (* t_0 (* J 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((0.5 * K));
double tmp;
if (J <= -9.2e+208) {
tmp = J * (2.0 * (l * t_0));
} else if (J <= 4.7e+82) {
tmp = U + (2.0 * (l * J));
} else {
tmp = l * (t_0 * (J * 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) :: t_0
real(8) :: tmp
t_0 = cos((0.5d0 * k))
if (j <= (-9.2d+208)) then
tmp = j * (2.0d0 * (l * t_0))
else if (j <= 4.7d+82) then
tmp = u + (2.0d0 * (l * j))
else
tmp = l * (t_0 * (j * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((0.5 * K));
double tmp;
if (J <= -9.2e+208) {
tmp = J * (2.0 * (l * t_0));
} else if (J <= 4.7e+82) {
tmp = U + (2.0 * (l * J));
} else {
tmp = l * (t_0 * (J * 2.0));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((0.5 * K)) tmp = 0 if J <= -9.2e+208: tmp = J * (2.0 * (l * t_0)) elif J <= 4.7e+82: tmp = U + (2.0 * (l * J)) else: tmp = l * (t_0 * (J * 2.0)) return tmp
function code(J, l, K, U) t_0 = cos(Float64(0.5 * K)) tmp = 0.0 if (J <= -9.2e+208) tmp = Float64(J * Float64(2.0 * Float64(l * t_0))); elseif (J <= 4.7e+82) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = Float64(l * Float64(t_0 * Float64(J * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((0.5 * K)); tmp = 0.0; if (J <= -9.2e+208) tmp = J * (2.0 * (l * t_0)); elseif (J <= 4.7e+82) tmp = U + (2.0 * (l * J)); else tmp = l * (t_0 * (J * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[J, -9.2e+208], N[(J * N[(2.0 * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 4.7e+82], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l * N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot K\right)\\
\mathbf{if}\;J \leq -9.2 \cdot 10^{+208}:\\
\;\;\;\;J \cdot \left(2 \cdot \left(\ell \cdot t\_0\right)\right)\\
\mathbf{elif}\;J \leq 4.7 \cdot 10^{+82}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(t\_0 \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if J < -9.20000000000000002e208Initial program 66.0%
Taylor expanded in l around 0 80.5%
associate-*r*80.5%
*-commutative80.5%
associate-*r*80.5%
*-commutative80.5%
associate-*r*80.5%
Simplified80.5%
Taylor expanded in J around inf 80.5%
Taylor expanded in l around inf 80.5%
if -9.20000000000000002e208 < J < 4.7e82Initial program 90.5%
Taylor expanded in l around 0 56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*r*56.3%
Simplified56.3%
Taylor expanded in K around 0 51.7%
if 4.7e82 < J Initial program 72.0%
Taylor expanded in l around 0 85.6%
associate-*r*85.6%
*-commutative85.6%
associate-*r*85.6%
*-commutative85.6%
associate-*r*85.6%
Simplified85.6%
Taylor expanded in l around inf 76.6%
Taylor expanded in J around inf 71.1%
associate-*r*71.1%
*-commutative71.1%
Simplified71.1%
Final simplification58.3%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J (* l (cos (* 0.5 K)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * cos((0.5 * K)))));
}
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 * cos((0.5d0 * k)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * Math.cos((0.5 * K)))));
}
def code(J, l, K, U): return U + (2.0 * (J * (l * math.cos((0.5 * K)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(0.5 * K)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * (l * cos((0.5 * K))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 64.5%
Final simplification64.5%
(FPCore (J l K U) :precision binary64 (+ U (* (* J (cos (* 0.5 K))) (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + ((J * cos((0.5 * K))) * (l * 2.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 = u + ((j * cos((0.5d0 * k))) * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + ((J * Math.cos((0.5 * K))) * (l * 2.0));
}
def code(J, l, K, U): return U + ((J * math.cos((0.5 * K))) * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(Float64(J * cos(Float64(0.5 * K))) * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + ((J * cos((0.5 * K))) * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \left(J \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 84.5%
Taylor expanded in J around 0 84.5%
associate-*r*84.5%
*-commutative84.5%
Simplified84.5%
Taylor expanded in l around 0 64.5%
Final simplification64.5%
(FPCore (J l K U) :precision binary64 (fma J (* l 2.0) U))
double code(double J, double l, double K, double U) {
return fma(J, (l * 2.0), U);
}
function code(J, l, K, U) return fma(J, Float64(l * 2.0), U) end
code[J_, l_, K_, U_] := N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J, \ell \cdot 2, U\right)
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 64.5%
associate-*r*64.5%
*-commutative64.5%
associate-*r*64.5%
*-commutative64.5%
associate-*r*64.5%
Simplified64.5%
Taylor expanded in K around 0 53.3%
+-commutative53.3%
*-commutative53.3%
associate-*r*53.3%
fma-define53.3%
*-commutative53.3%
Simplified53.3%
Final simplification53.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -23500.0) (not (<= l 680000000000.0))) (* J (* J (* U U))) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -23500.0) || !(l <= 680000000000.0)) {
tmp = J * (J * (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 <= (-23500.0d0)) .or. (.not. (l <= 680000000000.0d0))) then
tmp = j * (j * (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 <= -23500.0) || !(l <= 680000000000.0)) {
tmp = J * (J * (U * U));
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -23500.0) or not (l <= 680000000000.0): tmp = J * (J * (U * U)) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -23500.0) || !(l <= 680000000000.0)) tmp = Float64(J * Float64(J * Float64(U * U))); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -23500.0) || ~((l <= 680000000000.0))) tmp = J * (J * (U * U)); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -23500.0], N[Not[LessEqual[l, 680000000000.0]], $MachinePrecision]], N[(J * N[(J * N[(U * U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -23500 \lor \neg \left(\ell \leq 680000000000\right):\\
\;\;\;\;J \cdot \left(J \cdot \left(U \cdot U\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -23500 or 6.8e11 < l Initial program 100.0%
Taylor expanded in l around 0 33.0%
associate-*r*33.0%
*-commutative33.0%
associate-*r*33.0%
*-commutative33.0%
associate-*r*33.0%
Simplified33.0%
Taylor expanded in J around inf 39.5%
Applied egg-rr23.4%
*-commutative23.4%
associate-*l*25.6%
Simplified25.6%
if -23500 < l < 6.8e11Initial program 68.5%
Taylor expanded in J around 0 64.7%
Final simplification44.8%
(FPCore (J l K U) :precision binary64 (if (<= l -23500.0) (* J (* U (* J U))) (if (<= l 25000000.0) U (* J (* J (* U U))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -23500.0) {
tmp = J * (U * (J * U));
} else if (l <= 25000000.0) {
tmp = U;
} else {
tmp = J * (J * (U * 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 <= (-23500.0d0)) then
tmp = j * (u * (j * u))
else if (l <= 25000000.0d0) then
tmp = u
else
tmp = j * (j * (u * u))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -23500.0) {
tmp = J * (U * (J * U));
} else if (l <= 25000000.0) {
tmp = U;
} else {
tmp = J * (J * (U * U));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -23500.0: tmp = J * (U * (J * U)) elif l <= 25000000.0: tmp = U else: tmp = J * (J * (U * U)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -23500.0) tmp = Float64(J * Float64(U * Float64(J * U))); elseif (l <= 25000000.0) tmp = U; else tmp = Float64(J * Float64(J * Float64(U * U))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -23500.0) tmp = J * (U * (J * U)); elseif (l <= 25000000.0) tmp = U; else tmp = J * (J * (U * U)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -23500.0], N[(J * N[(U * N[(J * U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 25000000.0], U, N[(J * N[(J * N[(U * U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -23500:\\
\;\;\;\;J \cdot \left(U \cdot \left(J \cdot U\right)\right)\\
\mathbf{elif}\;\ell \leq 25000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(J \cdot \left(U \cdot U\right)\right)\\
\end{array}
\end{array}
if l < -23500Initial program 100.0%
Taylor expanded in l around 0 32.1%
associate-*r*32.1%
*-commutative32.1%
associate-*r*32.1%
*-commutative32.1%
associate-*r*32.1%
Simplified32.1%
Taylor expanded in J around inf 33.5%
Applied egg-rr23.8%
if -23500 < l < 2.5e7Initial program 68.5%
Taylor expanded in J around 0 64.7%
if 2.5e7 < l Initial program 100.0%
Taylor expanded in l around 0 33.8%
associate-*r*33.8%
*-commutative33.8%
associate-*r*33.8%
*-commutative33.8%
associate-*r*33.8%
Simplified33.8%
Taylor expanded in J around inf 44.9%
Applied egg-rr23.1%
*-commutative23.1%
associate-*l*27.3%
Simplified27.3%
Final simplification44.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -39.0) (not (<= l 1.8e+16))) (* J (* J U)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -39.0) || !(l <= 1.8e+16)) {
tmp = J * (J * 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 <= (-39.0d0)) .or. (.not. (l <= 1.8d+16))) then
tmp = j * (j * 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 <= -39.0) || !(l <= 1.8e+16)) {
tmp = J * (J * U);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -39.0) or not (l <= 1.8e+16): tmp = J * (J * U) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -39.0) || !(l <= 1.8e+16)) tmp = Float64(J * Float64(J * U)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -39.0) || ~((l <= 1.8e+16))) tmp = J * (J * U); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -39.0], N[Not[LessEqual[l, 1.8e+16]], $MachinePrecision]], N[(J * N[(J * U), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -39 \lor \neg \left(\ell \leq 1.8 \cdot 10^{+16}\right):\\
\;\;\;\;J \cdot \left(J \cdot U\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -39 or 1.8e16 < l Initial program 100.0%
Taylor expanded in l around 0 32.8%
associate-*r*32.8%
*-commutative32.8%
associate-*r*32.8%
*-commutative32.8%
associate-*r*32.8%
Simplified32.8%
Taylor expanded in J around inf 39.2%
Applied egg-rr19.6%
if -39 < l < 1.8e16Initial program 68.2%
Taylor expanded in J around 0 65.1%
Final simplification41.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -23500.0) (not (<= l 680.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -23500.0) || !(l <= 680.0)) {
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 <= (-23500.0d0)) .or. (.not. (l <= 680.0d0))) 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 <= -23500.0) || !(l <= 680.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -23500.0) or not (l <= 680.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -23500.0) || !(l <= 680.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -23500.0) || ~((l <= 680.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -23500.0], N[Not[LessEqual[l, 680.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -23500 \lor \neg \left(\ell \leq 680\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -23500 or 680 < l Initial program 100.0%
Applied egg-rr16.0%
if -23500 < l < 680Initial program 68.2%
Taylor expanded in J around 0 65.2%
Final simplification40.0%
(FPCore (J l K U) :precision binary64 (if (<= l -2.9e+36) (* J U) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.9e+36) {
tmp = J * 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.9d+36)) then
tmp = j * 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.9e+36) {
tmp = J * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.9e+36: tmp = J * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.9e+36) tmp = Float64(J * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.9e+36) tmp = J * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.9e+36], N[(J * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{+36}:\\
\;\;\;\;J \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -2.9e36Initial program 100.0%
Taylor expanded in l around 0 40.2%
associate-*r*40.2%
*-commutative40.2%
associate-*r*40.2%
*-commutative40.2%
associate-*r*40.2%
Simplified40.2%
Taylor expanded in J around inf 40.2%
Applied egg-rr36.2%
exp-prod34.1%
*-commutative34.1%
rem-log-exp14.6%
Simplified14.6%
if -2.9e36 < l Initial program 80.9%
Taylor expanded in J around 0 40.2%
Final simplification35.4%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
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 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
def code(J, l, K, U): return U + (2.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 64.5%
associate-*r*64.5%
*-commutative64.5%
associate-*r*64.5%
*-commutative64.5%
associate-*r*64.5%
Simplified64.5%
Taylor expanded in K around 0 53.3%
Final simplification53.3%
(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 84.5%
Applied egg-rr2.8%
*-inverses2.8%
Simplified2.8%
Final simplification2.8%
(FPCore (J l K U) :precision binary64 J)
double code(double J, double l, double K, double U) {
return J;
}
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
end function
public static double code(double J, double l, double K, double U) {
return J;
}
def code(J, l, K, U): return J
function code(J, l, K, U) return J end
function tmp = code(J, l, K, U) tmp = J; end
code[J_, l_, K_, U_] := J
\begin{array}{l}
\\
J
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 64.5%
associate-*r*64.5%
*-commutative64.5%
associate-*r*64.5%
*-commutative64.5%
associate-*r*64.5%
Simplified64.5%
Taylor expanded in J around inf 62.3%
Applied egg-rr6.8%
associate-/l*3.1%
*-inverses3.1%
*-rgt-identity3.1%
Simplified3.1%
Final simplification3.1%
(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 84.5%
Taylor expanded in J around 0 33.0%
Final simplification33.0%
herbie shell --seed 2024074
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))