
(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 11 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 0.5))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -2e+24) (not (<= t_1 2e-6)))
(+ (* (* t_1 J) (cos (/ K 2.0))) U)
(+
U
(+
(* 0.3333333333333333 (* J (* (pow l 3.0) t_0)))
(* 2.0 (* J (* l t_0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -2e+24) || !(t_1 <= 2e-6)) {
tmp = ((t_1 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + ((0.3333333333333333 * (J * (pow(l, 3.0) * t_0))) + (2.0 * (J * (l * 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 = cos((k * 0.5d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-2d+24)) .or. (.not. (t_1 <= 2d-6))) then
tmp = ((t_1 * j) * cos((k / 2.0d0))) + u
else
tmp = u + ((0.3333333333333333d0 * (j * ((l ** 3.0d0) * t_0))) + (2.0d0 * (j * (l * t_0))))
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 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -2e+24) || !(t_1 <= 2e-6)) {
tmp = ((t_1 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + ((0.3333333333333333 * (J * (Math.pow(l, 3.0) * t_0))) + (2.0 * (J * (l * t_0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -2e+24) or not (t_1 <= 2e-6): tmp = ((t_1 * J) * math.cos((K / 2.0))) + U else: tmp = U + ((0.3333333333333333 * (J * (math.pow(l, 3.0) * t_0))) + (2.0 * (J * (l * t_0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= -2e+24) || !(t_1 <= 2e-6)) tmp = Float64(Float64(Float64(t_1 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(Float64(0.3333333333333333 * Float64(J * Float64((l ^ 3.0) * t_0))) + Float64(2.0 * Float64(J * Float64(l * t_0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -2e+24) || ~((t_1 <= 2e-6))) tmp = ((t_1 * J) * cos((K / 2.0))) + U; else tmp = U + ((0.3333333333333333 * (J * ((l ^ 3.0) * t_0))) + (2.0 * (J * (l * t_0)))); 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[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+24], N[Not[LessEqual[t$95$1, 2e-6]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(0.3333333333333333 * N[(J * N[(N[Power[l, 3.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+24} \lor \neg \left(t_1 \leq 2 \cdot 10^{-6}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(0.3333333333333333 \cdot \left(J \cdot \left({\ell}^{3} \cdot t_0\right)\right) + 2 \cdot \left(J \cdot \left(\ell \cdot t_0\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -2e24 or 1.99999999999999991e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -2e24 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.99999999999999991e-6Initial program 69.9%
Taylor expanded in l around 0 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -2e+24) (not (<= t_1 2e-6)))
(+ (* (* t_1 J) t_0) 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 <= -2e+24) || !(t_1 <= 2e-6)) {
tmp = ((t_1 * J) * t_0) + 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 <= (-2d+24)) .or. (.not. (t_1 <= 2d-6))) then
tmp = ((t_1 * j) * t_0) + 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 <= -2e+24) || !(t_1 <= 2e-6)) {
tmp = ((t_1 * J) * t_0) + 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 <= -2e+24) or not (t_1 <= 2e-6): tmp = ((t_1 * J) * t_0) + 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 <= -2e+24) || !(t_1 <= 2e-6)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + 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 <= -2e+24) || ~((t_1 <= 2e-6))) tmp = ((t_1 * J) * t_0) + 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, -2e+24], N[Not[LessEqual[t$95$1, 2e-6]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(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 -2 \cdot 10^{+24} \lor \neg \left(t_1 \leq 2 \cdot 10^{-6}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + 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))) < -2e24 or 1.99999999999999991e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -2e24 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.99999999999999991e-6Initial program 69.9%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* 0.3333333333333333 (pow l 3.0)))
(t_1 (- (exp l) (exp (- l))))
(t_2 (cos (/ K 2.0)))
(t_3 (+ U (* t_2 (* J t_0)))))
(if (<= l -5e+125)
t_3
(if (<= l -57.0)
(+ (* t_1 J) U)
(if (<= l 13.6)
(+ U (* t_2 (* J (+ t_0 (* l 2.0)))))
(if (<= l 6.5e+100)
(+ U (* t_1 (+ J (* J (* -0.125 (* K K))))))
t_3))))))
double code(double J, double l, double K, double U) {
double t_0 = 0.3333333333333333 * pow(l, 3.0);
double t_1 = exp(l) - exp(-l);
double t_2 = cos((K / 2.0));
double t_3 = U + (t_2 * (J * t_0));
double tmp;
if (l <= -5e+125) {
tmp = t_3;
} else if (l <= -57.0) {
tmp = (t_1 * J) + U;
} else if (l <= 13.6) {
tmp = U + (t_2 * (J * (t_0 + (l * 2.0))));
} else if (l <= 6.5e+100) {
tmp = U + (t_1 * (J + (J * (-0.125 * (K * K)))));
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_0 = 0.3333333333333333d0 * (l ** 3.0d0)
t_1 = exp(l) - exp(-l)
t_2 = cos((k / 2.0d0))
t_3 = u + (t_2 * (j * t_0))
if (l <= (-5d+125)) then
tmp = t_3
else if (l <= (-57.0d0)) then
tmp = (t_1 * j) + u
else if (l <= 13.6d0) then
tmp = u + (t_2 * (j * (t_0 + (l * 2.0d0))))
else if (l <= 6.5d+100) then
tmp = u + (t_1 * (j + (j * ((-0.125d0) * (k * k)))))
else
tmp = t_3
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = 0.3333333333333333 * Math.pow(l, 3.0);
double t_1 = Math.exp(l) - Math.exp(-l);
double t_2 = Math.cos((K / 2.0));
double t_3 = U + (t_2 * (J * t_0));
double tmp;
if (l <= -5e+125) {
tmp = t_3;
} else if (l <= -57.0) {
tmp = (t_1 * J) + U;
} else if (l <= 13.6) {
tmp = U + (t_2 * (J * (t_0 + (l * 2.0))));
} else if (l <= 6.5e+100) {
tmp = U + (t_1 * (J + (J * (-0.125 * (K * K)))));
} else {
tmp = t_3;
}
return tmp;
}
def code(J, l, K, U): t_0 = 0.3333333333333333 * math.pow(l, 3.0) t_1 = math.exp(l) - math.exp(-l) t_2 = math.cos((K / 2.0)) t_3 = U + (t_2 * (J * t_0)) tmp = 0 if l <= -5e+125: tmp = t_3 elif l <= -57.0: tmp = (t_1 * J) + U elif l <= 13.6: tmp = U + (t_2 * (J * (t_0 + (l * 2.0)))) elif l <= 6.5e+100: tmp = U + (t_1 * (J + (J * (-0.125 * (K * K))))) else: tmp = t_3 return tmp
function code(J, l, K, U) t_0 = Float64(0.3333333333333333 * (l ^ 3.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) t_2 = cos(Float64(K / 2.0)) t_3 = Float64(U + Float64(t_2 * Float64(J * t_0))) tmp = 0.0 if (l <= -5e+125) tmp = t_3; elseif (l <= -57.0) tmp = Float64(Float64(t_1 * J) + U); elseif (l <= 13.6) tmp = Float64(U + Float64(t_2 * Float64(J * Float64(t_0 + Float64(l * 2.0))))); elseif (l <= 6.5e+100) tmp = Float64(U + Float64(t_1 * Float64(J + Float64(J * Float64(-0.125 * Float64(K * K)))))); else tmp = t_3; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = 0.3333333333333333 * (l ^ 3.0); t_1 = exp(l) - exp(-l); t_2 = cos((K / 2.0)); t_3 = U + (t_2 * (J * t_0)); tmp = 0.0; if (l <= -5e+125) tmp = t_3; elseif (l <= -57.0) tmp = (t_1 * J) + U; elseif (l <= 13.6) tmp = U + (t_2 * (J * (t_0 + (l * 2.0)))); elseif (l <= 6.5e+100) tmp = U + (t_1 * (J + (J * (-0.125 * (K * K))))); else tmp = t_3; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(U + N[(t$95$2 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e+125], t$95$3, If[LessEqual[l, -57.0], N[(N[(t$95$1 * J), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 13.6], N[(U + N[(t$95$2 * N[(J * N[(t$95$0 + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e+100], N[(U + N[(t$95$1 * N[(J + N[(J * N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.3333333333333333 \cdot {\ell}^{3}\\
t_1 := e^{\ell} - e^{-\ell}\\
t_2 := \cos \left(\frac{K}{2}\right)\\
t_3 := U + t_2 \cdot \left(J \cdot t_0\right)\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+125}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\ell \leq -57:\\
\;\;\;\;t_1 \cdot J + U\\
\mathbf{elif}\;\ell \leq 13.6:\\
\;\;\;\;U + t_2 \cdot \left(J \cdot \left(t_0 + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{+100}:\\
\;\;\;\;U + t_1 \cdot \left(J + J \cdot \left(-0.125 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if l < -4.99999999999999962e125 or 6.50000000000000001e100 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -4.99999999999999962e125 < l < -57Initial program 100.0%
Taylor expanded in K around 0 76.9%
if -57 < l < 13.5999999999999996Initial program 70.2%
Taylor expanded in l around 0 99.1%
if 13.5999999999999996 < l < 6.50000000000000001e100Initial program 100.0%
Taylor expanded in K around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
associate-*r*0.0%
distribute-rgt-out91.7%
associate-*r*91.7%
*-commutative91.7%
associate-*l*91.7%
unpow291.7%
Simplified91.7%
Final simplification96.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* 0.3333333333333333 (pow l 3.0)))
(t_1 (cos (/ K 2.0)))
(t_2 (+ U (* t_1 (* J t_0))))
(t_3 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1.96e+105)
t_2
(if (<= l -57.0)
t_3
(if (<= l 16500000000.0)
(+ U (* t_1 (* J (+ t_0 (* l 2.0)))))
(if (<= l 6.3e+100) t_3 t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = 0.3333333333333333 * pow(l, 3.0);
double t_1 = cos((K / 2.0));
double t_2 = U + (t_1 * (J * t_0));
double t_3 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1.96e+105) {
tmp = t_2;
} else if (l <= -57.0) {
tmp = t_3;
} else if (l <= 16500000000.0) {
tmp = U + (t_1 * (J * (t_0 + (l * 2.0))));
} else if (l <= 6.3e+100) {
tmp = t_3;
} else {
tmp = t_2;
}
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) :: t_3
real(8) :: tmp
t_0 = 0.3333333333333333d0 * (l ** 3.0d0)
t_1 = cos((k / 2.0d0))
t_2 = u + (t_1 * (j * t_0))
t_3 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1.96d+105)) then
tmp = t_2
else if (l <= (-57.0d0)) then
tmp = t_3
else if (l <= 16500000000.0d0) then
tmp = u + (t_1 * (j * (t_0 + (l * 2.0d0))))
else if (l <= 6.3d+100) then
tmp = t_3
else
tmp = t_2
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = 0.3333333333333333 * Math.pow(l, 3.0);
double t_1 = Math.cos((K / 2.0));
double t_2 = U + (t_1 * (J * t_0));
double t_3 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1.96e+105) {
tmp = t_2;
} else if (l <= -57.0) {
tmp = t_3;
} else if (l <= 16500000000.0) {
tmp = U + (t_1 * (J * (t_0 + (l * 2.0))));
} else if (l <= 6.3e+100) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(J, l, K, U): t_0 = 0.3333333333333333 * math.pow(l, 3.0) t_1 = math.cos((K / 2.0)) t_2 = U + (t_1 * (J * t_0)) t_3 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1.96e+105: tmp = t_2 elif l <= -57.0: tmp = t_3 elif l <= 16500000000.0: tmp = U + (t_1 * (J * (t_0 + (l * 2.0)))) elif l <= 6.3e+100: tmp = t_3 else: tmp = t_2 return tmp
function code(J, l, K, U) t_0 = Float64(0.3333333333333333 * (l ^ 3.0)) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(U + Float64(t_1 * Float64(J * t_0))) t_3 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1.96e+105) tmp = t_2; elseif (l <= -57.0) tmp = t_3; elseif (l <= 16500000000.0) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(t_0 + Float64(l * 2.0))))); elseif (l <= 6.3e+100) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = 0.3333333333333333 * (l ^ 3.0); t_1 = cos((K / 2.0)); t_2 = U + (t_1 * (J * t_0)); t_3 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1.96e+105) tmp = t_2; elseif (l <= -57.0) tmp = t_3; elseif (l <= 16500000000.0) tmp = U + (t_1 * (J * (t_0 + (l * 2.0)))); elseif (l <= 6.3e+100) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(t$95$1 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1.96e+105], t$95$2, If[LessEqual[l, -57.0], t$95$3, If[LessEqual[l, 16500000000.0], N[(U + N[(t$95$1 * N[(J * N[(t$95$0 + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.3e+100], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.3333333333333333 \cdot {\ell}^{3}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := U + t_1 \cdot \left(J \cdot t_0\right)\\
t_3 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1.96 \cdot 10^{+105}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -57:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\ell \leq 16500000000:\\
\;\;\;\;U + t_1 \cdot \left(J \cdot \left(t_0 + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 6.3 \cdot 10^{+100}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -1.95999999999999994e105 or 6.3000000000000004e100 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -1.95999999999999994e105 < l < -57 or 1.65e10 < l < 6.3000000000000004e100Initial program 100.0%
Taylor expanded in K around 0 79.6%
if -57 < l < 1.65e10Initial program 70.5%
Taylor expanded in l around 0 98.3%
Final simplification95.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* J (* 0.3333333333333333 (pow l 3.0))))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1.96e+105)
t_0
(if (<= l -57.0)
t_1
(if (<= l 16500000000.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 4.3e+100) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (0.3333333333333333 * pow(l, 3.0))));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1.96e+105) {
tmp = t_0;
} else if (l <= -57.0) {
tmp = t_1;
} else if (l <= 16500000000.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 4.3e+100) {
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 + (cos((k / 2.0d0)) * (j * (0.3333333333333333d0 * (l ** 3.0d0))))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1.96d+105)) then
tmp = t_0
else if (l <= (-57.0d0)) then
tmp = t_1
else if (l <= 16500000000.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 4.3d+100) 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 + (Math.cos((K / 2.0)) * (J * (0.3333333333333333 * Math.pow(l, 3.0))));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1.96e+105) {
tmp = t_0;
} else if (l <= -57.0) {
tmp = t_1;
} else if (l <= 16500000000.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 4.3e+100) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * (0.3333333333333333 * math.pow(l, 3.0)))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1.96e+105: tmp = t_0 elif l <= -57.0: tmp = t_1 elif l <= 16500000000.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 4.3e+100: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1.96e+105) tmp = t_0; elseif (l <= -57.0) tmp = t_1; elseif (l <= 16500000000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 4.3e+100) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (J * (0.3333333333333333 * (l ^ 3.0)))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1.96e+105) tmp = t_0; elseif (l <= -57.0) tmp = t_1; elseif (l <= 16500000000.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 4.3e+100) 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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1.96e+105], t$95$0, If[LessEqual[l, -57.0], t$95$1, If[LessEqual[l, 16500000000.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.3e+100], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1.96 \cdot 10^{+105}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -57:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 16500000000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{+100}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.95999999999999994e105 or 4.29999999999999993e100 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -1.95999999999999994e105 < l < -57 or 1.65e10 < l < 4.29999999999999993e100Initial program 100.0%
Taylor expanded in K around 0 79.6%
if -57 < l < 1.65e10Initial program 70.5%
Taylor expanded in l around 0 98.2%
Final simplification95.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.04)
(+ U (* J (* l -6.0)))
(if (<= t_0 0.832)
(+ U (* J (* (* K (* l K)) 192.0)))
(+ U (* 2.0 (* l J)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.04) {
tmp = U + (J * (l * -6.0));
} else if (t_0 <= 0.832) {
tmp = U + (J * ((K * (l * K)) * 192.0));
} 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) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= (-0.04d0)) then
tmp = u + (j * (l * (-6.0d0)))
else if (t_0 <= 0.832d0) then
tmp = u + (j * ((k * (l * k)) * 192.0d0))
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 t_0 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= -0.04) {
tmp = U + (J * (l * -6.0));
} else if (t_0 <= 0.832) {
tmp = U + (J * ((K * (l * K)) * 192.0));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.04: tmp = U + (J * (l * -6.0)) elif t_0 <= 0.832: tmp = U + (J * ((K * (l * K)) * 192.0)) else: tmp = U + (2.0 * (l * J)) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.04) tmp = Float64(U + Float64(J * Float64(l * -6.0))); elseif (t_0 <= 0.832) tmp = Float64(U + Float64(J * Float64(Float64(K * Float64(l * K)) * 192.0))); else tmp = Float64(U + Float64(2.0 * Float64(l * J))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.04) tmp = U + (J * (l * -6.0)); elseif (t_0 <= 0.832) tmp = U + (J * ((K * (l * K)) * 192.0)); else tmp = U + (2.0 * (l * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.04], N[(U + N[(J * N[(l * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.832], N[(U + N[(J * N[(N[(K * N[(l * K), $MachinePrecision]), $MachinePrecision] * 192.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq -0.04:\\
\;\;\;\;U + J \cdot \left(\ell \cdot -6\right)\\
\mathbf{elif}\;t_0 \leq 0.832:\\
\;\;\;\;U + J \cdot \left(\left(K \cdot \left(\ell \cdot K\right)\right) \cdot 192\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.0400000000000000008Initial program 82.3%
Taylor expanded in l around 0 72.8%
associate-*r*72.8%
*-commutative72.8%
Simplified72.8%
Applied egg-rr46.8%
*-commutative46.8%
Simplified46.8%
Taylor expanded in K around 0 57.5%
*-commutative57.5%
associate-*l*58.8%
Simplified58.8%
if -0.0400000000000000008 < (cos.f64 (/.f64 K 2)) < 0.831999999999999962Initial program 83.7%
Taylor expanded in l around 0 61.5%
associate-*r*61.5%
*-commutative61.5%
Simplified61.5%
Applied egg-rr28.1%
*-commutative28.1%
Simplified28.1%
Taylor expanded in K around 0 58.4%
*-commutative58.4%
unpow258.4%
Simplified58.4%
Taylor expanded in K around inf 58.4%
*-commutative58.4%
associate-*l*58.4%
*-commutative58.4%
unpow258.4%
associate-*r*58.5%
Simplified58.5%
if 0.831999999999999962 < (cos.f64 (/.f64 K 2)) Initial program 90.2%
Taylor expanded in l around 0 58.0%
associate-*r*58.0%
*-commutative58.0%
Simplified58.0%
Taylor expanded in K around 0 56.8%
Final simplification57.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.55) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.55) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.55d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.55) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.55: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.55) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.55) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.55], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.55:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.55000000000000004Initial program 80.4%
Taylor expanded in l around 0 75.1%
if 0.55000000000000004 < (cos.f64 (/.f64 K 2)) Initial program 90.8%
Taylor expanded in l around 0 83.2%
Taylor expanded in K around 0 81.7%
Final simplification79.2%
(FPCore (J l K U) :precision binary64 (if (or (<= J -2.2e+141) (not (<= J 2.6e+72))) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) (+ (* (- (exp l) (exp (- l))) J) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -2.2e+141) || !(J <= 2.6e+72)) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = ((exp(l) - exp(-l)) * J) + U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((j <= (-2.2d+141)) .or. (.not. (j <= 2.6d+72))) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = ((exp(l) - exp(-l)) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -2.2e+141) || !(J <= 2.6e+72)) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -2.2e+141) or not (J <= 2.6e+72): tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = ((math.exp(l) - math.exp(-l)) * J) + U return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -2.2e+141) || !(J <= 2.6e+72)) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -2.2e+141) || ~((J <= 2.6e+72))) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = ((exp(l) - exp(-l)) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -2.2e+141], N[Not[LessEqual[J, 2.6e+72]], $MachinePrecision]], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -2.2 \cdot 10^{+141} \lor \neg \left(J \leq 2.6 \cdot 10^{+72}\right):\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\end{array}
\end{array}
if J < -2.2e141 or 2.59999999999999981e72 < J Initial program 70.5%
Taylor expanded in l around 0 88.0%
if -2.2e141 < J < 2.59999999999999981e72Initial program 97.5%
Taylor expanded in K around 0 86.8%
Final simplification87.3%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * cos((K * 0.5)))));
}
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 * (j * (l * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (2.0 * (J * (l * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 86.8%
Taylor expanded in l around 0 62.9%
Final simplification62.9%
(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.8%
Taylor expanded in l around 0 62.9%
associate-*r*62.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in K around 0 48.3%
Final simplification48.3%
(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.8%
Applied egg-rr23.1%
Taylor expanded in J around 0 31.6%
Final simplification31.6%
herbie shell --seed 2023275
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))