
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 4e-6)))
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+ 0.3333333333333333 (* (pow l 2.0) 0.016666666666666666)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 4e-6)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + (pow(l, 2.0) * 0.016666666666666666)))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 4e-6)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (Math.pow(l, 2.0) * (0.3333333333333333 + (Math.pow(l, 2.0) * 0.016666666666666666)))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 4e-6): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (math.pow(l, 2.0) * (0.3333333333333333 + (math.pow(l, 2.0) * 0.016666666666666666))))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 4e-6)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64((l ^ 2.0) * 0.016666666666666666)))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 4e-6))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + ((l ^ 2.0) * (0.3333333333333333 + ((l ^ 2.0) * 0.016666666666666666))))))); 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[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 4e-6]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 4 \cdot 10^{-6}\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + {\ell}^{2} \cdot 0.016666666666666666\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 3.99999999999999982e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 3.99999999999999982e-6Initial program 68.9%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 4e-6)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 4e-6)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333)))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 4e-6)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 4e-6): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 4e-6)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 4e-6))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333))))); 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[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 4e-6]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 4 \cdot 10^{-6}\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 3.99999999999999982e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 3.99999999999999982e-6Initial program 68.9%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (pow l 5.0) (* J (* 0.016666666666666666 (cos (* K 0.5)))))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -9e+60)
t_0
(if (<= l -0.00085)
t_1
(if (<= l 32000.0)
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333))))))
(if (<= l 7.6e+50) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (pow(l, 5.0) * (J * (0.016666666666666666 * cos((K * 0.5)))));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -9e+60) {
tmp = t_0;
} else if (l <= -0.00085) {
tmp = t_1;
} else if (l <= 32000.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333)))));
} else if (l <= 7.6e+50) {
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 + ((l ** 5.0d0) * (j * (0.016666666666666666d0 * cos((k * 0.5d0)))))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-9d+60)) then
tmp = t_0
else if (l <= (-0.00085d0)) then
tmp = t_1
else if (l <= 32000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0)))))
else if (l <= 7.6d+50) 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.pow(l, 5.0) * (J * (0.016666666666666666 * Math.cos((K * 0.5)))));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -9e+60) {
tmp = t_0;
} else if (l <= -0.00085) {
tmp = t_1;
} else if (l <= 32000.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333)))));
} else if (l <= 7.6e+50) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.pow(l, 5.0) * (J * (0.016666666666666666 * math.cos((K * 0.5))))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -9e+60: tmp = t_0 elif l <= -0.00085: tmp = t_1 elif l <= 32000.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333))))) elif l <= 7.6e+50: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64((l ^ 5.0) * Float64(J * Float64(0.016666666666666666 * cos(Float64(K * 0.5)))))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -9e+60) tmp = t_0; elseif (l <= -0.00085) tmp = t_1; elseif (l <= 32000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333)))))); elseif (l <= 7.6e+50) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((l ^ 5.0) * (J * (0.016666666666666666 * cos((K * 0.5))))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -9e+60) tmp = t_0; elseif (l <= -0.00085) tmp = t_1; elseif (l <= 32000.0) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333))))); elseif (l <= 7.6e+50) 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[Power[l, 5.0], $MachinePrecision] * N[(J * N[(0.016666666666666666 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -9e+60], t$95$0, If[LessEqual[l, -0.00085], t$95$1, If[LessEqual[l, 32000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.6e+50], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + {\ell}^{5} \cdot \left(J \cdot \left(0.016666666666666666 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -9 \cdot 10^{+60}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.00085:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 32000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 7.6 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -9.00000000000000026e60 or 7.59999999999999975e50 < l Initial program 100.0%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in l around inf 99.1%
*-commutative99.1%
associate-*r*99.1%
associate-*l*99.1%
*-commutative99.1%
*-commutative99.1%
associate-*l*99.1%
Simplified99.1%
if -9.00000000000000026e60 < l < -8.49999999999999953e-4 or 32000 < l < 7.59999999999999975e50Initial program 99.4%
Taylor expanded in K around 0 76.7%
if -8.49999999999999953e-4 < l < 32000Initial program 69.8%
Taylor expanded in l around 0 99.2%
Final simplification97.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (pow l 5.0) (* J (* 0.016666666666666666 (cos (* K 0.5))))))))
(if (<= l -3.3)
t_0
(if (<= l 0.002)
(+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))
(if (<= l 4.6e+51) (+ (* (- (exp l) (exp (- l))) J) U) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (pow(l, 5.0) * (J * (0.016666666666666666 * cos((K * 0.5)))));
double tmp;
if (l <= -3.3) {
tmp = t_0;
} else if (l <= 0.002) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 4.6e+51) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} 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) :: tmp
t_0 = u + ((l ** 5.0d0) * (j * (0.016666666666666666d0 * cos((k * 0.5d0)))))
if (l <= (-3.3d0)) then
tmp = t_0
else if (l <= 0.002d0) then
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
else if (l <= 4.6d+51) then
tmp = ((exp(l) - exp(-l)) * j) + u
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.pow(l, 5.0) * (J * (0.016666666666666666 * Math.cos((K * 0.5)))));
double tmp;
if (l <= -3.3) {
tmp = t_0;
} else if (l <= 0.002) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 4.6e+51) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.pow(l, 5.0) * (J * (0.016666666666666666 * math.cos((K * 0.5))))) tmp = 0 if l <= -3.3: tmp = t_0 elif l <= 0.002: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) elif l <= 4.6e+51: tmp = ((math.exp(l) - math.exp(-l)) * J) + U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64((l ^ 5.0) * Float64(J * Float64(0.016666666666666666 * cos(Float64(K * 0.5)))))) tmp = 0.0 if (l <= -3.3) tmp = t_0; elseif (l <= 0.002) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); elseif (l <= 4.6e+51) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((l ^ 5.0) * (J * (0.016666666666666666 * cos((K * 0.5))))); tmp = 0.0; if (l <= -3.3) tmp = t_0; elseif (l <= 0.002) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); elseif (l <= 4.6e+51) tmp = ((exp(l) - exp(-l)) * J) + U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Power[l, 5.0], $MachinePrecision] * N[(J * N[(0.016666666666666666 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.3], t$95$0, If[LessEqual[l, 0.002], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+51], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + {\ell}^{5} \cdot \left(J \cdot \left(0.016666666666666666 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{if}\;\ell \leq -3.3:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.002:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+51}:\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -3.2999999999999998 or 4.6000000000000001e51 < l Initial program 100.0%
Taylor expanded in l around 0 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in l around inf 93.7%
*-commutative93.7%
associate-*r*93.7%
associate-*l*93.7%
*-commutative93.7%
*-commutative93.7%
associate-*l*93.7%
Simplified93.7%
if -3.2999999999999998 < l < 2e-3Initial program 68.9%
Taylor expanded in l around 0 99.4%
associate-*r*99.4%
Simplified99.4%
if 2e-3 < l < 4.6000000000000001e51Initial program 100.0%
Taylor expanded in K around 0 81.3%
Final simplification95.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.0008) (not (<= l 0.0016))) (+ (* (- (exp l) (exp (- l))) J) U) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.0008) || !(l <= 0.0016)) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else {
tmp = U + (cos((K / 2.0)) * (l * (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) :: tmp
if ((l <= (-0.0008d0)) .or. (.not. (l <= 0.0016d0))) then
tmp = ((exp(l) - exp(-l)) * j) + u
else
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.0008) || !(l <= 0.0016)) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.0008) or not (l <= 0.0016): tmp = ((math.exp(l) - math.exp(-l)) * J) + U else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.0008) || !(l <= 0.0016)) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.0008) || ~((l <= 0.0016))) tmp = ((exp(l) - exp(-l)) * J) + U; else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.0008], N[Not[LessEqual[l, 0.0016]], $MachinePrecision]], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.0008 \lor \neg \left(\ell \leq 0.0016\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -8.00000000000000038e-4 or 0.00160000000000000008 < l Initial program 99.9%
Taylor expanded in K around 0 71.4%
if -8.00000000000000038e-4 < l < 0.00160000000000000008Initial program 68.8%
Taylor expanded in l around 0 99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification84.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.6e+51) (not (<= l 370000000.0))) (+ U (* 0.016666666666666666 (* J (pow l 5.0)))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.6e+51) || !(l <= 370000000.0)) {
tmp = U + (0.016666666666666666 * (J * pow(l, 5.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) :: tmp
if ((l <= (-4.6d+51)) .or. (.not. (l <= 370000000.0d0))) then
tmp = u + (0.016666666666666666d0 * (j * (l ** 5.0d0)))
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 tmp;
if ((l <= -4.6e+51) || !(l <= 370000000.0)) {
tmp = U + (0.016666666666666666 * (J * Math.pow(l, 5.0)));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4.6e+51) or not (l <= 370000000.0): tmp = U + (0.016666666666666666 * (J * math.pow(l, 5.0))) else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.6e+51) || !(l <= 370000000.0)) tmp = Float64(U + Float64(0.016666666666666666 * Float64(J * (l ^ 5.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) tmp = 0.0; if ((l <= -4.6e+51) || ~((l <= 370000000.0))) tmp = U + (0.016666666666666666 * (J * (l ^ 5.0))); else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.6e+51], N[Not[LessEqual[l, 370000000.0]], $MachinePrecision]], N[(U + N[(0.016666666666666666 * N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{+51} \lor \neg \left(\ell \leq 370000000\right):\\
\;\;\;\;U + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\\
\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 < -4.6000000000000001e51 or 3.7e8 < l Initial program 100.0%
Taylor expanded in l around 0 91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in l around inf 91.5%
*-commutative91.5%
associate-*r*91.5%
associate-*l*91.5%
*-commutative91.5%
*-commutative91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in K around 0 65.7%
if -4.6000000000000001e51 < l < 3.7e8Initial program 71.8%
Taylor expanded in l around 0 93.6%
Final simplification80.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.6e+51) (not (<= l 8000000.0))) (+ U (* 0.016666666666666666 (* J (pow l 5.0)))) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.6e+51) || !(l <= 8000000.0)) {
tmp = U + (0.016666666666666666 * (J * pow(l, 5.0)));
} else {
tmp = U + (cos((K / 2.0)) * (l * (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) :: tmp
if ((l <= (-4.6d+51)) .or. (.not. (l <= 8000000.0d0))) then
tmp = u + (0.016666666666666666d0 * (j * (l ** 5.0d0)))
else
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.6e+51) || !(l <= 8000000.0)) {
tmp = U + (0.016666666666666666 * (J * Math.pow(l, 5.0)));
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4.6e+51) or not (l <= 8000000.0): tmp = U + (0.016666666666666666 * (J * math.pow(l, 5.0))) else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.6e+51) || !(l <= 8000000.0)) tmp = Float64(U + Float64(0.016666666666666666 * Float64(J * (l ^ 5.0)))); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -4.6e+51) || ~((l <= 8000000.0))) tmp = U + (0.016666666666666666 * (J * (l ^ 5.0))); else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.6e+51], N[Not[LessEqual[l, 8000000.0]], $MachinePrecision]], N[(U + N[(0.016666666666666666 * N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{+51} \lor \neg \left(\ell \leq 8000000\right):\\
\;\;\;\;U + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -4.6000000000000001e51 or 8e6 < l Initial program 100.0%
Taylor expanded in l around 0 91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in l around inf 91.5%
*-commutative91.5%
associate-*r*91.5%
associate-*l*91.5%
*-commutative91.5%
*-commutative91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in K around 0 65.7%
if -4.6000000000000001e51 < l < 8e6Initial program 71.8%
Taylor expanded in l around 0 93.6%
associate-*r*93.6%
Simplified93.6%
Final simplification80.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.6e+51) (not (<= l 5200000.0))) (+ U (* 0.016666666666666666 (* J (pow l 5.0)))) (fma J (* l 2.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.6e+51) || !(l <= 5200000.0)) {
tmp = U + (0.016666666666666666 * (J * pow(l, 5.0)));
} else {
tmp = fma(J, (l * 2.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.6e+51) || !(l <= 5200000.0)) tmp = Float64(U + Float64(0.016666666666666666 * Float64(J * (l ^ 5.0)))); else tmp = fma(J, Float64(l * 2.0), U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.6e+51], N[Not[LessEqual[l, 5200000.0]], $MachinePrecision]], N[(U + N[(0.016666666666666666 * N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{+51} \lor \neg \left(\ell \leq 5200000\right):\\
\;\;\;\;U + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\end{array}
\end{array}
if l < -4.6000000000000001e51 or 5.2e6 < l Initial program 100.0%
Taylor expanded in l around 0 91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in l around inf 91.5%
*-commutative91.5%
associate-*r*91.5%
associate-*l*91.5%
*-commutative91.5%
*-commutative91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in K around 0 65.7%
if -4.6000000000000001e51 < l < 5.2e6Initial program 71.8%
Taylor expanded in l around 0 93.6%
*-commutative93.6%
associate-*r*93.6%
associate-*l*93.6%
*-commutative93.6%
*-commutative93.6%
associate-*l*93.6%
*-commutative93.6%
Simplified93.6%
Taylor expanded in K around 0 83.0%
+-commutative83.0%
*-commutative83.0%
associate-*r*83.0%
fma-define83.0%
Simplified83.0%
Final simplification74.6%
(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 85.4%
Taylor expanded in l around 0 63.9%
*-commutative63.9%
associate-*r*63.9%
associate-*l*63.9%
*-commutative63.9%
*-commutative63.9%
associate-*l*63.9%
*-commutative63.9%
Simplified63.9%
Taylor expanded in K around 0 54.9%
+-commutative54.9%
*-commutative54.9%
associate-*r*54.9%
fma-define54.9%
Simplified54.9%
Final simplification54.9%
(FPCore (J l K U) :precision binary64 (if (<= l -0.00085) (* U (- U -4.0)) (if (<= l 75000000000000.0) U (- -4.0 (* U U)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00085) {
tmp = U * (U - -4.0);
} else if (l <= 75000000000000.0) {
tmp = U;
} else {
tmp = -4.0 - (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 <= (-0.00085d0)) then
tmp = u * (u - (-4.0d0))
else if (l <= 75000000000000.0d0) then
tmp = u
else
tmp = (-4.0d0) - (u * u)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00085) {
tmp = U * (U - -4.0);
} else if (l <= 75000000000000.0) {
tmp = U;
} else {
tmp = -4.0 - (U * U);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -0.00085: tmp = U * (U - -4.0) elif l <= 75000000000000.0: tmp = U else: tmp = -4.0 - (U * U) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -0.00085) tmp = Float64(U * Float64(U - -4.0)); elseif (l <= 75000000000000.0) tmp = U; else tmp = Float64(-4.0 - Float64(U * U)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -0.00085) tmp = U * (U - -4.0); elseif (l <= 75000000000000.0) tmp = U; else tmp = -4.0 - (U * U); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.00085], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 75000000000000.0], U, N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.00085:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{elif}\;\ell \leq 75000000000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-4 - U \cdot U\\
\end{array}
\end{array}
if l < -8.49999999999999953e-4Initial program 99.8%
Applied egg-rr19.0%
if -8.49999999999999953e-4 < l < 7.5e13Initial program 70.3%
Taylor expanded in J around 0 66.6%
if 7.5e13 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr26.0%
cancel-sign-sub-inv26.0%
Simplified26.0%
Final simplification44.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -580.0) (not (<= l 1600.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -580.0) || !(l <= 1600.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 <= (-580.0d0)) .or. (.not. (l <= 1600.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 <= -580.0) || !(l <= 1600.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -580.0) or not (l <= 1600.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -580.0) || !(l <= 1600.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 <= -580.0) || ~((l <= 1600.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -580.0], N[Not[LessEqual[l, 1600.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -580 \lor \neg \left(\ell \leq 1600\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -580 or 1600 < l Initial program 100.0%
Applied egg-rr17.5%
if -580 < l < 1600Initial program 69.7%
Taylor expanded in J around 0 67.7%
Final simplification41.6%
(FPCore (J l K U) :precision binary64 (if (<= l -0.00085) (* U (- U -4.0)) (if (<= l 850.0) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00085) {
tmp = U * (U - -4.0);
} else if (l <= 850.0) {
tmp = U;
} else {
tmp = 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 <= (-0.00085d0)) then
tmp = u * (u - (-4.0d0))
else if (l <= 850.0d0) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00085) {
tmp = U * (U - -4.0);
} else if (l <= 850.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -0.00085: tmp = U * (U - -4.0) elif l <= 850.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -0.00085) tmp = Float64(U * Float64(U - -4.0)); elseif (l <= 850.0) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -0.00085) tmp = U * (U - -4.0); elseif (l <= 850.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.00085], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 850.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.00085:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{elif}\;\ell \leq 850:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -8.49999999999999953e-4Initial program 99.8%
Applied egg-rr19.0%
if -8.49999999999999953e-4 < l < 850Initial program 69.6%
Taylor expanded in J around 0 68.2%
if 850 < l Initial program 100.0%
Applied egg-rr16.1%
Final simplification41.6%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (J * 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 + (l * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Initial program 85.4%
Taylor expanded in l around 0 63.9%
*-commutative63.9%
associate-*r*63.9%
associate-*l*63.9%
*-commutative63.9%
*-commutative63.9%
associate-*l*63.9%
*-commutative63.9%
Simplified63.9%
Taylor expanded in K around 0 54.9%
*-commutative54.9%
Simplified54.9%
Final simplification54.9%
(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 85.4%
Applied egg-rr3.0%
*-inverses3.0%
Simplified3.0%
Final simplification3.0%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 85.4%
Taylor expanded in J around 0 33.7%
Final simplification33.7%
herbie shell --seed 2024067
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))