
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -1.0) (not (<= t_1 0.0)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0)))))))))
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 <= -1.0) || !(t_1 <= 0.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.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((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-1.0d0)) .or. (.not. (t_1 <= 0.0d0))) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.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 t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -1.0) || !(t_1 <= 0.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0)))));
}
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 <= -1.0) or not (t_1 <= 0.0): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0))))) 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 <= -1.0) || !(t_1 <= 0.0)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0)))))); 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 <= -1.0) || ~((t_1 <= 0.0))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0))))); 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, -1.0], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $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 -1 \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -1 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -1 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 68.3%
Taylor expanded in l around 0 99.9%
distribute-rgt-in99.9%
*-commutative99.9%
associate-*l*99.9%
unpow299.9%
pow399.9%
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -1.1e+101)
(not (or (<= l -0.006) (and (not (<= l 9e-19)) (<= l 1.05e+100)))))
(+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l)))))))
(+ (* (- (exp l) (exp (- l))) J) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.1e+101) || !((l <= -0.006) || (!(l <= 9e-19) && (l <= 1.05e+100)))) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = ((exp(l) - exp(-l)) * J) + U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.1d+101)) .or. (.not. (l <= (-0.006d0)) .or. (.not. (l <= 9d-19)) .and. (l <= 1.05d+100))) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
else
tmp = ((exp(l) - exp(-l)) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.1e+101) || !((l <= -0.006) || (!(l <= 9e-19) && (l <= 1.05e+100)))) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.1e+101) or not ((l <= -0.006) or (not (l <= 9e-19) and (l <= 1.05e+100))): tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) else: tmp = ((math.exp(l) - math.exp(-l)) * J) + U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.1e+101) || !((l <= -0.006) || (!(l <= 9e-19) && (l <= 1.05e+100)))) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.1e+101) || ~(((l <= -0.006) || (~((l <= 9e-19)) && (l <= 1.05e+100))))) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); else tmp = ((exp(l) - exp(-l)) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.1e+101], N[Not[Or[LessEqual[l, -0.006], And[N[Not[LessEqual[l, 9e-19]], $MachinePrecision], LessEqual[l, 1.05e+100]]]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{+101} \lor \neg \left(\ell \leq -0.006 \lor \neg \left(\ell \leq 9 \cdot 10^{-19}\right) \land \ell \leq 1.05 \cdot 10^{+100}\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\end{array}
\end{array}
if l < -1.1e101 or -0.0060000000000000001 < l < 9.00000000000000026e-19 or 1.0499999999999999e100 < l Initial program 81.5%
Taylor expanded in l around 0 99.9%
unpow299.9%
Applied egg-rr99.9%
if -1.1e101 < l < -0.0060000000000000001 or 9.00000000000000026e-19 < l < 1.0499999999999999e100Initial program 100.0%
Taylor expanded in K around 0 82.2%
Final simplification96.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= l -85000.0)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (<= l 9e-19)
(+ U (* t_1 (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0))))))
(if (<= l 1.05e+100)
(+ (* (- (exp l) t_0) J) U)
(+ U (* t_1 (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l))))))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -85000.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 9e-19) {
tmp = U + (t_1 * (J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.0)))));
} else if (l <= 1.05e+100) {
tmp = ((exp(l) - t_0) * J) + U;
} else {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-85000.0d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if (l <= 9d-19) then
tmp = u + (t_1 * (j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.0d0)))))
else if (l <= 1.05d+100) then
tmp = ((exp(l) - t_0) * j) + u
else
tmp = u + (t_1 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -85000.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 9e-19) {
tmp = U + (t_1 * (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0)))));
} else if (l <= 1.05e+100) {
tmp = ((Math.exp(l) - t_0) * J) + U;
} else {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -85000.0: tmp = U + (t_1 * (J * (27.0 - t_0))) elif l <= 9e-19: tmp = U + (t_1 * (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0))))) elif l <= 1.05e+100: tmp = ((math.exp(l) - t_0) * J) + U else: tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -85000.0) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif (l <= 9e-19) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0)))))); elseif (l <= 1.05e+100) tmp = Float64(Float64(Float64(exp(l) - t_0) * J) + U); else tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -85000.0) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif (l <= 9e-19) tmp = U + (t_1 * (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0))))); elseif (l <= 1.05e+100) tmp = ((exp(l) - t_0) * J) + U; else tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -85000.0], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9e-19], N[(U + N[(t$95$1 * N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.05e+100], N[(N[(N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -85000:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 9 \cdot 10^{-19}:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{+100}:\\
\;\;\;\;\left(e^{\ell} - t\_0\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\end{array}
\end{array}
if l < -85000Initial program 100.0%
Applied egg-rr100.0%
if -85000 < l < 9.00000000000000026e-19Initial program 68.5%
Taylor expanded in l around 0 99.4%
distribute-rgt-in99.4%
*-commutative99.4%
associate-*l*99.4%
unpow299.4%
pow399.4%
Applied egg-rr99.4%
if 9.00000000000000026e-19 < l < 1.0499999999999999e100Initial program 100.0%
Taylor expanded in K around 0 78.6%
if 1.0499999999999999e100 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
unpow2100.0%
Applied egg-rr100.0%
Final simplification97.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= l -85000.0)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (or (<= l 9e-19) (not (<= l 2.1e+99)))
(+ U (* t_1 (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l)))))))
(+ (* (- (exp l) t_0) J) U)))))
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 <= -85000.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if ((l <= 9e-19) || !(l <= 2.1e+99)) {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = ((exp(l) - t_0) * J) + U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-85000.0d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if ((l <= 9d-19) .or. (.not. (l <= 2.1d+99))) then
tmp = u + (t_1 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
else
tmp = ((exp(l) - t_0) * j) + u
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 <= -85000.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if ((l <= 9e-19) || !(l <= 2.1e+99)) {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = ((Math.exp(l) - t_0) * J) + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -85000.0: tmp = U + (t_1 * (J * (27.0 - t_0))) elif (l <= 9e-19) or not (l <= 2.1e+99): tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) else: tmp = ((math.exp(l) - t_0) * J) + U 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 <= -85000.0) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif ((l <= 9e-19) || !(l <= 2.1e+99)) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = Float64(Float64(Float64(exp(l) - t_0) * J) + U); 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 <= -85000.0) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif ((l <= 9e-19) || ~((l <= 2.1e+99))) tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); else tmp = ((exp(l) - t_0) * J) + U; 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, -85000.0], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 9e-19], N[Not[LessEqual[l, 2.1e+99]], $MachinePrecision]], N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -85000:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 9 \cdot 10^{-19} \lor \neg \left(\ell \leq 2.1 \cdot 10^{+99}\right):\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{\ell} - t\_0\right) \cdot J + U\\
\end{array}
\end{array}
if l < -85000Initial program 100.0%
Applied egg-rr100.0%
if -85000 < l < 9.00000000000000026e-19 or 2.1000000000000001e99 < l Initial program 76.6%
Taylor expanded in l around 0 99.5%
unpow299.5%
Applied egg-rr99.5%
if 9.00000000000000026e-19 < l < 2.1000000000000001e99Initial program 100.0%
Taylor expanded in K around 0 78.6%
Final simplification97.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.65) (* U (+ 1.0 (* J (/ (* (* l 2.0) (cos (* K 0.5))) U)))) (+ U (+ (* J (* 0.3333333333333333 (pow l 3.0))) (* J (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.65) {
tmp = U * (1.0 + (J * (((l * 2.0) * cos((K * 0.5))) / U)));
} else {
tmp = U + ((J * (0.3333333333333333 * pow(l, 3.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 (cos((k / 2.0d0)) <= 0.65d0) then
tmp = u * (1.0d0 + (j * (((l * 2.0d0) * cos((k * 0.5d0))) / u)))
else
tmp = u + ((j * (0.3333333333333333d0 * (l ** 3.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 (Math.cos((K / 2.0)) <= 0.65) {
tmp = U * (1.0 + (J * (((l * 2.0) * Math.cos((K * 0.5))) / U)));
} else {
tmp = U + ((J * (0.3333333333333333 * Math.pow(l, 3.0))) + (J * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.65: tmp = U * (1.0 + (J * (((l * 2.0) * math.cos((K * 0.5))) / U))) else: tmp = U + ((J * (0.3333333333333333 * math.pow(l, 3.0))) + (J * (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.65) tmp = Float64(U * Float64(1.0 + Float64(J * Float64(Float64(Float64(l * 2.0) * cos(Float64(K * 0.5))) / U)))); else tmp = Float64(U + Float64(Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))) + 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.65) tmp = U * (1.0 + (J * (((l * 2.0) * cos((K * 0.5))) / U))); else tmp = U + ((J * (0.3333333333333333 * (l ^ 3.0))) + (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.65], N[(U * N[(1.0 + N[(J * N[(N[(N[(l * 2.0), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.65:\\
\;\;\;\;U \cdot \left(1 + J \cdot \frac{\left(\ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)}{U}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right) + J \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.650000000000000022Initial program 83.6%
Taylor expanded in l around 0 87.1%
distribute-rgt-in87.1%
*-commutative87.1%
associate-*l*87.1%
unpow287.1%
pow387.1%
Applied egg-rr87.1%
Taylor expanded in U around inf 89.9%
associate-/l*89.9%
*-commutative89.9%
fma-define89.9%
Simplified89.9%
Taylor expanded in l around 0 69.7%
associate-*r/69.7%
associate-*r*69.7%
*-commutative69.7%
Simplified69.7%
if 0.650000000000000022 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.5%
Taylor expanded in l around 0 90.3%
Taylor expanded in K around 0 89.4%
distribute-lft-in89.4%
distribute-rgt-in89.4%
*-commutative89.4%
associate-*l*89.4%
unpow289.4%
pow389.4%
Applied egg-rr89.4%
Final simplification81.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (* J (* l 2.0))))
(if (<= t_0 -0.02)
(+ U (* t_0 t_1))
(+ U (+ (* J (* 0.3333333333333333 (pow l 3.0))) t_1)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = J * (l * 2.0);
double tmp;
if (t_0 <= -0.02) {
tmp = U + (t_0 * t_1);
} else {
tmp = U + ((J * (0.3333333333333333 * pow(l, 3.0))) + 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) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = j * (l * 2.0d0)
if (t_0 <= (-0.02d0)) then
tmp = u + (t_0 * t_1)
else
tmp = u + ((j * (0.3333333333333333d0 * (l ** 3.0d0))) + 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 = J * (l * 2.0);
double tmp;
if (t_0 <= -0.02) {
tmp = U + (t_0 * t_1);
} else {
tmp = U + ((J * (0.3333333333333333 * Math.pow(l, 3.0))) + t_1);
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = J * (l * 2.0) tmp = 0 if t_0 <= -0.02: tmp = U + (t_0 * t_1) else: tmp = U + ((J * (0.3333333333333333 * math.pow(l, 3.0))) + t_1) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(J * Float64(l * 2.0)) tmp = 0.0 if (t_0 <= -0.02) tmp = Float64(U + Float64(t_0 * t_1)); else tmp = Float64(U + Float64(Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))) + t_1)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = J * (l * 2.0); tmp = 0.0; if (t_0 <= -0.02) tmp = U + (t_0 * t_1); else tmp = U + ((J * (0.3333333333333333 * (l ^ 3.0))) + 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[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.02], N[(U + N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := J \cdot \left(\ell \cdot 2\right)\\
\mathbf{if}\;t\_0 \leq -0.02:\\
\;\;\;\;U + t\_0 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right) + t\_1\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 79.9%
Taylor expanded in l around 0 55.1%
*-commutative55.1%
associate-*l*55.1%
Simplified55.1%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.2%
Taylor expanded in l around 0 89.3%
Taylor expanded in K around 0 86.6%
distribute-lft-in86.6%
distribute-rgt-in86.6%
*-commutative86.6%
associate-*l*86.6%
unpow286.6%
pow386.6%
Applied egg-rr86.6%
Final simplification79.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.02)
(+ U (* t_0 (* J (* l 2.0))))
(+ U (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.02) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.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 (t_0 <= (-0.02d0)) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else
tmp = u + (j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.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 (t_0 <= -0.02) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.02: tmp = U + (t_0 * (J * (l * 2.0))) else: tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.02) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U + Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0))))); 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.02) tmp = U + (t_0 * (J * (l * 2.0))); else tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.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[t$95$0, -0.02], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $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.02:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 79.9%
Taylor expanded in l around 0 55.1%
*-commutative55.1%
associate-*l*55.1%
Simplified55.1%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.2%
Taylor expanded in l around 0 89.3%
Taylor expanded in K around 0 86.6%
distribute-rgt-in89.4%
*-commutative89.4%
associate-*l*89.4%
unpow289.4%
pow389.4%
Applied egg-rr86.6%
Final simplification79.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.02)
(+ U (* t_0 (* J (* l 2.0))))
(+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.02) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l * l)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= (-0.02d0)) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= -0.02) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l * l)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.02: tmp = U + (t_0 * (J * (l * 2.0))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l * l))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.02) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.02) tmp = U + (t_0 * (J * (l * 2.0))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l * 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[t$95$0, -0.02], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $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.02:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0200000000000000004Initial program 79.9%
Taylor expanded in l around 0 55.1%
*-commutative55.1%
associate-*l*55.1%
Simplified55.1%
if -0.0200000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.2%
Taylor expanded in l around 0 89.3%
Taylor expanded in K around 0 86.6%
unpow289.3%
Applied egg-rr86.6%
Final simplification79.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.85e-7) (not (<= l 1.66e-31))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l)))))) (+ U (* l (* (cos (* K 0.5)) (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.85e-7) || !(l <= 1.66e-31)) {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l * l)))));
} else {
tmp = U + (l * (cos((K * 0.5)) * (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 <= (-1.85d-7)) .or. (.not. (l <= 1.66d-31))) then
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l)))))
else
tmp = u + (l * (cos((k * 0.5d0)) * (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 <= -1.85e-7) || !(l <= 1.66e-31)) {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l * l)))));
} else {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.85e-7) or not (l <= 1.66e-31): tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l * l))))) else: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.85e-7) || !(l <= 1.66e-31)) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l)))))); else tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.85e-7) || ~((l <= 1.66e-31))) tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l * l))))); else tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.85e-7], N[Not[LessEqual[l, 1.66e-31]], $MachinePrecision]], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.85 \cdot 10^{-7} \lor \neg \left(\ell \leq 1.66 \cdot 10^{-31}\right):\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -1.85000000000000002e-7 or 1.66000000000000002e-31 < l Initial program 98.4%
Taylor expanded in l around 0 80.1%
Taylor expanded in K around 0 61.4%
unpow280.1%
Applied egg-rr61.4%
if -1.85000000000000002e-7 < l < 1.66000000000000002e-31Initial program 68.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.1%
Simplified99.1%
Final simplification78.5%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l))))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)
\end{array}
Initial program 84.8%
Taylor expanded in l around 0 89.1%
unpow289.1%
Applied egg-rr89.1%
Final simplification89.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.66) (not (<= l 3.5e+39))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.66) || !(l <= 3.5e+39)) {
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 <= (-0.66d0)) .or. (.not. (l <= 3.5d+39))) 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 <= -0.66) || !(l <= 3.5e+39)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.66) or not (l <= 3.5e+39): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.66) || !(l <= 3.5e+39)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.66) || ~((l <= 3.5e+39))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.66], N[Not[LessEqual[l, 3.5e+39]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.66 \lor \neg \left(\ell \leq 3.5 \cdot 10^{+39}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -0.660000000000000031 or 3.5000000000000002e39 < l Initial program 100.0%
Applied egg-rr18.5%
if -0.660000000000000031 < l < 3.5000000000000002e39Initial program 70.7%
Taylor expanded in J around 0 63.0%
Final simplification41.6%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l)))))))
double code(double J, double l, double K, double U) {
return U + (J * (l * (2.0 + (0.3333333333333333 * (l * l)))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * (2.0 + (0.3333333333333333 * (l * l)))));
}
def code(J, l, K, U): return U + (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l)))))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l * l))))); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)
\end{array}
Initial program 84.8%
Taylor expanded in l around 0 89.1%
Taylor expanded in K around 0 72.1%
unpow289.1%
Applied egg-rr72.1%
Final simplification72.1%
(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 84.8%
Taylor expanded in l around 0 89.1%
Taylor expanded in K around 0 72.1%
Taylor expanded in l around 0 52.9%
associate-*r*52.9%
*-commutative52.9%
Simplified52.9%
Final simplification52.9%
(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.8%
Taylor expanded in J around 0 33.8%
(FPCore (J l K U) :precision binary64 -0.3333333333333333)
double code(double J, double l, double K, double U) {
return -0.3333333333333333;
}
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 = -0.3333333333333333d0
end function
public static double code(double J, double l, double K, double U) {
return -0.3333333333333333;
}
def code(J, l, K, U): return -0.3333333333333333
function code(J, l, K, U) return -0.3333333333333333 end
function tmp = code(J, l, K, U) tmp = -0.3333333333333333; end
code[J_, l_, K_, U_] := -0.3333333333333333
\begin{array}{l}
\\
-0.3333333333333333
\end{array}
Initial program 84.8%
Applied egg-rr2.5%
associate-+r+2.5%
+-commutative2.5%
distribute-rgt1-in2.5%
metadata-eval2.5%
*-commutative2.5%
distribute-lft-out2.5%
associate-/r*2.4%
*-inverses2.4%
*-commutative2.4%
Simplified2.4%
Taylor expanded in U around 0 2.7%
(FPCore (J l K U) :precision binary64 -4.0)
double code(double J, double l, double K, double U) {
return -4.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = -4.0d0
end function
public static double code(double J, double l, double K, double U) {
return -4.0;
}
def code(J, l, K, U): return -4.0
function code(J, l, K, U) return -4.0 end
function tmp = code(J, l, K, U) tmp = -4.0; end
code[J_, l_, K_, U_] := -4.0
\begin{array}{l}
\\
-4
\end{array}
Initial program 84.8%
Applied egg-rr2.7%
Taylor expanded in U around 0 2.7%
herbie shell --seed 2024152
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))