
(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))) (t_1 (- (exp l) t_0)) (t_2 (cos (* 0.5 K))))
(if (<= t_1 -20.0)
(* J (* t_1 t_2))
(if (<= t_1 1e-13)
(+
(*
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))
(cos (/ K 2.0)))
U)
(- U (* J (* t_2 (- t_0 (exp l)))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = exp(l) - t_0;
double t_2 = cos((0.5 * K));
double tmp;
if (t_1 <= -20.0) {
tmp = J * (t_1 * t_2);
} else if (t_1 <= 1e-13) {
tmp = ((J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))) * cos((K / 2.0))) + U;
} else {
tmp = U - (J * (t_2 * (t_0 - exp(l))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = exp(-l)
t_1 = exp(l) - t_0
t_2 = cos((0.5d0 * k))
if (t_1 <= (-20.0d0)) then
tmp = j * (t_1 * t_2)
else if (t_1 <= 1d-13) then
tmp = ((j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))) * cos((k / 2.0d0))) + u
else
tmp = u - (j * (t_2 * (t_0 - exp(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.exp(l) - t_0;
double t_2 = Math.cos((0.5 * K));
double tmp;
if (t_1 <= -20.0) {
tmp = J * (t_1 * t_2);
} else if (t_1 <= 1e-13) {
tmp = ((J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))) * Math.cos((K / 2.0))) + U;
} else {
tmp = U - (J * (t_2 * (t_0 - Math.exp(l))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.exp(l) - t_0 t_2 = math.cos((0.5 * K)) tmp = 0 if t_1 <= -20.0: tmp = J * (t_1 * t_2) elif t_1 <= 1e-13: tmp = ((J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) * math.cos((K / 2.0))) + U else: tmp = U - (J * (t_2 * (t_0 - math.exp(l)))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = Float64(exp(l) - t_0) t_2 = cos(Float64(0.5 * K)) tmp = 0.0 if (t_1 <= -20.0) tmp = Float64(J * Float64(t_1 * t_2)); elseif (t_1 <= 1e-13) tmp = Float64(Float64(Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U - Float64(J * Float64(t_2 * Float64(t_0 - exp(l))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = exp(l) - t_0; t_2 = cos((0.5 * K)); tmp = 0.0; if (t_1 <= -20.0) tmp = J * (t_1 * t_2); elseif (t_1 <= 1e-13) tmp = ((J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))) * cos((K / 2.0))) + U; else tmp = U - (J * (t_2 * (t_0 - exp(l)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -20.0], N[(J * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-13], N[(N[(N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U - N[(J * N[(t$95$2 * N[(t$95$0 - N[Exp[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := e^{\ell} - t_0\\
t_2 := \cos \left(0.5 \cdot K\right)\\
\mathbf{if}\;t_1 \leq -20:\\
\;\;\;\;J \cdot \left(t_1 \cdot t_2\right)\\
\mathbf{elif}\;t_1 \leq 10^{-13}:\\
\;\;\;\;\left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U - J \cdot \left(t_2 \cdot \left(t_0 - e^{\ell}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -20Initial program 100.0%
Taylor expanded in J around 0 100.0%
Taylor expanded in J around inf 100.0%
if -20 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1e-13Initial program 73.0%
Taylor expanded in l around 0 100.0%
if 1e-13 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in J around 0 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -20.0) (not (<= t_0 0.2)))
(* J (* t_0 (cos (* 0.5 K))))
(+
(*
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))
(cos (/ K 2.0)))
U))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -20.0) || !(t_0 <= 0.2)) {
tmp = J * (t_0 * cos((0.5 * K)));
} else {
tmp = ((J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))) * cos((K / 2.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)
if ((t_0 <= (-20.0d0)) .or. (.not. (t_0 <= 0.2d0))) then
tmp = j * (t_0 * cos((0.5d0 * k)))
else
tmp = ((j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))) * cos((k / 2.0d0))) + 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);
double tmp;
if ((t_0 <= -20.0) || !(t_0 <= 0.2)) {
tmp = J * (t_0 * Math.cos((0.5 * K)));
} else {
tmp = ((J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))) * Math.cos((K / 2.0))) + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -20.0) or not (t_0 <= 0.2): tmp = J * (t_0 * math.cos((0.5 * K))) else: tmp = ((J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) * math.cos((K / 2.0))) + U return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -20.0) || !(t_0 <= 0.2)) tmp = Float64(J * Float64(t_0 * cos(Float64(0.5 * K)))); else tmp = Float64(Float64(Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) * cos(Float64(K / 2.0))) + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -20.0) || ~((t_0 <= 0.2))) tmp = J * (t_0 * cos((0.5 * K))); else tmp = ((J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))) * cos((K / 2.0))) + U; 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, -20.0], N[Not[LessEqual[t$95$0, 0.2]], $MachinePrecision]], N[(J * N[(t$95$0 * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -20 \lor \neg \left(t_0 \leq 0.2\right):\\
\;\;\;\;J \cdot \left(t_0 \cdot \cos \left(0.5 \cdot K\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -20 or 0.20000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in J around 0 100.0%
Taylor expanded in J around inf 100.0%
if -20 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.20000000000000001Initial program 73.2%
Taylor expanded in l around 0 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (* J 0.3333333333333333) (* (cos (* 0.5 K)) (pow l 3.0)))))
(t_1 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -2.8e+134)
t_0
(if (<= l -3.1)
t_1
(if (<= l 0.0235)
(+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))
(if (<= l 2.2e+66) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * 0.3333333333333333) * (cos((0.5 * K)) * pow(l, 3.0)));
double t_1 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -2.8e+134) {
tmp = t_0;
} else if (l <= -3.1) {
tmp = t_1;
} else if (l <= 0.0235) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 2.2e+66) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + ((j * 0.3333333333333333d0) * (cos((0.5d0 * k)) * (l ** 3.0d0)))
t_1 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-2.8d+134)) then
tmp = t_0
else if (l <= (-3.1d0)) then
tmp = t_1
else if (l <= 0.0235d0) then
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
else if (l <= 2.2d+66) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((J * 0.3333333333333333) * (Math.cos((0.5 * K)) * Math.pow(l, 3.0)));
double t_1 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -2.8e+134) {
tmp = t_0;
} else if (l <= -3.1) {
tmp = t_1;
} else if (l <= 0.0235) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 2.2e+66) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * 0.3333333333333333) * (math.cos((0.5 * K)) * math.pow(l, 3.0))) t_1 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -2.8e+134: tmp = t_0 elif l <= -3.1: tmp = t_1 elif l <= 0.0235: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) elif l <= 2.2e+66: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * 0.3333333333333333) * Float64(cos(Float64(0.5 * K)) * (l ^ 3.0)))) t_1 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -2.8e+134) tmp = t_0; elseif (l <= -3.1) tmp = t_1; elseif (l <= 0.0235) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); elseif (l <= 2.2e+66) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * 0.3333333333333333) * (cos((0.5 * K)) * (l ^ 3.0))); t_1 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -2.8e+134) tmp = t_0; elseif (l <= -3.1) tmp = t_1; elseif (l <= 0.0235) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); elseif (l <= 2.2e+66) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.8e+134], t$95$0, If[LessEqual[l, -3.1], t$95$1, If[LessEqual[l, 0.0235], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.2e+66], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot 0.3333333333333333\right) \cdot \left(\cos \left(0.5 \cdot K\right) \cdot {\ell}^{3}\right)\\
t_1 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{+134}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -3.1:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.0235:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{+66}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -2.7999999999999999e134 or 2.1999999999999998e66 < l Initial program 100.0%
Taylor expanded in l around 0 99.0%
Taylor expanded in l around inf 99.0%
associate-*r*99.0%
*-commutative99.0%
Simplified99.0%
if -2.7999999999999999e134 < l < -3.10000000000000009 or 0.0235 < l < 2.1999999999999998e66Initial program 100.0%
Taylor expanded in K around 0 81.8%
if -3.10000000000000009 < l < 0.0235Initial program 73.2%
Taylor expanded in l around 0 99.1%
associate-*r*99.1%
*-commutative99.1%
Simplified99.1%
Final simplification96.8%
(FPCore (J l K U) :precision binary64 (+ (* (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))) * 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 * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Initial program 86.2%
Taylor expanded in l around 0 90.7%
Final simplification90.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -3.1) (not (<= l 0.00145))) (+ U (* (- (exp l) (exp (- l))) J)) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.1) || !(l <= 0.00145)) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-3.1d0)) .or. (.not. (l <= 0.00145d0))) then
tmp = u + ((exp(l) - exp(-l)) * j)
else
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.1) || !(l <= 0.00145)) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -3.1) or not (l <= 0.00145): tmp = U + ((math.exp(l) - math.exp(-l)) * J) else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -3.1) || !(l <= 0.00145)) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * 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) tmp = 0.0; if ((l <= -3.1) || ~((l <= 0.00145))) tmp = U + ((exp(l) - exp(-l)) * J); else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -3.1], N[Not[LessEqual[l, 0.00145]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * 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}
\mathbf{if}\;\ell \leq -3.1 \lor \neg \left(\ell \leq 0.00145\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \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 l < -3.10000000000000009 or 0.00145 < l Initial program 100.0%
Taylor expanded in K around 0 68.5%
if -3.10000000000000009 < l < 0.00145Initial program 73.2%
Taylor expanded in l around 0 99.1%
associate-*r*99.1%
*-commutative99.1%
Simplified99.1%
Final simplification84.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (* 0.3333333333333333 (pow l 3.0)))))
(if (<= l -3e+81)
t_0
(if (<= l -1.15e+16)
(pow U -4.0)
(if (<= l 3.3e+34) (+ U (* l (* 2.0 (* J (cos (* 0.5 K)))))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = J * (0.3333333333333333 * pow(l, 3.0));
double tmp;
if (l <= -3e+81) {
tmp = t_0;
} else if (l <= -1.15e+16) {
tmp = pow(U, -4.0);
} else if (l <= 3.3e+34) {
tmp = U + (l * (2.0 * (J * cos((0.5 * K)))));
} 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 = j * (0.3333333333333333d0 * (l ** 3.0d0))
if (l <= (-3d+81)) then
tmp = t_0
else if (l <= (-1.15d+16)) then
tmp = u ** (-4.0d0)
else if (l <= 3.3d+34) then
tmp = u + (l * (2.0d0 * (j * cos((0.5d0 * k)))))
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 = J * (0.3333333333333333 * Math.pow(l, 3.0));
double tmp;
if (l <= -3e+81) {
tmp = t_0;
} else if (l <= -1.15e+16) {
tmp = Math.pow(U, -4.0);
} else if (l <= 3.3e+34) {
tmp = U + (l * (2.0 * (J * Math.cos((0.5 * K)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = J * (0.3333333333333333 * math.pow(l, 3.0)) tmp = 0 if l <= -3e+81: tmp = t_0 elif l <= -1.15e+16: tmp = math.pow(U, -4.0) elif l <= 3.3e+34: tmp = U + (l * (2.0 * (J * math.cos((0.5 * K))))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))) tmp = 0.0 if (l <= -3e+81) tmp = t_0; elseif (l <= -1.15e+16) tmp = U ^ -4.0; elseif (l <= 3.3e+34) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(0.5 * K)))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * (0.3333333333333333 * (l ^ 3.0)); tmp = 0.0; if (l <= -3e+81) tmp = t_0; elseif (l <= -1.15e+16) tmp = U ^ -4.0; elseif (l <= 3.3e+34) tmp = U + (l * (2.0 * (J * cos((0.5 * K))))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3e+81], t$95$0, If[LessEqual[l, -1.15e+16], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 3.3e+34], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -3 \cdot 10^{+81}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -1.15 \cdot 10^{+16}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 3.3 \cdot 10^{+34}:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -2.99999999999999997e81 or 3.29999999999999988e34 < l Initial program 100.0%
Taylor expanded in l around 0 91.1%
Taylor expanded in K around 0 60.1%
Taylor expanded in l around inf 60.1%
*-commutative60.1%
associate-*r*60.1%
*-commutative60.1%
Simplified60.1%
if -2.99999999999999997e81 < l < -1.15e16Initial program 100.0%
Applied egg-rr73.0%
if -1.15e16 < l < 3.29999999999999988e34Initial program 74.3%
Taylor expanded in l around 0 95.7%
associate-*r*95.7%
*-commutative95.7%
associate-*l*95.7%
*-commutative95.7%
associate-*l*95.7%
Simplified95.7%
Final simplification79.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (* 0.3333333333333333 (pow l 3.0)))))
(if (<= l -1.9e+81)
t_0
(if (<= l -5.2e+15)
(pow U -4.0)
(if (<= l 4.2e+34) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0)))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = J * (0.3333333333333333 * pow(l, 3.0));
double tmp;
if (l <= -1.9e+81) {
tmp = t_0;
} else if (l <= -5.2e+15) {
tmp = pow(U, -4.0);
} else if (l <= 4.2e+34) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} 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 = j * (0.3333333333333333d0 * (l ** 3.0d0))
if (l <= (-1.9d+81)) then
tmp = t_0
else if (l <= (-5.2d+15)) then
tmp = u ** (-4.0d0)
else if (l <= 4.2d+34) then
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
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 = J * (0.3333333333333333 * Math.pow(l, 3.0));
double tmp;
if (l <= -1.9e+81) {
tmp = t_0;
} else if (l <= -5.2e+15) {
tmp = Math.pow(U, -4.0);
} else if (l <= 4.2e+34) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = J * (0.3333333333333333 * math.pow(l, 3.0)) tmp = 0 if l <= -1.9e+81: tmp = t_0 elif l <= -5.2e+15: tmp = math.pow(U, -4.0) elif l <= 4.2e+34: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))) tmp = 0.0 if (l <= -1.9e+81) tmp = t_0; elseif (l <= -5.2e+15) tmp = U ^ -4.0; elseif (l <= 4.2e+34) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * (0.3333333333333333 * (l ^ 3.0)); tmp = 0.0; if (l <= -1.9e+81) tmp = t_0; elseif (l <= -5.2e+15) tmp = U ^ -4.0; elseif (l <= 4.2e+34) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.9e+81], t$95$0, If[LessEqual[l, -5.2e+15], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 4.2e+34], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{+81}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -5.2 \cdot 10^{+15}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+34}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.9e81 or 4.20000000000000035e34 < l Initial program 100.0%
Taylor expanded in l around 0 91.1%
Taylor expanded in K around 0 60.1%
Taylor expanded in l around inf 60.1%
*-commutative60.1%
associate-*r*60.1%
*-commutative60.1%
Simplified60.1%
if -1.9e81 < l < -5.2e15Initial program 100.0%
Applied egg-rr73.0%
if -5.2e15 < l < 4.20000000000000035e34Initial program 74.3%
Taylor expanded in l around 0 95.7%
associate-*r*95.7%
*-commutative95.7%
Simplified95.7%
Final simplification79.9%
(FPCore (J l K U) :precision binary64 (if (or (<= J -6.9e+90) (not (<= J 1.1e+112))) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0)))) (+ (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -6.9e+90) || !(J <= 1.1e+112)) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} else {
tmp = (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.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) :: tmp
if ((j <= (-6.9d+90)) .or. (.not. (j <= 1.1d+112))) then
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
else
tmp = (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -6.9e+90) || !(J <= 1.1e+112)) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} else {
tmp = (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -6.9e+90) or not (J <= 1.1e+112): tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) else: tmp = (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) + U return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -6.9e+90) || !(J <= 1.1e+112)) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); else tmp = Float64(Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -6.9e+90) || ~((J <= 1.1e+112))) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); else tmp = (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -6.9e+90], N[Not[LessEqual[J, 1.1e+112]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -6.9 \cdot 10^{+90} \lor \neg \left(J \leq 1.1 \cdot 10^{+112}\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) + U\\
\end{array}
\end{array}
if J < -6.89999999999999955e90 or 1.1e112 < J Initial program 72.8%
Taylor expanded in l around 0 88.3%
associate-*r*88.3%
*-commutative88.3%
Simplified88.3%
if -6.89999999999999955e90 < J < 1.1e112Initial program 94.3%
Taylor expanded in l around 0 89.0%
Taylor expanded in K around 0 74.0%
Final simplification79.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (* 0.3333333333333333 (pow l 3.0)))))
(if (<= l -1.26e+82)
t_0
(if (<= l -5.2e+15)
(pow U -4.0)
(if (<= l 3.3e+34) (+ U (* l (* J 2.0))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = J * (0.3333333333333333 * pow(l, 3.0));
double tmp;
if (l <= -1.26e+82) {
tmp = t_0;
} else if (l <= -5.2e+15) {
tmp = pow(U, -4.0);
} else if (l <= 3.3e+34) {
tmp = U + (l * (J * 2.0));
} 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 = j * (0.3333333333333333d0 * (l ** 3.0d0))
if (l <= (-1.26d+82)) then
tmp = t_0
else if (l <= (-5.2d+15)) then
tmp = u ** (-4.0d0)
else if (l <= 3.3d+34) then
tmp = u + (l * (j * 2.0d0))
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 = J * (0.3333333333333333 * Math.pow(l, 3.0));
double tmp;
if (l <= -1.26e+82) {
tmp = t_0;
} else if (l <= -5.2e+15) {
tmp = Math.pow(U, -4.0);
} else if (l <= 3.3e+34) {
tmp = U + (l * (J * 2.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = J * (0.3333333333333333 * math.pow(l, 3.0)) tmp = 0 if l <= -1.26e+82: tmp = t_0 elif l <= -5.2e+15: tmp = math.pow(U, -4.0) elif l <= 3.3e+34: tmp = U + (l * (J * 2.0)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))) tmp = 0.0 if (l <= -1.26e+82) tmp = t_0; elseif (l <= -5.2e+15) tmp = U ^ -4.0; elseif (l <= 3.3e+34) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * (0.3333333333333333 * (l ^ 3.0)); tmp = 0.0; if (l <= -1.26e+82) tmp = t_0; elseif (l <= -5.2e+15) tmp = U ^ -4.0; elseif (l <= 3.3e+34) tmp = U + (l * (J * 2.0)); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.26e+82], t$95$0, If[LessEqual[l, -5.2e+15], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 3.3e+34], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -1.26 \cdot 10^{+82}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -5.2 \cdot 10^{+15}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 3.3 \cdot 10^{+34}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.2600000000000001e82 or 3.29999999999999988e34 < l Initial program 100.0%
Taylor expanded in l around 0 91.1%
Taylor expanded in K around 0 60.1%
Taylor expanded in l around inf 60.1%
*-commutative60.1%
associate-*r*60.1%
*-commutative60.1%
Simplified60.1%
if -1.2600000000000001e82 < l < -5.2e15Initial program 100.0%
Applied egg-rr73.0%
if -5.2e15 < l < 3.29999999999999988e34Initial program 74.3%
Taylor expanded in l around 0 95.9%
Taylor expanded in K around 0 83.2%
Taylor expanded in l around 0 83.2%
associate-*r*83.2%
Simplified83.2%
Final simplification73.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -9.5e+82) (and (not (<= l -5.2e+15)) (<= l 850.0))) (+ U (* l (* J 2.0))) (pow U -4.0)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -9.5e+82) || (!(l <= -5.2e+15) && (l <= 850.0))) {
tmp = U + (l * (J * 2.0));
} else {
tmp = pow(U, -4.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 <= (-9.5d+82)) .or. (.not. (l <= (-5.2d+15))) .and. (l <= 850.0d0)) then
tmp = u + (l * (j * 2.0d0))
else
tmp = u ** (-4.0d0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -9.5e+82) || (!(l <= -5.2e+15) && (l <= 850.0))) {
tmp = U + (l * (J * 2.0));
} else {
tmp = Math.pow(U, -4.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -9.5e+82) or (not (l <= -5.2e+15) and (l <= 850.0)): tmp = U + (l * (J * 2.0)) else: tmp = math.pow(U, -4.0) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -9.5e+82) || (!(l <= -5.2e+15) && (l <= 850.0))) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = U ^ -4.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -9.5e+82) || (~((l <= -5.2e+15)) && (l <= 850.0))) tmp = U + (l * (J * 2.0)); else tmp = U ^ -4.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -9.5e+82], And[N[Not[LessEqual[l, -5.2e+15]], $MachinePrecision], LessEqual[l, 850.0]]], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[U, -4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9.5 \cdot 10^{+82} \lor \neg \left(\ell \leq -5.2 \cdot 10^{+15}\right) \land \ell \leq 850:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;{U}^{-4}\\
\end{array}
\end{array}
if l < -9.50000000000000049e82 or -5.2e15 < l < 850Initial program 80.0%
Taylor expanded in l around 0 97.9%
Taylor expanded in K around 0 81.8%
Taylor expanded in l around 0 72.1%
associate-*r*72.1%
Simplified72.1%
if -9.50000000000000049e82 < l < -5.2e15 or 850 < l Initial program 100.0%
Applied egg-rr31.1%
Final simplification59.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- -4.0 (* K -0.03125))))
(if (<= l 0.05)
(+ U (* l (* J 2.0)))
(+
U
(+
(/
(- (* K -0.03125) (* t_0 t_0))
(+ (* K -0.03125) (- (* K -0.03125) -4.0)))
(* J 0.25))))))
double code(double J, double l, double K, double U) {
double t_0 = -4.0 - (K * -0.03125);
double tmp;
if (l <= 0.05) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + ((((K * -0.03125) - (t_0 * t_0)) / ((K * -0.03125) + ((K * -0.03125) - -4.0))) + (J * 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 = (-4.0d0) - (k * (-0.03125d0))
if (l <= 0.05d0) then
tmp = u + (l * (j * 2.0d0))
else
tmp = u + ((((k * (-0.03125d0)) - (t_0 * t_0)) / ((k * (-0.03125d0)) + ((k * (-0.03125d0)) - (-4.0d0)))) + (j * 0.25d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = -4.0 - (K * -0.03125);
double tmp;
if (l <= 0.05) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + ((((K * -0.03125) - (t_0 * t_0)) / ((K * -0.03125) + ((K * -0.03125) - -4.0))) + (J * 0.25));
}
return tmp;
}
def code(J, l, K, U): t_0 = -4.0 - (K * -0.03125) tmp = 0 if l <= 0.05: tmp = U + (l * (J * 2.0)) else: tmp = U + ((((K * -0.03125) - (t_0 * t_0)) / ((K * -0.03125) + ((K * -0.03125) - -4.0))) + (J * 0.25)) return tmp
function code(J, l, K, U) t_0 = Float64(-4.0 - Float64(K * -0.03125)) tmp = 0.0 if (l <= 0.05) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64(U + Float64(Float64(Float64(Float64(K * -0.03125) - Float64(t_0 * t_0)) / Float64(Float64(K * -0.03125) + Float64(Float64(K * -0.03125) - -4.0))) + Float64(J * 0.25))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = -4.0 - (K * -0.03125); tmp = 0.0; if (l <= 0.05) tmp = U + (l * (J * 2.0)); else tmp = U + ((((K * -0.03125) - (t_0 * t_0)) / ((K * -0.03125) + ((K * -0.03125) - -4.0))) + (J * 0.25)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(-4.0 - N[(K * -0.03125), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 0.05], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(N[(N[(K * -0.03125), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[(K * -0.03125), $MachinePrecision] + N[(N[(K * -0.03125), $MachinePrecision] - -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(J * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 - K \cdot -0.03125\\
\mathbf{if}\;\ell \leq 0.05:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\frac{K \cdot -0.03125 - t_0 \cdot t_0}{K \cdot -0.03125 + \left(K \cdot -0.03125 - -4\right)} + J \cdot 0.25\right)\\
\end{array}
\end{array}
if l < 0.050000000000000003Initial program 81.1%
Taylor expanded in l around 0 93.4%
Taylor expanded in K around 0 78.1%
Taylor expanded in l around 0 68.9%
associate-*r*68.9%
Simplified68.9%
if 0.050000000000000003 < l Initial program 100.0%
Applied egg-rr4.7%
Taylor expanded in K around 0 25.2%
Applied egg-rr18.9%
Final simplification55.4%
(FPCore (J l K U) :precision binary64 (if (<= l -3.0) (* U U) (if (<= l 3.3e+34) U (- -4.0 (* U U)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.0) {
tmp = U * U;
} else if (l <= 3.3e+34) {
tmp = U;
} else {
tmp = -4.0 - (U * U);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-3.0d0)) then
tmp = u * u
else if (l <= 3.3d+34) then
tmp = u
else
tmp = (-4.0d0) - (u * u)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.0) {
tmp = U * U;
} else if (l <= 3.3e+34) {
tmp = U;
} else {
tmp = -4.0 - (U * U);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.0: tmp = U * U elif l <= 3.3e+34: tmp = U else: tmp = -4.0 - (U * U) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.0) tmp = Float64(U * U); elseif (l <= 3.3e+34) tmp = U; else tmp = Float64(-4.0 - Float64(U * U)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3.0) tmp = U * U; elseif (l <= 3.3e+34) tmp = U; else tmp = -4.0 - (U * U); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.0], N[(U * U), $MachinePrecision], If[LessEqual[l, 3.3e+34], U, N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 3.3 \cdot 10^{+34}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-4 - U \cdot U\\
\end{array}
\end{array}
if l < -3Initial program 100.0%
Applied egg-rr15.8%
if -3 < l < 3.29999999999999988e34Initial program 73.8%
Taylor expanded in J around 0 70.3%
if 3.29999999999999988e34 < l Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr14.2%
cancel-sign-sub-inv14.2%
Simplified14.2%
Final simplification44.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -3.0) (not (<= l 1.9e+58))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.0) || !(l <= 1.9e+58)) {
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 <= (-3.0d0)) .or. (.not. (l <= 1.9d+58))) 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 <= -3.0) || !(l <= 1.9e+58)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -3.0) or not (l <= 1.9e+58): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -3.0) || !(l <= 1.9e+58)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -3.0) || ~((l <= 1.9e+58))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -3.0], N[Not[LessEqual[l, 1.9e+58]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3 \lor \neg \left(\ell \leq 1.9 \cdot 10^{+58}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -3 or 1.8999999999999999e58 < l Initial program 100.0%
Applied egg-rr13.7%
if -3 < l < 1.8999999999999999e58Initial program 75.1%
Taylor expanded in J around 0 67.0%
Final simplification43.2%
(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 86.2%
Taylor expanded in l around 0 90.7%
Taylor expanded in K around 0 70.9%
Taylor expanded in l around 0 54.1%
associate-*r*54.1%
Simplified54.1%
Final simplification54.1%
(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 86.2%
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 86.2%
Taylor expanded in J around 0 38.1%
Final simplification38.1%
herbie shell --seed 2023306
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))