
(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 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.0)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+ U (* (* l 2.0) (* J (cos (* K 0.5))))))))
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.0)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
}
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.0)) {
tmp = ((t_0 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
}
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.0): tmp = ((t_0 * J) * math.cos((K / 2.0))) + U else: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) 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.0)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); 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.0))) tmp = ((t_0 * J) * cos((K / 2.0))) + U; else tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); 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.0]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $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\right):\\
\;\;\;\;\left(t_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 76.3%
Taylor expanded in l around 0 100.0%
associate-*r*99.9%
*-commutative99.9%
associate-*l*100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* (pow l 3.0) (* t_0 (* J 0.3333333333333333)))))
(t_2 (* (- (exp l) (exp (- l))) J)))
(if (<= l -4.5e+142)
t_1
(if (<= l -15500000000.0)
t_2
(if (<= l 7e-30)
(+ U (* (* l 2.0) (* J t_0)))
(if (<= l 1.1e+64) (+ t_2 U) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + (pow(l, 3.0) * (t_0 * (J * 0.3333333333333333)));
double t_2 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -4.5e+142) {
tmp = t_1;
} else if (l <= -15500000000.0) {
tmp = t_2;
} else if (l <= 7e-30) {
tmp = U + ((l * 2.0) * (J * t_0));
} else if (l <= 1.1e+64) {
tmp = t_2 + U;
} 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 * 0.5d0))
t_1 = u + ((l ** 3.0d0) * (t_0 * (j * 0.3333333333333333d0)))
t_2 = (exp(l) - exp(-l)) * j
if (l <= (-4.5d+142)) then
tmp = t_1
else if (l <= (-15500000000.0d0)) then
tmp = t_2
else if (l <= 7d-30) then
tmp = u + ((l * 2.0d0) * (j * t_0))
else if (l <= 1.1d+64) then
tmp = t_2 + u
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 * 0.5));
double t_1 = U + (Math.pow(l, 3.0) * (t_0 * (J * 0.3333333333333333)));
double t_2 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -4.5e+142) {
tmp = t_1;
} else if (l <= -15500000000.0) {
tmp = t_2;
} else if (l <= 7e-30) {
tmp = U + ((l * 2.0) * (J * t_0));
} else if (l <= 1.1e+64) {
tmp = t_2 + U;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + (math.pow(l, 3.0) * (t_0 * (J * 0.3333333333333333))) t_2 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -4.5e+142: tmp = t_1 elif l <= -15500000000.0: tmp = t_2 elif l <= 7e-30: tmp = U + ((l * 2.0) * (J * t_0)) elif l <= 1.1e+64: tmp = t_2 + U else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64((l ^ 3.0) * Float64(t_0 * Float64(J * 0.3333333333333333)))) t_2 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -4.5e+142) tmp = t_1; elseif (l <= -15500000000.0) tmp = t_2; elseif (l <= 7e-30) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * t_0))); elseif (l <= 1.1e+64) tmp = Float64(t_2 + U); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + ((l ^ 3.0) * (t_0 * (J * 0.3333333333333333))); t_2 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -4.5e+142) tmp = t_1; elseif (l <= -15500000000.0) tmp = t_2; elseif (l <= 7e-30) tmp = U + ((l * 2.0) * (J * t_0)); elseif (l <= 1.1e+64) tmp = t_2 + U; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(t$95$0 * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -4.5e+142], t$95$1, If[LessEqual[l, -15500000000.0], t$95$2, If[LessEqual[l, 7e-30], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.1e+64], N[(t$95$2 + U), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + {\ell}^{3} \cdot \left(t_0 \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+142}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -15500000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{-30}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot t_0\right)\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{+64}:\\
\;\;\;\;t_2 + U\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -4.4999999999999999e142 or 1.10000000000000001e64 < 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%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -4.4999999999999999e142 < l < -1.55e10Initial program 100.0%
Taylor expanded in K around 0 85.7%
Taylor expanded in J around inf 85.7%
if -1.55e10 < l < 7.0000000000000006e-30Initial program 75.9%
Taylor expanded in l around 0 100.0%
associate-*r*99.9%
*-commutative99.9%
associate-*l*100.0%
associate-*r*100.0%
Simplified100.0%
if 7.0000000000000006e-30 < l < 1.10000000000000001e64Initial program 100.0%
Taylor expanded in K around 0 81.8%
Final simplification97.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.1) (+ U (* (* l 2.0) (* J (cos (* K 0.5))))) (+ U (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.1) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} 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) :: tmp
if (cos((k / 2.0d0)) <= (-0.1d0)) then
tmp = u + ((l * 2.0d0) * (j * cos((k * 0.5d0))))
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 tmp;
if (Math.cos((K / 2.0)) <= -0.1) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.1: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) else: tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.1) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); 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) tmp = 0.0; if (cos((K / 2.0)) <= -0.1) tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); else tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.1], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $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}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.1:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\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 2)) < -0.10000000000000001Initial program 81.8%
Taylor expanded in l around 0 71.0%
associate-*r*71.0%
*-commutative71.0%
associate-*l*71.0%
associate-*r*71.0%
Simplified71.0%
if -0.10000000000000001 < (cos.f64 (/.f64 K 2)) Initial program 89.4%
Taylor expanded in l around 0 92.0%
Taylor expanded in K around 0 89.3%
Final simplification85.5%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0)))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.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 + (cos((k / 2.0d0)) * (j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.0d0)))))
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 * Math.pow(l, 3.0)))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0)))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0)))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0))))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * 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}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\right)
\end{array}
Initial program 87.9%
Taylor expanded in l around 0 91.8%
Final simplification91.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.1) (+ U (* (* l (* J (pow K 2.0))) -0.25)) (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.1) {
tmp = U + ((l * (J * pow(K, 2.0))) * -0.25);
} else {
tmp = U + (0.3333333333333333 * (J * 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) :: tmp
if (cos((k / 2.0d0)) <= (-0.1d0)) then
tmp = u + ((l * (j * (k ** 2.0d0))) * (-0.25d0))
else
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.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.1) {
tmp = U + ((l * (J * Math.pow(K, 2.0))) * -0.25);
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.1: tmp = U + ((l * (J * math.pow(K, 2.0))) * -0.25) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.1) tmp = Float64(U + Float64(Float64(l * Float64(J * (K ^ 2.0))) * -0.25)); else tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.1) tmp = U + ((l * (J * (K ^ 2.0))) * -0.25); else tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.1], N[(U + N[(N[(l * N[(J * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.1:\\
\;\;\;\;U + \left(\ell \cdot \left(J \cdot {K}^{2}\right)\right) \cdot -0.25\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.10000000000000001Initial program 81.8%
Taylor expanded in l around 0 71.0%
associate-*r*71.0%
*-commutative71.0%
associate-*l*71.0%
associate-*r*71.0%
Simplified71.0%
Taylor expanded in K around 0 60.1%
Taylor expanded in K around inf 60.1%
*-commutative60.1%
associate-*r*60.1%
Simplified60.1%
if -0.10000000000000001 < (cos.f64 (/.f64 K 2)) Initial program 89.4%
Taylor expanded in l around 0 92.0%
Taylor expanded in l around inf 81.3%
associate-*r*81.3%
*-commutative81.3%
*-commutative81.3%
associate-*l*81.3%
*-commutative81.3%
associate-*l*81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in K around 0 81.3%
Final simplification76.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (<= l -15500000000.0)
t_0
(if (<= l 7e-30) (+ U (* (* l 2.0) (* J (cos (* K 0.5))))) (+ t_0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -15500000000.0) {
tmp = t_0;
} else if (l <= 7e-30) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else {
tmp = t_0 + 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) :: tmp
t_0 = (exp(l) - exp(-l)) * j
if (l <= (-15500000000.0d0)) then
tmp = t_0
else if (l <= 7d-30) then
tmp = u + ((l * 2.0d0) * (j * cos((k * 0.5d0))))
else
tmp = t_0 + 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) - Math.exp(-l)) * J;
double tmp;
if (l <= -15500000000.0) {
tmp = t_0;
} else if (l <= 7e-30) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else {
tmp = t_0 + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -15500000000.0: tmp = t_0 elif l <= 7e-30: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) else: tmp = t_0 + U return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -15500000000.0) tmp = t_0; elseif (l <= 7e-30) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); else tmp = Float64(t_0 + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -15500000000.0) tmp = t_0; elseif (l <= 7e-30) tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); else tmp = t_0 + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -15500000000.0], t$95$0, If[LessEqual[l, 7e-30], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -15500000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{-30}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + U\\
\end{array}
\end{array}
if l < -1.55e10Initial program 100.0%
Taylor expanded in K around 0 80.4%
Taylor expanded in J around inf 80.4%
if -1.55e10 < l < 7.0000000000000006e-30Initial program 75.9%
Taylor expanded in l around 0 100.0%
associate-*r*99.9%
*-commutative99.9%
associate-*l*100.0%
associate-*r*100.0%
Simplified100.0%
if 7.0000000000000006e-30 < l Initial program 100.0%
Taylor expanded in K around 0 78.9%
Final simplification89.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -15500000000.0) (not (<= l 310.0))) (* (- (exp l) (exp (- l))) J) (+ U (* (* l 2.0) (* J (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -15500000000.0) || !(l <= 310.0)) {
tmp = (exp(l) - exp(-l)) * J;
} else {
tmp = U + ((l * 2.0) * (J * 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 <= (-15500000000.0d0)) .or. (.not. (l <= 310.0d0))) then
tmp = (exp(l) - exp(-l)) * j
else
tmp = u + ((l * 2.0d0) * (j * 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 <= -15500000000.0) || !(l <= 310.0)) {
tmp = (Math.exp(l) - Math.exp(-l)) * J;
} else {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -15500000000.0) or not (l <= 310.0): tmp = (math.exp(l) - math.exp(-l)) * J else: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -15500000000.0) || !(l <= 310.0)) tmp = Float64(Float64(exp(l) - exp(Float64(-l))) * J); else tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -15500000000.0) || ~((l <= 310.0))) tmp = (exp(l) - exp(-l)) * J; else tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -15500000000.0], N[Not[LessEqual[l, 310.0]], $MachinePrecision]], N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -15500000000 \lor \neg \left(\ell \leq 310\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if l < -1.55e10 or 310 < l Initial program 100.0%
Taylor expanded in K around 0 78.7%
Taylor expanded in J around inf 78.7%
if -1.55e10 < l < 310Initial program 76.8%
Taylor expanded in l around 0 100.0%
associate-*r*99.9%
*-commutative99.9%
associate-*l*100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification89.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -21000000000000.0) (not (<= l 5.7e+16))) (+ U (* 0.3333333333333333 (* J (pow l 3.0)))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -21000000000000.0) || !(l <= 5.7e+16)) {
tmp = U + (0.3333333333333333 * (J * pow(l, 3.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 <= (-21000000000000.0d0)) .or. (.not. (l <= 5.7d+16))) then
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.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 <= -21000000000000.0) || !(l <= 5.7e+16)) {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.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 <= -21000000000000.0) or not (l <= 5.7e+16): tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.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 <= -21000000000000.0) || !(l <= 5.7e+16)) tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.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 <= -21000000000000.0) || ~((l <= 5.7e+16))) tmp = U + (0.3333333333333333 * (J * (l ^ 3.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, -21000000000000.0], N[Not[LessEqual[l, 5.7e+16]], $MachinePrecision]], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.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 -21000000000000 \lor \neg \left(\ell \leq 5.7 \cdot 10^{+16}\right):\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\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 < -2.1e13 or 5.7e16 < l Initial program 100.0%
Taylor expanded in l around 0 84.8%
Taylor expanded in l around inf 84.8%
associate-*r*84.8%
*-commutative84.8%
*-commutative84.8%
associate-*l*84.8%
*-commutative84.8%
associate-*l*84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in K around 0 67.0%
if -2.1e13 < l < 5.7e16Initial program 77.3%
Taylor expanded in l around 0 97.9%
Final simplification83.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -270000000000.0) (not (<= l 5.7e+16))) (+ U (* 0.3333333333333333 (* J (pow l 3.0)))) (+ U (* (* l 2.0) (* J (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -270000000000.0) || !(l <= 5.7e+16)) {
tmp = U + (0.3333333333333333 * (J * pow(l, 3.0)));
} else {
tmp = U + ((l * 2.0) * (J * 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 <= (-270000000000.0d0)) .or. (.not. (l <= 5.7d+16))) then
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
else
tmp = u + ((l * 2.0d0) * (j * 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 <= -270000000000.0) || !(l <= 5.7e+16)) {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
} else {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -270000000000.0) or not (l <= 5.7e+16): tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) else: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -270000000000.0) || !(l <= 5.7e+16)) tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); else tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -270000000000.0) || ~((l <= 5.7e+16))) tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); else tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -270000000000.0], N[Not[LessEqual[l, 5.7e+16]], $MachinePrecision]], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -270000000000 \lor \neg \left(\ell \leq 5.7 \cdot 10^{+16}\right):\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if l < -2.7e11 or 5.7e16 < l Initial program 100.0%
Taylor expanded in l around 0 84.8%
Taylor expanded in l around inf 84.8%
associate-*r*84.8%
*-commutative84.8%
*-commutative84.8%
associate-*l*84.8%
*-commutative84.8%
associate-*l*84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in K around 0 67.0%
if -2.7e11 < l < 5.7e16Initial program 77.3%
Taylor expanded in l around 0 97.9%
associate-*r*97.9%
*-commutative97.9%
associate-*l*97.9%
associate-*r*97.9%
Simplified97.9%
Final simplification83.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.15e+22) (not (<= l 3e-46))) (+ U (* 0.3333333333333333 (* J (pow l 3.0)))) (+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.15e+22) || !(l <= 3e-46)) {
tmp = U + (0.3333333333333333 * (J * pow(l, 3.0)));
} 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 ((l <= (-1.15d+22)) .or. (.not. (l <= 3d-46))) then
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
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 ((l <= -1.15e+22) || !(l <= 3e-46)) {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.15e+22) or not (l <= 3e-46): tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.15e+22) || !(l <= 3e-46)) tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); 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 ((l <= -1.15e+22) || ~((l <= 3e-46))) tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.15e+22], N[Not[LessEqual[l, 3e-46]], $MachinePrecision]], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{+22} \lor \neg \left(\ell \leq 3 \cdot 10^{-46}\right):\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -1.1500000000000001e22 or 2.99999999999999987e-46 < l Initial program 99.3%
Taylor expanded in l around 0 84.8%
Taylor expanded in l around inf 84.1%
associate-*r*84.1%
*-commutative84.1%
*-commutative84.1%
associate-*l*84.1%
*-commutative84.1%
associate-*l*84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in K around 0 68.0%
if -1.1500000000000001e22 < l < 2.99999999999999987e-46Initial program 75.7%
Taylor expanded in l around 0 99.2%
associate-*r*99.2%
*-commutative99.2%
associate-*l*99.2%
associate-*r*99.2%
Simplified99.2%
Taylor expanded in K around 0 86.9%
Final simplification77.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* l (* J 2.0))))
(if (<= l -1.12e+195)
t_0
(if (<= l -16000000000.0) (* U U) (if (<= l 5.7e+16) U t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = l * (J * 2.0);
double tmp;
if (l <= -1.12e+195) {
tmp = t_0;
} else if (l <= -16000000000.0) {
tmp = U * U;
} else if (l <= 5.7e+16) {
tmp = U;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = l * (j * 2.0d0)
if (l <= (-1.12d+195)) then
tmp = t_0
else if (l <= (-16000000000.0d0)) then
tmp = u * u
else if (l <= 5.7d+16) then
tmp = u
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = l * (J * 2.0);
double tmp;
if (l <= -1.12e+195) {
tmp = t_0;
} else if (l <= -16000000000.0) {
tmp = U * U;
} else if (l <= 5.7e+16) {
tmp = U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = l * (J * 2.0) tmp = 0 if l <= -1.12e+195: tmp = t_0 elif l <= -16000000000.0: tmp = U * U elif l <= 5.7e+16: tmp = U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(l * Float64(J * 2.0)) tmp = 0.0 if (l <= -1.12e+195) tmp = t_0; elseif (l <= -16000000000.0) tmp = Float64(U * U); elseif (l <= 5.7e+16) tmp = U; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = l * (J * 2.0); tmp = 0.0; if (l <= -1.12e+195) tmp = t_0; elseif (l <= -16000000000.0) tmp = U * U; elseif (l <= 5.7e+16) tmp = U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.12e+195], t$95$0, If[LessEqual[l, -16000000000.0], N[(U * U), $MachinePrecision], If[LessEqual[l, 5.7e+16], U, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \left(J \cdot 2\right)\\
\mathbf{if}\;\ell \leq -1.12 \cdot 10^{+195}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -16000000000:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 5.7 \cdot 10^{+16}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.12000000000000004e195 or 5.7e16 < l Initial program 100.0%
Taylor expanded in l around 0 34.9%
Taylor expanded in J around inf 34.8%
Taylor expanded in K around 0 25.3%
associate-*r*25.3%
*-commutative25.3%
*-commutative25.3%
Simplified25.3%
if -1.12000000000000004e195 < l < -1.6e10Initial program 100.0%
Taylor expanded in K around 0 73.3%
Applied egg-rr21.1%
if -1.6e10 < l < 5.7e16Initial program 77.3%
Applied egg-rr54.0%
Taylor expanded in J around 0 74.3%
Final simplification51.0%
(FPCore (J l K U) :precision binary64 (if (or (<= l -6.7e+19) (not (<= l 680.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6.7e+19) || !(l <= 680.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-6.7d+19)) .or. (.not. (l <= 680.0d0))) then
tmp = u * u
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6.7e+19) || !(l <= 680.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -6.7e+19) or not (l <= 680.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -6.7e+19) || !(l <= 680.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -6.7e+19) || ~((l <= 680.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -6.7e+19], N[Not[LessEqual[l, 680.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.7 \cdot 10^{+19} \lor \neg \left(\ell \leq 680\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -6.7e19 or 680 < l Initial program 100.0%
Taylor expanded in K around 0 78.7%
Applied egg-rr16.2%
if -6.7e19 < l < 680Initial program 76.8%
Applied egg-rr55.1%
Taylor expanded in J around 0 75.8%
Final simplification47.4%
(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 87.9%
Taylor expanded in l around 0 66.1%
associate-*r*66.1%
*-commutative66.1%
associate-*l*66.1%
associate-*r*66.1%
Simplified66.1%
Taylor expanded in K around 0 55.7%
Final simplification55.7%
(FPCore (J l K U) :precision binary64 0.0)
double code(double J, double l, double K, double U) {
return 0.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 = 0.0d0
end function
public static double code(double J, double l, double K, double U) {
return 0.0;
}
def code(J, l, K, U): return 0.0
function code(J, l, K, U) return 0.0 end
function tmp = code(J, l, K, U) tmp = 0.0; end
code[J_, l_, K_, U_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 87.9%
Taylor expanded in K around 0 77.3%
Applied egg-rr2.5%
+-inverses2.5%
Simplified2.5%
Final simplification2.5%
(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 87.9%
Taylor expanded in K around 0 77.3%
Applied egg-rr2.7%
*-inverses2.7%
Simplified2.7%
Final simplification2.7%
(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 87.9%
Applied egg-rr30.1%
Taylor expanded in J around 0 41.0%
Final simplification41.0%
herbie shell --seed 2023333
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))