
(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 12 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 -500000.0) (not (<= t_1 0.001)))
(+ (* t_0 (* t_1 J)) U)
(+
U
(*
t_0
(*
J
(+
(* 0.3333333333333333 (pow l 3.0))
(+ (* 0.016666666666666666 (pow l 5.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 <= -500000.0) || !(t_1 <= 0.001)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + ((0.016666666666666666 * pow(l, 5.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) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-500000.0d0)) .or. (.not. (t_1 <= 0.001d0))) then
tmp = (t_0 * (t_1 * j)) + u
else
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + ((0.016666666666666666d0 * (l ** 5.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 t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -500000.0) || !(t_1 <= 0.001)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + ((0.016666666666666666 * Math.pow(l, 5.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 <= -500000.0) or not (t_1 <= 0.001): tmp = (t_0 * (t_1 * J)) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + ((0.016666666666666666 * math.pow(l, 5.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 <= -500000.0) || !(t_1 <= 0.001)) 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(Float64(0.016666666666666666 * (l ^ 5.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 <= -500000.0) || ~((t_1 <= 0.001))) tmp = (t_0 * (t_1 * J)) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + ((0.016666666666666666 * (l ^ 5.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, -500000.0], N[Not[LessEqual[t$95$1, 0.001]], $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[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -500000 \lor \neg \left(t_1 \leq 0.001\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} + \left(0.016666666666666666 \cdot {\ell}^{5} + \ell \cdot 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -5e5 or 1e-3 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -5e5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1e-3Initial program 72.6%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -500000.0) (not (<= t_1 0.001)))
(+ (* 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 <= -500000.0) || !(t_1 <= 0.001)) {
tmp = (t_0 * (t_1 * J)) + U;
} 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) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-500000.0d0)) .or. (.not. (t_1 <= 0.001d0))) then
tmp = (t_0 * (t_1 * j)) + u
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 t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -500000.0) || !(t_1 <= 0.001)) {
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 <= -500000.0) or not (t_1 <= 0.001): 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 <= -500000.0) || !(t_1 <= 0.001)) 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 <= -500000.0) || ~((t_1 <= 0.001))) 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, -500000.0], N[Not[LessEqual[t$95$1, 0.001]], $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 -500000 \lor \neg \left(t_1 \leq 0.001\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))) < -5e5 or 1e-3 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -5e5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1e-3Initial program 72.6%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (* J (pow l 5.0)) (* 0.016666666666666666 (cos (* K 0.5))))))
(t_1 (* (- (exp l) (exp (- l))) J)))
(if (<= l -4.5e+65)
t_0
(if (<= l -0.23)
(+ U t_1)
(if (<= l 85.0)
(+
U
(*
(cos (/ K 2.0))
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 3.2e+61) (+ U (* t_1 (+ (* -0.125 (* K K)) 1.0))) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * pow(l, 5.0)) * (0.016666666666666666 * cos((K * 0.5))));
double t_1 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -4.5e+65) {
tmp = t_0;
} else if (l <= -0.23) {
tmp = U + t_1;
} else if (l <= 85.0) {
tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 3.2e+61) {
tmp = U + (t_1 * ((-0.125 * (K * K)) + 1.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) :: t_1
real(8) :: tmp
t_0 = u + ((j * (l ** 5.0d0)) * (0.016666666666666666d0 * cos((k * 0.5d0))))
t_1 = (exp(l) - exp(-l)) * j
if (l <= (-4.5d+65)) then
tmp = t_0
else if (l <= (-0.23d0)) then
tmp = u + t_1
else if (l <= 85.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 3.2d+61) then
tmp = u + (t_1 * (((-0.125d0) * (k * k)) + 1.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 = U + ((J * Math.pow(l, 5.0)) * (0.016666666666666666 * Math.cos((K * 0.5))));
double t_1 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -4.5e+65) {
tmp = t_0;
} else if (l <= -0.23) {
tmp = U + t_1;
} else if (l <= 85.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 3.2e+61) {
tmp = U + (t_1 * ((-0.125 * (K * K)) + 1.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * math.pow(l, 5.0)) * (0.016666666666666666 * math.cos((K * 0.5)))) t_1 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -4.5e+65: tmp = t_0 elif l <= -0.23: tmp = U + t_1 elif l <= 85.0: tmp = U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 3.2e+61: tmp = U + (t_1 * ((-0.125 * (K * K)) + 1.0)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * (l ^ 5.0)) * Float64(0.016666666666666666 * cos(Float64(K * 0.5))))) t_1 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -4.5e+65) tmp = t_0; elseif (l <= -0.23) tmp = Float64(U + t_1); elseif (l <= 85.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 3.2e+61) tmp = Float64(U + Float64(t_1 * Float64(Float64(-0.125 * Float64(K * K)) + 1.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * (l ^ 5.0)) * (0.016666666666666666 * cos((K * 0.5)))); t_1 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -4.5e+65) tmp = t_0; elseif (l <= -0.23) tmp = U + t_1; elseif (l <= 85.0) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 3.2e+61) tmp = U + (t_1 * ((-0.125 * (K * K)) + 1.0)); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] * N[(0.016666666666666666 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -4.5e+65], t$95$0, If[LessEqual[l, -0.23], N[(U + t$95$1), $MachinePrecision], If[LessEqual[l, 85.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * 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, 3.2e+61], N[(U + N[(t$95$1 * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 \cdot \cos \left(K \cdot 0.5\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+65}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -0.23:\\
\;\;\;\;U + t_1\\
\mathbf{elif}\;\ell \leq 85:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 3.2 \cdot 10^{+61}:\\
\;\;\;\;U + t_1 \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -4.5e65 or 3.1999999999999998e61 < 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%
Simplified100.0%
if -4.5e65 < l < -0.23000000000000001Initial program 99.9%
Taylor expanded in K around 0 93.9%
if -0.23000000000000001 < l < 85Initial program 72.6%
Taylor expanded in l around 0 99.9%
if 85 < l < 3.1999999999999998e61Initial program 100.0%
Taylor expanded in K around 0 0.0%
associate-*r*0.0%
distribute-rgt1-in73.7%
unpow273.7%
Simplified73.7%
Final simplification97.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (* J (pow l 5.0)) (* 0.016666666666666666 (cos (* K 0.5))))))
(t_1 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -4.5e+65)
t_0
(if (<= l -0.053)
t_1
(if (<= l 200.0)
(+
U
(*
(cos (/ K 2.0))
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 4.5e+61) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * pow(l, 5.0)) * (0.016666666666666666 * cos((K * 0.5))));
double t_1 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -4.5e+65) {
tmp = t_0;
} else if (l <= -0.053) {
tmp = t_1;
} else if (l <= 200.0) {
tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.5e+61) {
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 * (l ** 5.0d0)) * (0.016666666666666666d0 * cos((k * 0.5d0))))
t_1 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-4.5d+65)) then
tmp = t_0
else if (l <= (-0.053d0)) then
tmp = t_1
else if (l <= 200.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 4.5d+61) 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 * Math.pow(l, 5.0)) * (0.016666666666666666 * Math.cos((K * 0.5))));
double t_1 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -4.5e+65) {
tmp = t_0;
} else if (l <= -0.053) {
tmp = t_1;
} else if (l <= 200.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.5e+61) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * math.pow(l, 5.0)) * (0.016666666666666666 * math.cos((K * 0.5)))) t_1 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -4.5e+65: tmp = t_0 elif l <= -0.053: tmp = t_1 elif l <= 200.0: tmp = U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 4.5e+61: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * (l ^ 5.0)) * Float64(0.016666666666666666 * cos(Float64(K * 0.5))))) t_1 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -4.5e+65) tmp = t_0; elseif (l <= -0.053) tmp = t_1; elseif (l <= 200.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 4.5e+61) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * (l ^ 5.0)) * (0.016666666666666666 * cos((K * 0.5)))); t_1 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -4.5e+65) tmp = t_0; elseif (l <= -0.053) tmp = t_1; elseif (l <= 200.0) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 4.5e+61) 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 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] * N[(0.016666666666666666 * N[Cos[N[(K * 0.5), $MachinePrecision]], $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, -4.5e+65], t$95$0, If[LessEqual[l, -0.053], t$95$1, If[LessEqual[l, 200.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * 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.5e+61], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 \cdot \cos \left(K \cdot 0.5\right)\right)\\
t_1 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+65}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -0.053:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 200:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -4.5e65 or 4.5e61 < 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%
Simplified100.0%
if -4.5e65 < l < -0.0529999999999999985 or 200 < l < 4.5e61Initial program 99.9%
Taylor expanded in K around 0 81.3%
if -0.0529999999999999985 < l < 200Initial program 72.8%
Taylor expanded in l around 0 99.2%
Final simplification97.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* (* J (pow l 5.0)) (* 0.016666666666666666 t_0))))
(t_2 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -4.5e+65)
t_1
(if (<= l -0.0026)
t_2
(if (<= l 200.0)
(+ U (* 2.0 (* l (* J t_0))))
(if (<= l 1.95e+61) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + ((J * pow(l, 5.0)) * (0.016666666666666666 * t_0));
double t_2 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -4.5e+65) {
tmp = t_1;
} else if (l <= -0.0026) {
tmp = t_2;
} else if (l <= 200.0) {
tmp = U + (2.0 * (l * (J * t_0)));
} else if (l <= 1.95e+61) {
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 * 0.5d0))
t_1 = u + ((j * (l ** 5.0d0)) * (0.016666666666666666d0 * t_0))
t_2 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-4.5d+65)) then
tmp = t_1
else if (l <= (-0.0026d0)) then
tmp = t_2
else if (l <= 200.0d0) then
tmp = u + (2.0d0 * (l * (j * t_0)))
else if (l <= 1.95d+61) 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 * 0.5));
double t_1 = U + ((J * Math.pow(l, 5.0)) * (0.016666666666666666 * t_0));
double t_2 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -4.5e+65) {
tmp = t_1;
} else if (l <= -0.0026) {
tmp = t_2;
} else if (l <= 200.0) {
tmp = U + (2.0 * (l * (J * t_0)));
} else if (l <= 1.95e+61) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + ((J * math.pow(l, 5.0)) * (0.016666666666666666 * t_0)) t_2 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -4.5e+65: tmp = t_1 elif l <= -0.0026: tmp = t_2 elif l <= 200.0: tmp = U + (2.0 * (l * (J * t_0))) elif l <= 1.95e+61: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64(Float64(J * (l ^ 5.0)) * Float64(0.016666666666666666 * t_0))) t_2 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -4.5e+65) tmp = t_1; elseif (l <= -0.0026) tmp = t_2; elseif (l <= 200.0) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * t_0)))); elseif (l <= 1.95e+61) tmp = t_2; 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 + ((J * (l ^ 5.0)) * (0.016666666666666666 * t_0)); t_2 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -4.5e+65) tmp = t_1; elseif (l <= -0.0026) tmp = t_2; elseif (l <= 200.0) tmp = U + (2.0 * (l * (J * t_0))); elseif (l <= 1.95e+61) 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 * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] * N[(0.016666666666666666 * t$95$0), $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, -4.5e+65], t$95$1, If[LessEqual[l, -0.0026], t$95$2, If[LessEqual[l, 200.0], N[(U + N[(2.0 * N[(l * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.95e+61], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 \cdot t_0\right)\\
t_2 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+65}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.0026:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 200:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot t_0\right)\right)\\
\mathbf{elif}\;\ell \leq 1.95 \cdot 10^{+61}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -4.5e65 or 1.94999999999999994e61 < 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%
Simplified100.0%
if -4.5e65 < l < -0.0025999999999999999 or 200 < l < 1.94999999999999994e61Initial program 99.9%
Taylor expanded in K around 0 81.3%
if -0.0025999999999999999 < l < 200Initial program 72.8%
Taylor expanded in l around 0 98.6%
*-commutative98.6%
associate-*l*98.7%
*-commutative98.7%
Simplified98.7%
Final simplification97.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.00325) (not (<= l 200.0))) (+ U (* (- (exp l) (exp (- l))) J)) (+ U (* 2.0 (* l (* J (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.00325) || !(l <= 200.0)) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = U + (2.0 * (l * (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 <= (-0.00325d0)) .or. (.not. (l <= 200.0d0))) then
tmp = u + ((exp(l) - exp(-l)) * j)
else
tmp = u + (2.0d0 * (l * (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 <= -0.00325) || !(l <= 200.0)) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.00325) or not (l <= 200.0): tmp = U + ((math.exp(l) - math.exp(-l)) * J) else: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.00325) || !(l <= 200.0)) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.00325) || ~((l <= 200.0))) tmp = U + ((exp(l) - exp(-l)) * J); else tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.00325], N[Not[LessEqual[l, 200.0]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.00325 \lor \neg \left(\ell \leq 200\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -0.00324999999999999985 or 200 < l Initial program 100.0%
Taylor expanded in K around 0 76.1%
if -0.00324999999999999985 < l < 200Initial program 72.8%
Taylor expanded in l around 0 98.6%
*-commutative98.6%
associate-*l*98.7%
*-commutative98.7%
Simplified98.7%
Final simplification86.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.06) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) (+ U (* 0.016666666666666666 (* J (pow l 5.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.06) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (0.016666666666666666 * (J * pow(l, 5.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.06d0)) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else
tmp = u + (0.016666666666666666d0 * (j * (l ** 5.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.06) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (0.016666666666666666 * (J * Math.pow(l, 5.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.06: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = U + (0.016666666666666666 * (J * math.pow(l, 5.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.06) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); else tmp = Float64(U + Float64(0.016666666666666666 * Float64(J * (l ^ 5.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.06) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = U + (0.016666666666666666 * (J * (l ^ 5.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.06], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.016666666666666666 * N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.06:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.059999999999999998Initial program 85.5%
Taylor expanded in l around 0 56.5%
Taylor expanded in K around 0 43.0%
associate-*r*43.0%
distribute-rgt-out55.5%
*-commutative55.5%
unpow255.5%
Simplified55.5%
if -0.059999999999999998 < (cos.f64 (/.f64 K 2)) Initial program 87.3%
Taylor expanded in l around 0 92.0%
Taylor expanded in l around inf 79.0%
associate-*r*79.0%
*-commutative79.0%
Simplified79.0%
Taylor expanded in K around 0 79.0%
Final simplification73.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (pow l 5.0))) (t_1 (+ U (* 0.016666666666666666 t_0))))
(if (<= l -6.5)
t_1
(if (<= l 196.0)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 1.65e+47)
(+
U
(* t_0 (+ 0.016666666666666666 (* (* K K) -0.0020833333333333333))))
t_1)))))
double code(double J, double l, double K, double U) {
double t_0 = J * pow(l, 5.0);
double t_1 = U + (0.016666666666666666 * t_0);
double tmp;
if (l <= -6.5) {
tmp = t_1;
} else if (l <= 196.0) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 1.65e+47) {
tmp = U + (t_0 * (0.016666666666666666 + ((K * K) * -0.0020833333333333333)));
} 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) :: tmp
t_0 = j * (l ** 5.0d0)
t_1 = u + (0.016666666666666666d0 * t_0)
if (l <= (-6.5d0)) then
tmp = t_1
else if (l <= 196.0d0) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else if (l <= 1.65d+47) then
tmp = u + (t_0 * (0.016666666666666666d0 + ((k * k) * (-0.0020833333333333333d0))))
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 = J * Math.pow(l, 5.0);
double t_1 = U + (0.016666666666666666 * t_0);
double tmp;
if (l <= -6.5) {
tmp = t_1;
} else if (l <= 196.0) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 1.65e+47) {
tmp = U + (t_0 * (0.016666666666666666 + ((K * K) * -0.0020833333333333333)));
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = J * math.pow(l, 5.0) t_1 = U + (0.016666666666666666 * t_0) tmp = 0 if l <= -6.5: tmp = t_1 elif l <= 196.0: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 1.65e+47: tmp = U + (t_0 * (0.016666666666666666 + ((K * K) * -0.0020833333333333333))) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(J * (l ^ 5.0)) t_1 = Float64(U + Float64(0.016666666666666666 * t_0)) tmp = 0.0 if (l <= -6.5) tmp = t_1; elseif (l <= 196.0) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 1.65e+47) tmp = Float64(U + Float64(t_0 * Float64(0.016666666666666666 + Float64(Float64(K * K) * -0.0020833333333333333)))); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * (l ^ 5.0); t_1 = U + (0.016666666666666666 * t_0); tmp = 0.0; if (l <= -6.5) tmp = t_1; elseif (l <= 196.0) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); elseif (l <= 1.65e+47) tmp = U + (t_0 * (0.016666666666666666 + ((K * K) * -0.0020833333333333333))); else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(0.016666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.5], t$95$1, If[LessEqual[l, 196.0], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.65e+47], N[(U + N[(t$95$0 * N[(0.016666666666666666 + N[(N[(K * K), $MachinePrecision] * -0.0020833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot {\ell}^{5}\\
t_1 := U + 0.016666666666666666 \cdot t_0\\
\mathbf{if}\;\ell \leq -6.5:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 196:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+47}:\\
\;\;\;\;U + t_0 \cdot \left(0.016666666666666666 + \left(K \cdot K\right) \cdot -0.0020833333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -6.5 or 1.65e47 < l Initial program 100.0%
Taylor expanded in l around 0 92.3%
Taylor expanded in l around inf 92.3%
associate-*r*92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in K around 0 70.8%
if -6.5 < l < 196Initial program 72.6%
Taylor expanded in l around 0 99.4%
*-commutative99.4%
associate-*l*99.4%
*-commutative99.4%
Simplified99.4%
if 196 < l < 1.65e47Initial program 100.0%
Taylor expanded in l around 0 13.0%
Taylor expanded in l around inf 13.0%
associate-*r*13.0%
*-commutative13.0%
Simplified13.0%
Taylor expanded in K around 0 32.8%
+-commutative32.8%
associate-*r*32.8%
distribute-rgt-out40.5%
unpow240.5%
Simplified40.5%
Final simplification82.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -6.6) (not (<= l 1520000.0))) (+ U (* 0.016666666666666666 (* J (pow l 5.0)))) (+ U (* 2.0 (* l (* J (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6.6) || !(l <= 1520000.0)) {
tmp = U + (0.016666666666666666 * (J * pow(l, 5.0)));
} else {
tmp = U + (2.0 * (l * (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 <= (-6.6d0)) .or. (.not. (l <= 1520000.0d0))) then
tmp = u + (0.016666666666666666d0 * (j * (l ** 5.0d0)))
else
tmp = u + (2.0d0 * (l * (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 <= -6.6) || !(l <= 1520000.0)) {
tmp = U + (0.016666666666666666 * (J * Math.pow(l, 5.0)));
} else {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -6.6) or not (l <= 1520000.0): tmp = U + (0.016666666666666666 * (J * math.pow(l, 5.0))) else: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -6.6) || !(l <= 1520000.0)) tmp = Float64(U + Float64(0.016666666666666666 * Float64(J * (l ^ 5.0)))); else tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -6.6) || ~((l <= 1520000.0))) tmp = U + (0.016666666666666666 * (J * (l ^ 5.0))); else tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -6.6], N[Not[LessEqual[l, 1520000.0]], $MachinePrecision]], N[(U + N[(0.016666666666666666 * N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.6 \lor \neg \left(\ell \leq 1520000\right):\\
\;\;\;\;U + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -6.5999999999999996 or 1.52e6 < l Initial program 100.0%
Taylor expanded in l around 0 85.1%
Taylor expanded in l around inf 85.1%
associate-*r*85.1%
*-commutative85.1%
Simplified85.1%
Taylor expanded in K around 0 64.8%
if -6.5999999999999996 < l < 1.52e6Initial program 72.8%
Taylor expanded in l around 0 98.6%
*-commutative98.6%
associate-*l*98.7%
*-commutative98.7%
Simplified98.7%
Final simplification81.0%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.45e+78) (not (<= l 1.45e-43))) (+ 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 <= -1.45e+78) || !(l <= 1.45e-43)) {
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 <= (-1.45d+78)) .or. (.not. (l <= 1.45d-43))) 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 <= -1.45e+78) || !(l <= 1.45e-43)) {
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 <= -1.45e+78) or not (l <= 1.45e-43): 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 <= -1.45e+78) || !(l <= 1.45e-43)) 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 <= -1.45e+78) || ~((l <= 1.45e-43))) 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, -1.45e+78], N[Not[LessEqual[l, 1.45e-43]], $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 -1.45 \cdot 10^{+78} \lor \neg \left(\ell \leq 1.45 \cdot 10^{-43}\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 < -1.45000000000000008e78 or 1.4500000000000001e-43 < l Initial program 97.4%
Taylor expanded in l around 0 36.9%
Taylor expanded in K around 0 20.1%
associate-*r*20.1%
distribute-rgt-out39.7%
*-commutative39.7%
unpow239.7%
Simplified39.7%
if -1.45000000000000008e78 < l < 1.4500000000000001e-43Initial program 76.4%
Taylor expanded in l around 0 87.2%
Taylor expanded in K around 0 75.9%
Final simplification57.8%
(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 86.9%
Taylor expanded in l around 0 62.1%
Taylor expanded in K around 0 52.4%
Final simplification52.4%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 86.9%
Applied egg-rr24.5%
Taylor expanded in J around 0 35.2%
Final simplification35.2%
herbie shell --seed 2023268
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))