
(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 13 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 (cos (/ K 2.0))))
(if (<= l -4.1)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (<= l 880.0)
(+ U (* t_1 (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333))))))
(+ U (* t_1 (* J (- (exp l) t_0))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -4.1) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 880.0) {
tmp = U + (t_1 * (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333)))));
} else {
tmp = U + (t_1 * (J * (exp(l) - 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 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-4.1d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if (l <= 880.0d0) then
tmp = u + (t_1 * (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0)))))
else
tmp = u + (t_1 * (j * (exp(l) - t_0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -4.1) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 880.0) {
tmp = U + (t_1 * (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333)))));
} else {
tmp = U + (t_1 * (J * (Math.exp(l) - t_0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -4.1: tmp = U + (t_1 * (J * (27.0 - t_0))) elif l <= 880.0: tmp = U + (t_1 * (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333))))) else: tmp = U + (t_1 * (J * (math.exp(l) - t_0))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -4.1) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif (l <= 880.0) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333)))))); else tmp = Float64(U + Float64(t_1 * Float64(J * Float64(exp(l) - t_0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -4.1) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif (l <= 880.0) tmp = U + (t_1 * (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333))))); else tmp = U + (t_1 * (J * (exp(l) - t_0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.1], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 880.0], N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$1 * N[(J * N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -4.1:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 880:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(e^{\ell} - t\_0\right)\right)\\
\end{array}
\end{array}
if l < -4.0999999999999996Initial program 100.0%
Applied egg-rr100.0%
if -4.0999999999999996 < l < 880Initial program 75.7%
Taylor expanded in l around 0 99.6%
if 880 < l Initial program 100.0%
Final simplification99.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= l 880.0)
(+
(*
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+
0.3333333333333333
(*
(pow l 2.0)
(+
0.016666666666666666
(* (pow l 2.0) 0.0003968253968253968))))))))
t_0)
U)
(+ U (* t_0 (* J (- (exp l) (exp (- l)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (l <= 880.0) {
tmp = ((J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + (pow(l, 2.0) * (0.016666666666666666 + (pow(l, 2.0) * 0.0003968253968253968)))))))) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (exp(l) - 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) :: tmp
t_0 = cos((k / 2.0d0))
if (l <= 880.0d0) then
tmp = ((j * (l * (2.0d0 + ((l ** 2.0d0) * (0.3333333333333333d0 + ((l ** 2.0d0) * (0.016666666666666666d0 + ((l ** 2.0d0) * 0.0003968253968253968d0)))))))) * t_0) + u
else
tmp = u + (t_0 * (j * (exp(l) - exp(-l))))
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 tmp;
if (l <= 880.0) {
tmp = ((J * (l * (2.0 + (Math.pow(l, 2.0) * (0.3333333333333333 + (Math.pow(l, 2.0) * (0.016666666666666666 + (Math.pow(l, 2.0) * 0.0003968253968253968)))))))) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (Math.exp(l) - Math.exp(-l))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if l <= 880.0: tmp = ((J * (l * (2.0 + (math.pow(l, 2.0) * (0.3333333333333333 + (math.pow(l, 2.0) * (0.016666666666666666 + (math.pow(l, 2.0) * 0.0003968253968253968)))))))) * t_0) + U else: tmp = U + (t_0 * (J * (math.exp(l) - math.exp(-l)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= 880.0) tmp = Float64(Float64(Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64((l ^ 2.0) * Float64(0.016666666666666666 + Float64((l ^ 2.0) * 0.0003968253968253968)))))))) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(exp(l) - exp(Float64(-l)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (l <= 880.0) tmp = ((J * (l * (2.0 + ((l ^ 2.0) * (0.3333333333333333 + ((l ^ 2.0) * (0.016666666666666666 + ((l ^ 2.0) * 0.0003968253968253968)))))))) * t_0) + U; else tmp = U + (t_0 * (J * (exp(l) - exp(-l)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 880.0], N[(N[(N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.016666666666666666 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq 880:\\
\;\;\;\;\left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + {\ell}^{2} \cdot \left(0.016666666666666666 + {\ell}^{2} \cdot 0.0003968253968253968\right)\right)\right)\right)\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)\\
\end{array}
\end{array}
if l < 880Initial program 84.1%
Taylor expanded in l around 0 97.9%
*-commutative97.9%
Simplified97.9%
if 880 < l Initial program 100.0%
Final simplification98.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.69)
(+ U (* J (* (pow K 2.0) (* l -0.25))))
(if (<= t_0 0.22)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(+ U (* 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 tmp;
if (t_0 <= -0.69) {
tmp = U + (J * (pow(K, 2.0) * (l * -0.25)));
} else if (t_0 <= 0.22) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333))));
}
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((k / 2.0d0))
if (t_0 <= (-0.69d0)) then
tmp = u + (j * ((k ** 2.0d0) * (l * (-0.25d0))))
else if (t_0 <= 0.22d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u + (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0))))
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 tmp;
if (t_0 <= -0.69) {
tmp = U + (J * (Math.pow(K, 2.0) * (l * -0.25)));
} else if (t_0 <= 0.22) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (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)) tmp = 0 if t_0 <= -0.69: tmp = U + (J * (math.pow(K, 2.0) * (l * -0.25))) elif t_0 <= 0.22: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U + (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)) tmp = 0.0 if (t_0 <= -0.69) tmp = Float64(U + Float64(J * Float64((K ^ 2.0) * Float64(l * -0.25)))); elseif (t_0 <= 0.22) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.69) tmp = U + (J * ((K ^ 2.0) * (l * -0.25))); elseif (t_0 <= 0.22) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U + (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]}, If[LessEqual[t$95$0, -0.69], N[(U + N[(J * N[(N[Power[K, 2.0], $MachinePrecision] * N[(l * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.22], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.69:\\
\;\;\;\;U + J \cdot \left({K}^{2} \cdot \left(\ell \cdot -0.25\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0.22:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.68999999999999995Initial program 93.0%
Taylor expanded in l around 0 57.4%
Taylor expanded in K around 0 56.2%
Taylor expanded in K around inf 78.5%
*-commutative78.5%
associate-*r*70.9%
associate-*r*70.9%
associate-*l*78.5%
Simplified78.5%
if -0.68999999999999995 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.220000000000000001Initial program 91.5%
Taylor expanded in l around 0 78.4%
if 0.220000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.0%
Taylor expanded in l around 0 96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in K around 0 94.0%
Taylor expanded in l around 0 87.7%
*-commutative87.7%
Simplified87.7%
Final simplification84.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= l -4.1)
(+ U (* t_0 (* J (- 27.0 (exp (- l))))))
(if (<= l 2.2)
(+ U (* t_0 (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333))))))
(+ U (* t_0 (* (* J 0.0003968253968253968) (pow l 7.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (l <= -4.1) {
tmp = U + (t_0 * (J * (27.0 - exp(-l))));
} else if (l <= 2.2) {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333)))));
} else {
tmp = U + (t_0 * ((J * 0.0003968253968253968) * pow(l, 7.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((k / 2.0d0))
if (l <= (-4.1d0)) then
tmp = u + (t_0 * (j * (27.0d0 - exp(-l))))
else if (l <= 2.2d0) then
tmp = u + (t_0 * (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0)))))
else
tmp = u + (t_0 * ((j * 0.0003968253968253968d0) * (l ** 7.0d0)))
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 tmp;
if (l <= -4.1) {
tmp = U + (t_0 * (J * (27.0 - Math.exp(-l))));
} else if (l <= 2.2) {
tmp = U + (t_0 * (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333)))));
} else {
tmp = U + (t_0 * ((J * 0.0003968253968253968) * Math.pow(l, 7.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if l <= -4.1: tmp = U + (t_0 * (J * (27.0 - math.exp(-l)))) elif l <= 2.2: tmp = U + (t_0 * (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333))))) else: tmp = U + (t_0 * ((J * 0.0003968253968253968) * math.pow(l, 7.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -4.1) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(27.0 - exp(Float64(-l)))))); elseif (l <= 2.2) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333)))))); else tmp = Float64(U + Float64(t_0 * Float64(Float64(J * 0.0003968253968253968) * (l ^ 7.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (l <= -4.1) tmp = U + (t_0 * (J * (27.0 - exp(-l)))); elseif (l <= 2.2) tmp = U + (t_0 * (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333))))); else tmp = U + (t_0 * ((J * 0.0003968253968253968) * (l ^ 7.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.1], N[(U + N[(t$95$0 * N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.2], 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], N[(U + N[(t$95$0 * N[(N[(J * 0.0003968253968253968), $MachinePrecision] * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -4.1:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(27 - e^{-\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 2.2:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(\left(J \cdot 0.0003968253968253968\right) \cdot {\ell}^{7}\right)\\
\end{array}
\end{array}
if l < -4.0999999999999996Initial program 100.0%
Applied egg-rr100.0%
if -4.0999999999999996 < l < 2.2000000000000002Initial program 76.1%
Taylor expanded in l around 0 99.6%
if 2.2000000000000002 < l Initial program 98.8%
Taylor expanded in l around 0 93.6%
*-commutative93.6%
Simplified93.6%
Taylor expanded in l around inf 93.6%
associate-*r*93.6%
*-commutative93.6%
Simplified93.6%
Final simplification97.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= l -3.5)
(+ U (* t_0 (* J (- 27.0 (exp (- l))))))
(if (<= l 2.2)
(+ U (* t_0 (* J (* l 2.0))))
(+ U (* t_0 (* (* J 0.0003968253968253968) (pow l 7.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (l <= -3.5) {
tmp = U + (t_0 * (J * (27.0 - exp(-l))));
} else if (l <= 2.2) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (t_0 * ((J * 0.0003968253968253968) * pow(l, 7.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((k / 2.0d0))
if (l <= (-3.5d0)) then
tmp = u + (t_0 * (j * (27.0d0 - exp(-l))))
else if (l <= 2.2d0) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else
tmp = u + (t_0 * ((j * 0.0003968253968253968d0) * (l ** 7.0d0)))
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 tmp;
if (l <= -3.5) {
tmp = U + (t_0 * (J * (27.0 - Math.exp(-l))));
} else if (l <= 2.2) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (t_0 * ((J * 0.0003968253968253968) * Math.pow(l, 7.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if l <= -3.5: tmp = U + (t_0 * (J * (27.0 - math.exp(-l)))) elif l <= 2.2: tmp = U + (t_0 * (J * (l * 2.0))) else: tmp = U + (t_0 * ((J * 0.0003968253968253968) * math.pow(l, 7.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -3.5) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(27.0 - exp(Float64(-l)))))); elseif (l <= 2.2) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U + Float64(t_0 * Float64(Float64(J * 0.0003968253968253968) * (l ^ 7.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (l <= -3.5) tmp = U + (t_0 * (J * (27.0 - exp(-l)))); elseif (l <= 2.2) tmp = U + (t_0 * (J * (l * 2.0))); else tmp = U + (t_0 * ((J * 0.0003968253968253968) * (l ^ 7.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.5], N[(U + N[(t$95$0 * N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.2], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(N[(J * 0.0003968253968253968), $MachinePrecision] * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -3.5:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(27 - e^{-\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 2.2:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(\left(J \cdot 0.0003968253968253968\right) \cdot {\ell}^{7}\right)\\
\end{array}
\end{array}
if l < -3.5Initial program 100.0%
Applied egg-rr100.0%
if -3.5 < l < 2.2000000000000002Initial program 76.1%
Taylor expanded in l around 0 99.4%
if 2.2000000000000002 < l Initial program 98.8%
Taylor expanded in l around 0 93.6%
*-commutative93.6%
Simplified93.6%
Taylor expanded in l around inf 93.6%
associate-*r*93.6%
*-commutative93.6%
Simplified93.6%
Final simplification97.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= l -3.5)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (<= l 880.0)
(+ U (* t_1 (* J (* l 2.0))))
(+ U (* J (- (exp l) t_0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -3.5) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 880.0) {
tmp = U + (t_1 * (J * (l * 2.0)));
} else {
tmp = U + (J * (exp(l) - 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 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-3.5d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if (l <= 880.0d0) then
tmp = u + (t_1 * (j * (l * 2.0d0)))
else
tmp = u + (j * (exp(l) - t_0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -3.5) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 880.0) {
tmp = U + (t_1 * (J * (l * 2.0)));
} else {
tmp = U + (J * (Math.exp(l) - t_0));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -3.5: tmp = U + (t_1 * (J * (27.0 - t_0))) elif l <= 880.0: tmp = U + (t_1 * (J * (l * 2.0))) else: tmp = U + (J * (math.exp(l) - t_0)) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -3.5) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif (l <= 880.0) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U + Float64(J * Float64(exp(l) - t_0))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -3.5) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif (l <= 880.0) tmp = U + (t_1 * (J * (l * 2.0))); else tmp = U + (J * (exp(l) - t_0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.5], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 880.0], N[(U + N[(t$95$1 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -3.5:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 880:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - t\_0\right)\\
\end{array}
\end{array}
if l < -3.5Initial program 100.0%
Applied egg-rr100.0%
if -3.5 < l < 880Initial program 75.7%
Taylor expanded in l around 0 99.4%
if 880 < l Initial program 100.0%
Taylor expanded in K around 0 71.2%
Final simplification91.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.345) (+ U (* J (* (pow K 2.0) (* l -0.25)))) (+ U (* 0.0003968253968253968 (* J (pow l 7.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.345) {
tmp = U + (J * (pow(K, 2.0) * (l * -0.25)));
} else {
tmp = U + (0.0003968253968253968 * (J * pow(l, 7.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.345d0)) then
tmp = u + (j * ((k ** 2.0d0) * (l * (-0.25d0))))
else
tmp = u + (0.0003968253968253968d0 * (j * (l ** 7.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.345) {
tmp = U + (J * (Math.pow(K, 2.0) * (l * -0.25)));
} else {
tmp = U + (0.0003968253968253968 * (J * Math.pow(l, 7.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.345: tmp = U + (J * (math.pow(K, 2.0) * (l * -0.25))) else: tmp = U + (0.0003968253968253968 * (J * math.pow(l, 7.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.345) tmp = Float64(U + Float64(J * Float64((K ^ 2.0) * Float64(l * -0.25)))); else tmp = Float64(U + Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.345) tmp = U + (J * ((K ^ 2.0) * (l * -0.25))); else tmp = U + (0.0003968253968253968 * (J * (l ^ 7.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.345], N[(U + N[(J * N[(N[Power[K, 2.0], $MachinePrecision] * N[(l * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.345:\\
\;\;\;\;U + J \cdot \left({K}^{2} \cdot \left(\ell \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.34499999999999997Initial program 93.7%
Taylor expanded in l around 0 63.3%
Taylor expanded in K around 0 53.3%
Taylor expanded in K around inf 75.1%
*-commutative75.1%
associate-*r*68.3%
associate-*r*68.3%
associate-*l*75.1%
Simplified75.1%
if -0.34499999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.2%
Taylor expanded in l around 0 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in K around 0 90.5%
Taylor expanded in l around inf 80.9%
Final simplification79.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.345) (+ U (* J (* (pow K 2.0) (* l -0.25)))) (+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.345) {
tmp = U + (J * (pow(K, 2.0) * (l * -0.25)));
} else {
tmp = U + (J * (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.345d0)) then
tmp = u + (j * ((k ** 2.0d0) * (l * (-0.25d0))))
else
tmp = u + (j * (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.345) {
tmp = U + (J * (Math.pow(K, 2.0) * (l * -0.25)));
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.345: tmp = U + (J * (math.pow(K, 2.0) * (l * -0.25))) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.345) tmp = Float64(U + Float64(J * Float64((K ^ 2.0) * Float64(l * -0.25)))); else tmp = Float64(U + Float64(J * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.345) tmp = U + (J * ((K ^ 2.0) * (l * -0.25))); else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.345], N[(U + N[(J * N[(N[Power[K, 2.0], $MachinePrecision] * N[(l * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.345:\\
\;\;\;\;U + J \cdot \left({K}^{2} \cdot \left(\ell \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.34499999999999997Initial program 93.7%
Taylor expanded in l around 0 63.3%
Taylor expanded in K around 0 53.3%
Taylor expanded in K around inf 75.1%
*-commutative75.1%
associate-*r*68.3%
associate-*r*68.3%
associate-*l*75.1%
Simplified75.1%
if -0.34499999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.2%
Taylor expanded in l around 0 63.6%
Taylor expanded in K around 0 40.9%
Taylor expanded in K around 0 58.9%
*-commutative58.9%
associate-*r*58.9%
Simplified58.9%
Final simplification62.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.58) (+ U (+ (* -0.25 (* J (* l (* K K)))) (* 2.0 (* l J)))) (+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.58) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} else {
tmp = U + (J * (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.58d0)) then
tmp = u + (((-0.25d0) * (j * (l * (k * k)))) + (2.0d0 * (l * j)))
else
tmp = u + (j * (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.58) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.58: tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.58) tmp = Float64(U + Float64(Float64(-0.25 * Float64(J * Float64(l * Float64(K * K)))) + Float64(2.0 * Float64(l * J)))); else tmp = Float64(U + Float64(J * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.58) tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))); else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.58], N[(U + N[(N[(-0.25 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.58:\\
\;\;\;\;U + \left(-0.25 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.57999999999999996Initial program 91.9%
Taylor expanded in l around 0 59.9%
Taylor expanded in K around 0 54.1%
unpow254.1%
Applied egg-rr54.1%
if -0.57999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.0%
Taylor expanded in l around 0 64.3%
Taylor expanded in K around 0 41.4%
Taylor expanded in K around 0 58.9%
*-commutative58.9%
associate-*r*58.9%
Simplified58.9%
Final simplification58.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.9e+20) (not (<= l 1.6e+30))) (+ U (* 0.0003968253968253968 (* J (pow l 7.0)))) (+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.9e+20) || !(l <= 1.6e+30)) {
tmp = U + (0.0003968253968253968 * (J * pow(l, 7.0)));
} else {
tmp = U + (cos((K / 2.0)) * (J * (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 <= (-4.9d+20)) .or. (.not. (l <= 1.6d+30))) then
tmp = u + (0.0003968253968253968d0 * (j * (l ** 7.0d0)))
else
tmp = u + (cos((k / 2.0d0)) * (j * (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 <= -4.9e+20) || !(l <= 1.6e+30)) {
tmp = U + (0.0003968253968253968 * (J * Math.pow(l, 7.0)));
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4.9e+20) or not (l <= 1.6e+30): tmp = U + (0.0003968253968253968 * (J * math.pow(l, 7.0))) else: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.9e+20) || !(l <= 1.6e+30)) tmp = Float64(U + Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0)))); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -4.9e+20) || ~((l <= 1.6e+30))) tmp = U + (0.0003968253968253968 * (J * (l ^ 7.0))); else tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.9e+20], N[Not[LessEqual[l, 1.6e+30]], $MachinePrecision]], N[(U + N[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{+20} \lor \neg \left(\ell \leq 1.6 \cdot 10^{+30}\right):\\
\;\;\;\;U + 0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -4.9e20 or 1.59999999999999986e30 < l Initial program 100.0%
Taylor expanded in l around 0 97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in K around 0 69.9%
Taylor expanded in l around inf 69.9%
if -4.9e20 < l < 1.59999999999999986e30Initial program 77.0%
Taylor expanded in l around 0 94.9%
Final simplification82.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.9e+20) (not (<= l 1.6e+30))) (+ U (* 0.0003968253968253968 (* J (pow l 7.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.9e+20) || !(l <= 1.6e+30)) {
tmp = U + (0.0003968253968253968 * (J * pow(l, 7.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.9d+20)) .or. (.not. (l <= 1.6d+30))) then
tmp = u + (0.0003968253968253968d0 * (j * (l ** 7.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.9e+20) || !(l <= 1.6e+30)) {
tmp = U + (0.0003968253968253968 * (J * Math.pow(l, 7.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.9e+20) or not (l <= 1.6e+30): tmp = U + (0.0003968253968253968 * (J * math.pow(l, 7.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.9e+20) || !(l <= 1.6e+30)) tmp = Float64(U + Float64(0.0003968253968253968 * Float64(J * (l ^ 7.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.9e+20) || ~((l <= 1.6e+30))) tmp = U + (0.0003968253968253968 * (J * (l ^ 7.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.9e+20], N[Not[LessEqual[l, 1.6e+30]], $MachinePrecision]], N[(U + N[(0.0003968253968253968 * N[(J * N[Power[l, 7.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.9 \cdot 10^{+20} \lor \neg \left(\ell \leq 1.6 \cdot 10^{+30}\right):\\
\;\;\;\;U + 0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\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.9e20 or 1.59999999999999986e30 < l Initial program 100.0%
Taylor expanded in l around 0 97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in K around 0 69.9%
Taylor expanded in l around inf 69.9%
if -4.9e20 < l < 1.59999999999999986e30Initial program 77.0%
Taylor expanded in l around 0 94.9%
Final simplification82.3%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (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 * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 88.6%
Taylor expanded in l around 0 63.5%
Taylor expanded in K around 0 43.5%
Taylor expanded in K around 0 53.4%
*-commutative53.4%
associate-*r*53.4%
Simplified53.4%
Final simplification53.4%
(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 88.6%
Applied egg-rr27.2%
Taylor expanded in J around 0 36.4%
herbie shell --seed 2024110
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))