
(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 14 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 0.0002)))
(+ (* t_0 (* t_1 J)) U)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.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 <= -((double) INFINITY)) || !(t_1 <= 0.0002)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
}
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 <= 0.0002)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.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 <= -math.inf) or not (t_1 <= 0.0002): tmp = (t_0 * (t_1 * J)) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.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 <= Float64(-Inf)) || !(t_1 <= 0.0002)) tmp = Float64(Float64(t_0 * Float64(t_1 * J)) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.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 <= -Inf) || ~((t_1 <= 0.0002))) tmp = (t_0 * (t_1 * J)) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.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, (-Infinity)], N[Not[LessEqual[t$95$1, 0.0002]], $MachinePrecision]], N[(N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $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 0.0002\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.2%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-4Initial program 78.4%
Taylor expanded in l around 0 99.9%
Final simplification99.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.0002)))
(+ U (* t_0 J))
(+ U (* (cos (/ K 2.0)) (* l (* J 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.0002)) {
tmp = U + (t_0 * J);
} else {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.0002)) {
tmp = U + (t_0 * J);
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 0.0002): tmp = U + (t_0 * J) else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.0002)) tmp = Float64(U + Float64(t_0 * J)); 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) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.0002))) tmp = U + (t_0 * J); else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.0002]], $MachinePrecision]], N[(U + N[(t$95$0 * J), $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}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0.0002\right):\\
\;\;\;\;U + t_0 \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.2%
Taylor expanded in K around 0 70.3%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-4Initial program 78.4%
Taylor expanded in l around 0 99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Final simplification85.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= l -9.2e+132)
(+ U (* t_0 (* (pow l 3.0) (* J 0.3333333333333333))))
(if (or (<= l -0.0245) (and (not (<= l 46.0)) (<= l 8e+91)))
(+ U (* (- (exp l) (exp (- l))) (+ J (* J (* K (* K -0.125))))))
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (l <= -9.2e+132) {
tmp = U + (t_0 * (pow(l, 3.0) * (J * 0.3333333333333333)));
} else if ((l <= -0.0245) || (!(l <= 46.0) && (l <= 8e+91))) {
tmp = U + ((exp(l) - exp(-l)) * (J + (J * (K * (K * -0.125)))));
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (l <= (-9.2d+132)) then
tmp = u + (t_0 * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
else if ((l <= (-0.0245d0)) .or. (.not. (l <= 46.0d0)) .and. (l <= 8d+91)) then
tmp = u + ((exp(l) - exp(-l)) * (j + (j * (k * (k * (-0.125d0))))))
else
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (l <= -9.2e+132) {
tmp = U + (t_0 * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
} else if ((l <= -0.0245) || (!(l <= 46.0) && (l <= 8e+91))) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * (J + (J * (K * (K * -0.125)))));
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if l <= -9.2e+132: tmp = U + (t_0 * (math.pow(l, 3.0) * (J * 0.3333333333333333))) elif (l <= -0.0245) or (not (l <= 46.0) and (l <= 8e+91)): tmp = U + ((math.exp(l) - math.exp(-l)) * (J + (J * (K * (K * -0.125))))) else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -9.2e+132) tmp = Float64(U + Float64(t_0 * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))); elseif ((l <= -0.0245) || (!(l <= 46.0) && (l <= 8e+91))) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * Float64(J + Float64(J * Float64(K * Float64(K * -0.125)))))); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (l <= -9.2e+132) tmp = U + (t_0 * ((l ^ 3.0) * (J * 0.3333333333333333))); elseif ((l <= -0.0245) || (~((l <= 46.0)) && (l <= 8e+91))) tmp = U + ((exp(l) - exp(-l)) * (J + (J * (K * (K * -0.125))))); else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.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, -9.2e+132], N[(U + N[(t$95$0 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -0.0245], And[N[Not[LessEqual[l, 46.0]], $MachinePrecision], LessEqual[l, 8e+91]]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * N[(J + N[(J * N[(K * N[(K * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -9.2 \cdot 10^{+132}:\\
\;\;\;\;U + t_0 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
\mathbf{elif}\;\ell \leq -0.0245 \lor \neg \left(\ell \leq 46\right) \land \ell \leq 8 \cdot 10^{+91}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot \left(J + J \cdot \left(K \cdot \left(K \cdot -0.125\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -9.2000000000000006e132Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -9.2000000000000006e132 < l < -0.024500000000000001 or 46 < l < 8.00000000000000064e91Initial program 98.0%
Taylor expanded in K around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out83.4%
*-commutative83.4%
*-commutative83.4%
unpow283.4%
associate-*l*83.4%
Simplified83.4%
if -0.024500000000000001 < l < 46 or 8.00000000000000064e91 < l Initial program 83.6%
Taylor expanded in l around 0 99.1%
Final simplification96.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_2 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -5.5e+102)
t_1
(if (<= l -0.047)
t_2
(if (<= l 0.003)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 4.2e+94) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -5.5e+102) {
tmp = t_1;
} else if (l <= -0.047) {
tmp = t_2;
} else if (l <= 0.003) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.2e+94) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_2 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-5.5d+102)) then
tmp = t_1
else if (l <= (-0.047d0)) then
tmp = t_2
else if (l <= 0.003d0) then
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 4.2d+94) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (t_0 * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -5.5e+102) {
tmp = t_1;
} else if (l <= -0.047) {
tmp = t_2;
} else if (l <= 0.003) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.2e+94) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (math.pow(l, 3.0) * (J * 0.3333333333333333))) t_2 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -5.5e+102: tmp = t_1 elif l <= -0.047: tmp = t_2 elif l <= 0.003: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 4.2e+94: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_2 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -5.5e+102) tmp = t_1; elseif (l <= -0.047) tmp = t_2; elseif (l <= 0.003) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 4.2e+94) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * ((l ^ 3.0) * (J * 0.3333333333333333))); t_2 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -5.5e+102) tmp = t_1; elseif (l <= -0.047) tmp = t_2; elseif (l <= 0.003) tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 4.2e+94) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.5e+102], t$95$1, If[LessEqual[l, -0.047], t$95$2, If[LessEqual[l, 0.003], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2e+94], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t_0 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_2 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.047:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 0.003:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+94}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -5.49999999999999981e102 or 4.19999999999999979e94 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -5.49999999999999981e102 < l < -0.047 or 0.0030000000000000001 < l < 4.19999999999999979e94Initial program 97.9%
Taylor expanded in K around 0 68.2%
if -0.047 < l < 0.0030000000000000001Initial program 78.4%
Taylor expanded in l around 0 99.9%
Final simplification94.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_2 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -5.5e+102)
t_1
(if (<= l -0.00088)
t_2
(if (<= l 0.00042)
(+ U (* t_0 (* l (* J 2.0))))
(if (<= l 3e+94) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -5.5e+102) {
tmp = t_1;
} else if (l <= -0.00088) {
tmp = t_2;
} else if (l <= 0.00042) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else if (l <= 3e+94) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_2 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-5.5d+102)) then
tmp = t_1
else if (l <= (-0.00088d0)) then
tmp = t_2
else if (l <= 0.00042d0) then
tmp = u + (t_0 * (l * (j * 2.0d0)))
else if (l <= 3d+94) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (t_0 * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -5.5e+102) {
tmp = t_1;
} else if (l <= -0.00088) {
tmp = t_2;
} else if (l <= 0.00042) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else if (l <= 3e+94) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (math.pow(l, 3.0) * (J * 0.3333333333333333))) t_2 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -5.5e+102: tmp = t_1 elif l <= -0.00088: tmp = t_2 elif l <= 0.00042: tmp = U + (t_0 * (l * (J * 2.0))) elif l <= 3e+94: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_2 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -5.5e+102) tmp = t_1; elseif (l <= -0.00088) tmp = t_2; elseif (l <= 0.00042) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * 2.0)))); elseif (l <= 3e+94) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * ((l ^ 3.0) * (J * 0.3333333333333333))); t_2 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -5.5e+102) tmp = t_1; elseif (l <= -0.00088) tmp = t_2; elseif (l <= 0.00042) tmp = U + (t_0 * (l * (J * 2.0))); elseif (l <= 3e+94) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.5e+102], t$95$1, If[LessEqual[l, -0.00088], t$95$2, If[LessEqual[l, 0.00042], N[(U + N[(t$95$0 * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3e+94], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t_0 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_2 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.00088:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 0.00042:\\
\;\;\;\;U + t_0 \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{+94}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -5.49999999999999981e102 or 3.0000000000000001e94 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -5.49999999999999981e102 < l < -8.80000000000000031e-4 or 4.2000000000000002e-4 < l < 3.0000000000000001e94Initial program 97.9%
Taylor expanded in K around 0 68.2%
if -8.80000000000000031e-4 < l < 4.2000000000000002e-4Initial program 78.4%
Taylor expanded in l around 0 99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Final simplification94.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.75)
(+ U (* t_0 (* l (* J 2.0))))
(+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.75) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= 0.75d0) then
tmp = u + (t_0 * (l * (j * 2.0d0)))
else
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= 0.75) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.75: tmp = U + (t_0 * (l * (J * 2.0))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.75) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * 2.0)))); else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.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.75) tmp = U + (t_0 * (l * (J * 2.0))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.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.75], N[(U + N[(t$95$0 * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 0.75:\\
\;\;\;\;U + t_0 \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.75Initial program 86.1%
Taylor expanded in l around 0 62.9%
*-commutative62.9%
associate-*l*62.9%
Simplified62.9%
if 0.75 < (cos.f64 (/.f64 K 2)) Initial program 89.5%
Taylor expanded in l around 0 86.4%
Taylor expanded in K around 0 84.6%
Final simplification76.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l -1.9e+28)
t_0
(if (<= l 800000.0)
(+ U (* 2.0 (* l J)))
(if (<= l 8.4e+91)
(pow U -3.0)
(if (or (<= l 1.95e+161) (not (<= l 1.35e+228)))
t_0
(+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))))))
double code(double J, double l, double K, double U) {
double t_0 = J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0));
double tmp;
if (l <= -1.9e+28) {
tmp = t_0;
} else if (l <= 800000.0) {
tmp = U + (2.0 * (l * J));
} else if (l <= 8.4e+91) {
tmp = pow(U, -3.0);
} else if ((l <= 1.95e+161) || !(l <= 1.35e+228)) {
tmp = t_0;
} else {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
}
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 = j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))
if (l <= (-1.9d+28)) then
tmp = t_0
else if (l <= 800000.0d0) then
tmp = u + (2.0d0 * (l * j))
else if (l <= 8.4d+91) then
tmp = u ** (-3.0d0)
else if ((l <= 1.95d+161) .or. (.not. (l <= 1.35d+228))) then
tmp = t_0
else
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0));
double tmp;
if (l <= -1.9e+28) {
tmp = t_0;
} else if (l <= 800000.0) {
tmp = U + (2.0 * (l * J));
} else if (l <= 8.4e+91) {
tmp = Math.pow(U, -3.0);
} else if ((l <= 1.95e+161) || !(l <= 1.35e+228)) {
tmp = t_0;
} else {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
}
return tmp;
}
def code(J, l, K, U): t_0 = J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)) tmp = 0 if l <= -1.9e+28: tmp = t_0 elif l <= 800000.0: tmp = U + (2.0 * (l * J)) elif l <= 8.4e+91: tmp = math.pow(U, -3.0) elif (l <= 1.95e+161) or not (l <= 1.35e+228): tmp = t_0 else: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) tmp = 0.0 if (l <= -1.9e+28) tmp = t_0; elseif (l <= 800000.0) tmp = Float64(U + Float64(2.0 * Float64(l * J))); elseif (l <= 8.4e+91) tmp = U ^ -3.0; elseif ((l <= 1.95e+161) || !(l <= 1.35e+228)) tmp = t_0; else tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)); tmp = 0.0; if (l <= -1.9e+28) tmp = t_0; elseif (l <= 800000.0) tmp = U + (2.0 * (l * J)); elseif (l <= 8.4e+91) tmp = U ^ -3.0; elseif ((l <= 1.95e+161) || ~((l <= 1.35e+228))) tmp = t_0; else tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.9e+28], t$95$0, If[LessEqual[l, 800000.0], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.4e+91], N[Power[U, -3.0], $MachinePrecision], If[Or[LessEqual[l, 1.95e+161], N[Not[LessEqual[l, 1.35e+228]], $MachinePrecision]], t$95$0, N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 800000:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{elif}\;\ell \leq 8.4 \cdot 10^{+91}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 1.95 \cdot 10^{+161} \lor \neg \left(\ell \leq 1.35 \cdot 10^{+228}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if l < -1.8999999999999999e28 or 8.40000000000000031e91 < l < 1.9500000000000001e161 or 1.3500000000000001e228 < l Initial program 100.0%
Taylor expanded in l around 0 90.7%
Taylor expanded in K around 0 73.9%
Taylor expanded in J around inf 73.9%
if -1.8999999999999999e28 < l < 8e5Initial program 79.6%
Taylor expanded in l around 0 92.8%
*-commutative92.8%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in K around 0 81.9%
if 8e5 < l < 8.40000000000000031e91Initial program 100.0%
Applied egg-rr32.6%
if 1.9500000000000001e161 < l < 1.3500000000000001e228Initial program 100.0%
Taylor expanded in l around 0 37.3%
*-commutative37.3%
associate-*l*37.3%
Simplified37.3%
Taylor expanded in K around 0 30.5%
+-commutative30.5%
associate-*r*30.5%
distribute-rgt-out66.2%
*-commutative66.2%
unpow266.2%
Simplified66.2%
Final simplification74.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l -1.8e+28)
t_0
(if (<= l 800000.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 4.1e+93)
(pow U -3.0)
(if (or (<= l 2.45e+160) (not (<= l 3.5e+226)))
t_0
(+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))))))
double code(double J, double l, double K, double U) {
double t_0 = J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0));
double tmp;
if (l <= -1.8e+28) {
tmp = t_0;
} else if (l <= 800000.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 4.1e+93) {
tmp = pow(U, -3.0);
} else if ((l <= 2.45e+160) || !(l <= 3.5e+226)) {
tmp = t_0;
} else {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
}
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 = j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))
if (l <= (-1.8d+28)) then
tmp = t_0
else if (l <= 800000.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 4.1d+93) then
tmp = u ** (-3.0d0)
else if ((l <= 2.45d+160) .or. (.not. (l <= 3.5d+226))) then
tmp = t_0
else
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0));
double tmp;
if (l <= -1.8e+28) {
tmp = t_0;
} else if (l <= 800000.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 4.1e+93) {
tmp = Math.pow(U, -3.0);
} else if ((l <= 2.45e+160) || !(l <= 3.5e+226)) {
tmp = t_0;
} else {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
}
return tmp;
}
def code(J, l, K, U): t_0 = J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)) tmp = 0 if l <= -1.8e+28: tmp = t_0 elif l <= 800000.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 4.1e+93: tmp = math.pow(U, -3.0) elif (l <= 2.45e+160) or not (l <= 3.5e+226): tmp = t_0 else: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) tmp = 0.0 if (l <= -1.8e+28) tmp = t_0; elseif (l <= 800000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 4.1e+93) tmp = U ^ -3.0; elseif ((l <= 2.45e+160) || !(l <= 3.5e+226)) tmp = t_0; else tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)); tmp = 0.0; if (l <= -1.8e+28) tmp = t_0; elseif (l <= 800000.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 4.1e+93) tmp = U ^ -3.0; elseif ((l <= 2.45e+160) || ~((l <= 3.5e+226))) tmp = t_0; else tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.8e+28], t$95$0, If[LessEqual[l, 800000.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.1e+93], N[Power[U, -3.0], $MachinePrecision], If[Or[LessEqual[l, 2.45e+160], N[Not[LessEqual[l, 3.5e+226]], $MachinePrecision]], t$95$0, N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 800000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{+93}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 2.45 \cdot 10^{+160} \lor \neg \left(\ell \leq 3.5 \cdot 10^{+226}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if l < -1.8e28 or 4.1000000000000001e93 < l < 2.4500000000000001e160 or 3.4999999999999998e226 < l Initial program 100.0%
Taylor expanded in l around 0 90.7%
Taylor expanded in K around 0 73.9%
Taylor expanded in J around inf 73.9%
if -1.8e28 < l < 8e5Initial program 79.6%
Taylor expanded in l around 0 92.8%
*-commutative92.8%
*-commutative92.8%
associate-*l*92.7%
Simplified92.7%
if 8e5 < l < 4.1000000000000001e93Initial program 100.0%
Applied egg-rr32.6%
if 2.4500000000000001e160 < l < 3.4999999999999998e226Initial program 100.0%
Taylor expanded in l around 0 37.3%
*-commutative37.3%
associate-*l*37.3%
Simplified37.3%
Taylor expanded in K around 0 30.5%
+-commutative30.5%
associate-*r*30.5%
distribute-rgt-out66.2%
*-commutative66.2%
unpow266.2%
Simplified66.2%
Final simplification80.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l -4.2e+28)
t_0
(if (<= l 800000.0)
(+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))
(if (<= l 4e+92)
(pow U -3.0)
(if (or (<= l 1.95e+161) (not (<= l 3.4e+226)))
t_0
(+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))))))
double code(double J, double l, double K, double U) {
double t_0 = J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0));
double tmp;
if (l <= -4.2e+28) {
tmp = t_0;
} else if (l <= 800000.0) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 4e+92) {
tmp = pow(U, -3.0);
} else if ((l <= 1.95e+161) || !(l <= 3.4e+226)) {
tmp = t_0;
} else {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
}
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 = j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))
if (l <= (-4.2d+28)) then
tmp = t_0
else if (l <= 800000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
else if (l <= 4d+92) then
tmp = u ** (-3.0d0)
else if ((l <= 1.95d+161) .or. (.not. (l <= 3.4d+226))) then
tmp = t_0
else
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0));
double tmp;
if (l <= -4.2e+28) {
tmp = t_0;
} else if (l <= 800000.0) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 4e+92) {
tmp = Math.pow(U, -3.0);
} else if ((l <= 1.95e+161) || !(l <= 3.4e+226)) {
tmp = t_0;
} else {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
}
return tmp;
}
def code(J, l, K, U): t_0 = J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)) tmp = 0 if l <= -4.2e+28: tmp = t_0 elif l <= 800000.0: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) elif l <= 4e+92: tmp = math.pow(U, -3.0) elif (l <= 1.95e+161) or not (l <= 3.4e+226): tmp = t_0 else: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) tmp = 0.0 if (l <= -4.2e+28) tmp = t_0; elseif (l <= 800000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); elseif (l <= 4e+92) tmp = U ^ -3.0; elseif ((l <= 1.95e+161) || !(l <= 3.4e+226)) tmp = t_0; else tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)); tmp = 0.0; if (l <= -4.2e+28) tmp = t_0; elseif (l <= 800000.0) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); elseif (l <= 4e+92) tmp = U ^ -3.0; elseif ((l <= 1.95e+161) || ~((l <= 3.4e+226))) tmp = t_0; else tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.2e+28], t$95$0, If[LessEqual[l, 800000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4e+92], N[Power[U, -3.0], $MachinePrecision], If[Or[LessEqual[l, 1.95e+161], N[Not[LessEqual[l, 3.4e+226]], $MachinePrecision]], t$95$0, N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 800000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4 \cdot 10^{+92}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 1.95 \cdot 10^{+161} \lor \neg \left(\ell \leq 3.4 \cdot 10^{+226}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if l < -4.19999999999999978e28 or 4.0000000000000002e92 < l < 1.9500000000000001e161 or 3.39999999999999979e226 < l Initial program 100.0%
Taylor expanded in l around 0 90.7%
Taylor expanded in K around 0 73.9%
Taylor expanded in J around inf 73.9%
if -4.19999999999999978e28 < l < 8e5Initial program 79.6%
Taylor expanded in l around 0 92.8%
*-commutative92.8%
associate-*l*92.8%
Simplified92.8%
if 8e5 < l < 4.0000000000000002e92Initial program 100.0%
Applied egg-rr32.6%
if 1.9500000000000001e161 < l < 3.39999999999999979e226Initial program 100.0%
Taylor expanded in l around 0 37.3%
*-commutative37.3%
associate-*l*37.3%
Simplified37.3%
Taylor expanded in K around 0 30.5%
+-commutative30.5%
associate-*r*30.5%
distribute-rgt-out66.2%
*-commutative66.2%
unpow266.2%
Simplified66.2%
Final simplification80.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -7e-21) (not (<= l 550.0))) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) (+ U (* 2.0 (* l J)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -7e-21) || !(l <= 550.0)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-7d-21)) .or. (.not. (l <= 550.0d0))) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else
tmp = u + (2.0d0 * (l * j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -7e-21) || !(l <= 550.0)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -7e-21) or not (l <= 550.0): tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = U + (2.0 * (l * J)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -7e-21) || !(l <= 550.0)) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); else tmp = Float64(U + Float64(2.0 * Float64(l * J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -7e-21) || ~((l <= 550.0))) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = U + (2.0 * (l * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -7e-21], N[Not[LessEqual[l, 550.0]], $MachinePrecision]], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7 \cdot 10^{-21} \lor \neg \left(\ell \leq 550\right):\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if l < -7.0000000000000007e-21 or 550 < l Initial program 97.3%
Taylor expanded in l around 0 29.0%
*-commutative29.0%
associate-*l*29.0%
Simplified29.0%
Taylor expanded in K around 0 23.0%
+-commutative23.0%
associate-*r*23.0%
distribute-rgt-out40.7%
*-commutative40.7%
unpow240.7%
Simplified40.7%
if -7.0000000000000007e-21 < l < 550Initial program 79.7%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
associate-*l*99.2%
Simplified99.2%
Taylor expanded in K around 0 87.8%
Final simplification65.0%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
def code(J, l, K, U): return U + (2.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 88.2%
Taylor expanded in l around 0 65.2%
*-commutative65.2%
associate-*l*65.2%
Simplified65.2%
Taylor expanded in K around 0 57.4%
Final simplification57.4%
(FPCore (J l K U) :precision binary64 (if (<= l -720.0) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -720.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 <= (-720.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 <= -720.0) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -720.0: tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -720.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 <= -720.0) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -720.0], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -720:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -720Initial program 100.0%
Applied egg-rr17.6%
if -720 < l Initial program 85.0%
Taylor expanded in J around 0 53.5%
Final simplification45.8%
(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 88.2%
Applied egg-rr2.6%
*-inverses2.6%
Simplified2.6%
Final simplification2.6%
(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.2%
Taylor expanded in J around 0 42.5%
Final simplification42.5%
herbie shell --seed 2023217
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))