
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e-12)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e-12)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e-12)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e-12): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e-12)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e-12))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e-12]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $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 -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{-12}\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 1.99999999999999996e-12 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.99999999999999996e-12Initial program 63.9%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)) (t_1 (cos (* K 0.5))))
(if (<= l -5.4e+124)
(* (* J (* 0.3333333333333333 (pow l 3.0))) t_1)
(if (<= l -14500.0)
t_0
(if (<= l 0.39)
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(if (<= l 3.5e+93)
t_0
(*
U
(+
1.0
(* 0.3333333333333333 (/ (* J (* (pow l 3.0) t_1)) U))))))))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double t_1 = cos((K * 0.5));
double tmp;
if (l <= -5.4e+124) {
tmp = (J * (0.3333333333333333 * pow(l, 3.0))) * t_1;
} else if (l <= -14500.0) {
tmp = t_0;
} else if (l <= 0.39) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else if (l <= 3.5e+93) {
tmp = t_0;
} else {
tmp = U * (1.0 + (0.3333333333333333 * ((J * (pow(l, 3.0) * t_1)) / 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) :: t_1
real(8) :: tmp
t_0 = (exp(l) - exp(-l)) * j
t_1 = cos((k * 0.5d0))
if (l <= (-5.4d+124)) then
tmp = (j * (0.3333333333333333d0 * (l ** 3.0d0))) * t_1
else if (l <= (-14500.0d0)) then
tmp = t_0
else if (l <= 0.39d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
else if (l <= 3.5d+93) then
tmp = t_0
else
tmp = u * (1.0d0 + (0.3333333333333333d0 * ((j * ((l ** 3.0d0) * t_1)) / u)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = (Math.exp(l) - Math.exp(-l)) * J;
double t_1 = Math.cos((K * 0.5));
double tmp;
if (l <= -5.4e+124) {
tmp = (J * (0.3333333333333333 * Math.pow(l, 3.0))) * t_1;
} else if (l <= -14500.0) {
tmp = t_0;
} else if (l <= 0.39) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else if (l <= 3.5e+93) {
tmp = t_0;
} else {
tmp = U * (1.0 + (0.3333333333333333 * ((J * (Math.pow(l, 3.0) * t_1)) / U)));
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J t_1 = math.cos((K * 0.5)) tmp = 0 if l <= -5.4e+124: tmp = (J * (0.3333333333333333 * math.pow(l, 3.0))) * t_1 elif l <= -14500.0: tmp = t_0 elif l <= 0.39: tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) elif l <= 3.5e+93: tmp = t_0 else: tmp = U * (1.0 + (0.3333333333333333 * ((J * (math.pow(l, 3.0) * t_1)) / U))) return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) t_1 = cos(Float64(K * 0.5)) tmp = 0.0 if (l <= -5.4e+124) tmp = Float64(Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))) * t_1); elseif (l <= -14500.0) tmp = t_0; elseif (l <= 0.39) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); elseif (l <= 3.5e+93) tmp = t_0; else tmp = Float64(U * Float64(1.0 + Float64(0.3333333333333333 * Float64(Float64(J * Float64((l ^ 3.0) * t_1)) / U)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; t_1 = cos((K * 0.5)); tmp = 0.0; if (l <= -5.4e+124) tmp = (J * (0.3333333333333333 * (l ^ 3.0))) * t_1; elseif (l <= -14500.0) tmp = t_0; elseif (l <= 0.39) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); elseif (l <= 3.5e+93) tmp = t_0; else tmp = U * (1.0 + (0.3333333333333333 * ((J * ((l ^ 3.0) * t_1)) / U))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.4e+124], N[(N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, -14500.0], t$95$0, If[LessEqual[l, 0.39], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.5e+93], t$95$0, N[(U * N[(1.0 + N[(0.3333333333333333 * N[(N[(J * N[(N[Power[l, 3.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
t_1 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{+124}:\\
\;\;\;\;\left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right) \cdot t\_1\\
\mathbf{elif}\;\ell \leq -14500:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.39:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 0.3333333333333333 \cdot \frac{J \cdot \left({\ell}^{3} \cdot t\_1\right)}{U}\right)\\
\end{array}
\end{array}
if l < -5.39999999999999956e124Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in U around inf 100.0%
Taylor expanded in U around 0 100.0%
associate-*r*100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -5.39999999999999956e124 < l < -14500 or 0.39000000000000001 < l < 3.49999999999999998e93Initial program 100.0%
Taylor expanded in K around 0 78.3%
Taylor expanded in J around inf 78.3%
if -14500 < l < 0.39000000000000001Initial program 64.2%
Taylor expanded in l around 0 99.0%
if 3.49999999999999998e93 < l Initial program 100.0%
Taylor expanded in l around 0 96.0%
Taylor expanded in l around inf 96.0%
associate-*r*96.0%
*-commutative96.0%
associate-*l*96.0%
Simplified96.0%
Taylor expanded in U around inf 98.0%
Final simplification94.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)) (t_1 (cos (* K 0.5))))
(if (<= l -5.4e+124)
(* (* J (* 0.3333333333333333 (pow l 3.0))) t_1)
(if (<= l -14500.0)
t_0
(if (<= l 0.39)
(+ U (* 2.0 (* J (* l t_1))))
(if (<= l 5e+93)
t_0
(*
U
(+
1.0
(* 0.3333333333333333 (/ (* J (* (pow l 3.0) t_1)) U))))))))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double t_1 = cos((K * 0.5));
double tmp;
if (l <= -5.4e+124) {
tmp = (J * (0.3333333333333333 * pow(l, 3.0))) * t_1;
} else if (l <= -14500.0) {
tmp = t_0;
} else if (l <= 0.39) {
tmp = U + (2.0 * (J * (l * t_1)));
} else if (l <= 5e+93) {
tmp = t_0;
} else {
tmp = U * (1.0 + (0.3333333333333333 * ((J * (pow(l, 3.0) * t_1)) / 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) :: t_1
real(8) :: tmp
t_0 = (exp(l) - exp(-l)) * j
t_1 = cos((k * 0.5d0))
if (l <= (-5.4d+124)) then
tmp = (j * (0.3333333333333333d0 * (l ** 3.0d0))) * t_1
else if (l <= (-14500.0d0)) then
tmp = t_0
else if (l <= 0.39d0) then
tmp = u + (2.0d0 * (j * (l * t_1)))
else if (l <= 5d+93) then
tmp = t_0
else
tmp = u * (1.0d0 + (0.3333333333333333d0 * ((j * ((l ** 3.0d0) * t_1)) / u)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = (Math.exp(l) - Math.exp(-l)) * J;
double t_1 = Math.cos((K * 0.5));
double tmp;
if (l <= -5.4e+124) {
tmp = (J * (0.3333333333333333 * Math.pow(l, 3.0))) * t_1;
} else if (l <= -14500.0) {
tmp = t_0;
} else if (l <= 0.39) {
tmp = U + (2.0 * (J * (l * t_1)));
} else if (l <= 5e+93) {
tmp = t_0;
} else {
tmp = U * (1.0 + (0.3333333333333333 * ((J * (Math.pow(l, 3.0) * t_1)) / U)));
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J t_1 = math.cos((K * 0.5)) tmp = 0 if l <= -5.4e+124: tmp = (J * (0.3333333333333333 * math.pow(l, 3.0))) * t_1 elif l <= -14500.0: tmp = t_0 elif l <= 0.39: tmp = U + (2.0 * (J * (l * t_1))) elif l <= 5e+93: tmp = t_0 else: tmp = U * (1.0 + (0.3333333333333333 * ((J * (math.pow(l, 3.0) * t_1)) / U))) return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) t_1 = cos(Float64(K * 0.5)) tmp = 0.0 if (l <= -5.4e+124) tmp = Float64(Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))) * t_1); elseif (l <= -14500.0) tmp = t_0; elseif (l <= 0.39) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_1)))); elseif (l <= 5e+93) tmp = t_0; else tmp = Float64(U * Float64(1.0 + Float64(0.3333333333333333 * Float64(Float64(J * Float64((l ^ 3.0) * t_1)) / U)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; t_1 = cos((K * 0.5)); tmp = 0.0; if (l <= -5.4e+124) tmp = (J * (0.3333333333333333 * (l ^ 3.0))) * t_1; elseif (l <= -14500.0) tmp = t_0; elseif (l <= 0.39) tmp = U + (2.0 * (J * (l * t_1))); elseif (l <= 5e+93) tmp = t_0; else tmp = U * (1.0 + (0.3333333333333333 * ((J * ((l ^ 3.0) * t_1)) / U))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.4e+124], N[(N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, -14500.0], t$95$0, If[LessEqual[l, 0.39], N[(U + N[(2.0 * N[(J * N[(l * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+93], t$95$0, N[(U * N[(1.0 + N[(0.3333333333333333 * N[(N[(J * N[(N[Power[l, 3.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
t_1 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{+124}:\\
\;\;\;\;\left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right) \cdot t\_1\\
\mathbf{elif}\;\ell \leq -14500:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.39:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_1\right)\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 0.3333333333333333 \cdot \frac{J \cdot \left({\ell}^{3} \cdot t\_1\right)}{U}\right)\\
\end{array}
\end{array}
if l < -5.39999999999999956e124Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in U around inf 100.0%
Taylor expanded in U around 0 100.0%
associate-*r*100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -5.39999999999999956e124 < l < -14500 or 0.39000000000000001 < l < 5.0000000000000001e93Initial program 100.0%
Taylor expanded in K around 0 78.3%
Taylor expanded in J around inf 78.3%
if -14500 < l < 0.39000000000000001Initial program 64.2%
Taylor expanded in l around 0 98.8%
if 5.0000000000000001e93 < l Initial program 100.0%
Taylor expanded in l around 0 96.0%
Taylor expanded in l around inf 96.0%
associate-*r*96.0%
*-commutative96.0%
associate-*l*96.0%
Simplified96.0%
Taylor expanded in U around inf 98.0%
Final simplification94.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J))
(t_1 (cos (* K 0.5)))
(t_2 (* (* J (* 0.3333333333333333 (pow l 3.0))) t_1)))
(if (<= l -5.4e+124)
t_2
(if (<= l -14500.0)
t_0
(if (<= l 0.39)
(+ U (* 2.0 (* J (* l t_1))))
(if (<= l 2.3e+93) t_0 t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double t_1 = cos((K * 0.5));
double t_2 = (J * (0.3333333333333333 * pow(l, 3.0))) * t_1;
double tmp;
if (l <= -5.4e+124) {
tmp = t_2;
} else if (l <= -14500.0) {
tmp = t_0;
} else if (l <= 0.39) {
tmp = U + (2.0 * (J * (l * t_1)));
} else if (l <= 2.3e+93) {
tmp = t_0;
} 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) :: tmp
t_0 = (exp(l) - exp(-l)) * j
t_1 = cos((k * 0.5d0))
t_2 = (j * (0.3333333333333333d0 * (l ** 3.0d0))) * t_1
if (l <= (-5.4d+124)) then
tmp = t_2
else if (l <= (-14500.0d0)) then
tmp = t_0
else if (l <= 0.39d0) then
tmp = u + (2.0d0 * (j * (l * t_1)))
else if (l <= 2.3d+93) then
tmp = t_0
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 = (Math.exp(l) - Math.exp(-l)) * J;
double t_1 = Math.cos((K * 0.5));
double t_2 = (J * (0.3333333333333333 * Math.pow(l, 3.0))) * t_1;
double tmp;
if (l <= -5.4e+124) {
tmp = t_2;
} else if (l <= -14500.0) {
tmp = t_0;
} else if (l <= 0.39) {
tmp = U + (2.0 * (J * (l * t_1)));
} else if (l <= 2.3e+93) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J t_1 = math.cos((K * 0.5)) t_2 = (J * (0.3333333333333333 * math.pow(l, 3.0))) * t_1 tmp = 0 if l <= -5.4e+124: tmp = t_2 elif l <= -14500.0: tmp = t_0 elif l <= 0.39: tmp = U + (2.0 * (J * (l * t_1))) elif l <= 2.3e+93: tmp = t_0 else: tmp = t_2 return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) t_1 = cos(Float64(K * 0.5)) t_2 = Float64(Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))) * t_1) tmp = 0.0 if (l <= -5.4e+124) tmp = t_2; elseif (l <= -14500.0) tmp = t_0; elseif (l <= 0.39) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_1)))); elseif (l <= 2.3e+93) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; t_1 = cos((K * 0.5)); t_2 = (J * (0.3333333333333333 * (l ^ 3.0))) * t_1; tmp = 0.0; if (l <= -5.4e+124) tmp = t_2; elseif (l <= -14500.0) tmp = t_0; elseif (l <= 0.39) tmp = U + (2.0 * (J * (l * t_1))); elseif (l <= 2.3e+93) tmp = t_0; else tmp = t_2; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[l, -5.4e+124], t$95$2, If[LessEqual[l, -14500.0], t$95$0, If[LessEqual[l, 0.39], N[(U + N[(2.0 * N[(J * N[(l * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.3e+93], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
t_1 := \cos \left(K \cdot 0.5\right)\\
t_2 := \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right) \cdot t\_1\\
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{+124}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq -14500:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.39:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_1\right)\right)\\
\mathbf{elif}\;\ell \leq 2.3 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if l < -5.39999999999999956e124 or 2.3000000000000002e93 < l Initial program 100.0%
Taylor expanded in l around 0 97.8%
Taylor expanded in l around inf 97.8%
associate-*r*97.8%
*-commutative97.8%
associate-*l*97.8%
Simplified97.8%
Taylor expanded in U around inf 98.9%
Taylor expanded in U around 0 97.8%
associate-*r*97.8%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
associate-*r*97.8%
*-commutative97.8%
associate-*l*97.8%
*-commutative97.8%
Simplified97.8%
if -5.39999999999999956e124 < l < -14500 or 0.39000000000000001 < l < 2.3000000000000002e93Initial program 100.0%
Taylor expanded in K around 0 78.3%
Taylor expanded in J around inf 78.3%
if -14500 < l < 0.39000000000000001Initial program 64.2%
Taylor expanded in l around 0 98.8%
Final simplification93.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -14500.0) (not (<= l 0.245))) (* (- (exp l) (exp (- l))) J) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -14500.0) || !(l <= 0.245)) {
tmp = (exp(l) - exp(-l)) * J;
} else {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-14500.0d0)) .or. (.not. (l <= 0.245d0))) then
tmp = (exp(l) - exp(-l)) * j
else
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -14500.0) || !(l <= 0.245)) {
tmp = (Math.exp(l) - Math.exp(-l)) * J;
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -14500.0) or not (l <= 0.245): tmp = (math.exp(l) - math.exp(-l)) * J else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -14500.0) || !(l <= 0.245)) tmp = Float64(Float64(exp(l) - exp(Float64(-l))) * J); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -14500.0) || ~((l <= 0.245))) tmp = (exp(l) - exp(-l)) * J; else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -14500.0], N[Not[LessEqual[l, 0.245]], $MachinePrecision]], N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -14500 \lor \neg \left(\ell \leq 0.245\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -14500 or 0.245 < l Initial program 100.0%
Taylor expanded in K around 0 75.0%
Taylor expanded in J around inf 75.0%
if -14500 < l < 0.245Initial program 64.2%
Taylor expanded in l around 0 98.8%
Final simplification85.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* U (+ 1.0 (* 0.3333333333333333 (* J (/ (pow l 3.0) U)))))))
(if (<= l -230000.0)
t_0
(if (<= l 8.4e-13)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 3.7e+39)
(+ U (* (* l J) (+ 2.0 (* (pow K 2.0) -0.25))))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U * (1.0 + (0.3333333333333333 * (J * (pow(l, 3.0) / U))));
double tmp;
if (l <= -230000.0) {
tmp = t_0;
} else if (l <= 8.4e-13) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 3.7e+39) {
tmp = U + ((l * J) * (2.0 + (pow(K, 2.0) * -0.25)));
} 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 = u * (1.0d0 + (0.3333333333333333d0 * (j * ((l ** 3.0d0) / u))))
if (l <= (-230000.0d0)) then
tmp = t_0
else if (l <= 8.4d-13) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 3.7d+39) then
tmp = u + ((l * j) * (2.0d0 + ((k ** 2.0d0) * (-0.25d0))))
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 * (1.0 + (0.3333333333333333 * (J * (Math.pow(l, 3.0) / U))));
double tmp;
if (l <= -230000.0) {
tmp = t_0;
} else if (l <= 8.4e-13) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 3.7e+39) {
tmp = U + ((l * J) * (2.0 + (Math.pow(K, 2.0) * -0.25)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U * (1.0 + (0.3333333333333333 * (J * (math.pow(l, 3.0) / U)))) tmp = 0 if l <= -230000.0: tmp = t_0 elif l <= 8.4e-13: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 3.7e+39: tmp = U + ((l * J) * (2.0 + (math.pow(K, 2.0) * -0.25))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U * Float64(1.0 + Float64(0.3333333333333333 * Float64(J * Float64((l ^ 3.0) / U))))) tmp = 0.0 if (l <= -230000.0) tmp = t_0; elseif (l <= 8.4e-13) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 3.7e+39) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64((K ^ 2.0) * -0.25)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U * (1.0 + (0.3333333333333333 * (J * ((l ^ 3.0) / U)))); tmp = 0.0; if (l <= -230000.0) tmp = t_0; elseif (l <= 8.4e-13) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 3.7e+39) tmp = U + ((l * J) * (2.0 + ((K ^ 2.0) * -0.25))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U * N[(1.0 + N[(0.3333333333333333 * N[(J * N[(N[Power[l, 3.0], $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -230000.0], t$95$0, If[LessEqual[l, 8.4e-13], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.7e+39], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[Power[K, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U \cdot \left(1 + 0.3333333333333333 \cdot \left(J \cdot \frac{{\ell}^{3}}{U}\right)\right)\\
\mathbf{if}\;\ell \leq -230000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 8.4 \cdot 10^{-13}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 3.7 \cdot 10^{+39}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + {K}^{2} \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -2.3e5 or 3.70000000000000012e39 < l Initial program 100.0%
Taylor expanded in l around 0 71.9%
Taylor expanded in l around inf 71.9%
associate-*r*71.9%
*-commutative71.9%
associate-*l*71.9%
Simplified71.9%
Taylor expanded in U around inf 78.2%
Taylor expanded in K around 0 59.8%
associate-/l*62.6%
Simplified62.6%
if -2.3e5 < l < 8.39999999999999955e-13Initial program 64.5%
Taylor expanded in l around 0 98.8%
if 8.39999999999999955e-13 < l < 3.70000000000000012e39Initial program 95.0%
Taylor expanded in l around 0 13.2%
Taylor expanded in K around 0 61.2%
+-commutative61.2%
*-commutative61.2%
associate-*r*61.2%
associate-*l*61.2%
*-commutative61.2%
associate-*r*61.2%
distribute-rgt-out61.2%
Simplified61.2%
Final simplification77.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* U (+ 1.0 (* 0.3333333333333333 (* J (/ (pow l 3.0) U)))))))
(if (<= l -65000.0)
t_0
(if (<= l 800.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 6.8e+36) (+ U (* -0.25 (* J (* l (pow K 2.0))))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U * (1.0 + (0.3333333333333333 * (J * (pow(l, 3.0) / U))));
double tmp;
if (l <= -65000.0) {
tmp = t_0;
} else if (l <= 800.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 6.8e+36) {
tmp = U + (-0.25 * (J * (l * pow(K, 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 = u * (1.0d0 + (0.3333333333333333d0 * (j * ((l ** 3.0d0) / u))))
if (l <= (-65000.0d0)) then
tmp = t_0
else if (l <= 800.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 6.8d+36) then
tmp = u + ((-0.25d0) * (j * (l * (k ** 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 = U * (1.0 + (0.3333333333333333 * (J * (Math.pow(l, 3.0) / U))));
double tmp;
if (l <= -65000.0) {
tmp = t_0;
} else if (l <= 800.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 6.8e+36) {
tmp = U + (-0.25 * (J * (l * Math.pow(K, 2.0))));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U * (1.0 + (0.3333333333333333 * (J * (math.pow(l, 3.0) / U)))) tmp = 0 if l <= -65000.0: tmp = t_0 elif l <= 800.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 6.8e+36: tmp = U + (-0.25 * (J * (l * math.pow(K, 2.0)))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U * Float64(1.0 + Float64(0.3333333333333333 * Float64(J * Float64((l ^ 3.0) / U))))) tmp = 0.0 if (l <= -65000.0) tmp = t_0; elseif (l <= 800.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 6.8e+36) tmp = Float64(U + Float64(-0.25 * Float64(J * Float64(l * (K ^ 2.0))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U * (1.0 + (0.3333333333333333 * (J * ((l ^ 3.0) / U)))); tmp = 0.0; if (l <= -65000.0) tmp = t_0; elseif (l <= 800.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 6.8e+36) tmp = U + (-0.25 * (J * (l * (K ^ 2.0)))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U * N[(1.0 + N[(0.3333333333333333 * N[(J * N[(N[Power[l, 3.0], $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -65000.0], t$95$0, If[LessEqual[l, 800.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, 6.8e+36], N[(U + N[(-0.25 * N[(J * N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U \cdot \left(1 + 0.3333333333333333 \cdot \left(J \cdot \frac{{\ell}^{3}}{U}\right)\right)\\
\mathbf{if}\;\ell \leq -65000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 800:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 6.8 \cdot 10^{+36}:\\
\;\;\;\;U + -0.25 \cdot \left(J \cdot \left(\ell \cdot {K}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -65000 or 6.7999999999999996e36 < l Initial program 100.0%
Taylor expanded in l around 0 71.9%
Taylor expanded in l around inf 71.9%
associate-*r*71.9%
*-commutative71.9%
associate-*l*71.9%
Simplified71.9%
Taylor expanded in U around inf 78.2%
Taylor expanded in K around 0 59.8%
associate-/l*62.6%
Simplified62.6%
if -65000 < l < 800Initial program 64.6%
Taylor expanded in l around 0 98.2%
if 800 < l < 6.7999999999999996e36Initial program 100.0%
Taylor expanded in l around 0 3.3%
Taylor expanded in K around 0 60.8%
Taylor expanded in K around inf 60.1%
*-commutative60.1%
*-commutative60.1%
Simplified60.1%
Final simplification77.6%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.55e-6)
(* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))
(if (<= l 2400.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 2.2e+41)
(+ U (* -0.25 (* J (* l (pow K 2.0)))))
(* 0.3333333333333333 (* J (pow l 3.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.55e-6) {
tmp = J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))));
} else if (l <= 2400.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 2.2e+41) {
tmp = U + (-0.25 * (J * (l * pow(K, 2.0))));
} else {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-1.55d-6)) then
tmp = j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))
else if (l <= 2400.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 2.2d+41) then
tmp = u + ((-0.25d0) * (j * (l * (k ** 2.0d0))))
else
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.55e-6) {
tmp = J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))));
} else if (l <= 2400.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 2.2e+41) {
tmp = U + (-0.25 * (J * (l * Math.pow(K, 2.0))));
} else {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.55e-6: tmp = J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))) elif l <= 2400.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 2.2e+41: tmp = U + (-0.25 * (J * (l * math.pow(K, 2.0)))) else: tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.55e-6) tmp = Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))); elseif (l <= 2400.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 2.2e+41) tmp = Float64(U + Float64(-0.25 * Float64(J * Float64(l * (K ^ 2.0))))); else tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1.55e-6) tmp = J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))); elseif (l <= 2400.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 2.2e+41) tmp = U + (-0.25 * (J * (l * (K ^ 2.0)))); else tmp = 0.3333333333333333 * (J * (l ^ 3.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.55e-6], N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2400.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, 2.2e+41], N[(U + N[(-0.25 * N[(J * N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{-6}:\\
\;\;\;\;J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 2400:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{+41}:\\
\;\;\;\;U + -0.25 \cdot \left(J \cdot \left(\ell \cdot {K}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if l < -1.55e-6Initial program 99.6%
Taylor expanded in l around 0 67.9%
Taylor expanded in K around 0 51.8%
Taylor expanded in J around inf 51.9%
if -1.55e-6 < l < 2400Initial program 64.2%
Taylor expanded in l around 0 99.2%
if 2400 < l < 2.1999999999999999e41Initial program 100.0%
Taylor expanded in l around 0 3.3%
Taylor expanded in K around 0 60.8%
Taylor expanded in K around inf 60.1%
*-commutative60.1%
*-commutative60.1%
Simplified60.1%
if 2.1999999999999999e41 < l Initial program 100.0%
Taylor expanded in l around 0 76.0%
Taylor expanded in K around 0 58.5%
Taylor expanded in l around inf 58.5%
associate-*r*76.0%
*-commutative76.0%
associate-*l*76.0%
Simplified58.5%
Taylor expanded in J around inf 58.6%
Final simplification73.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -5e-11) (not (<= l 4.8e-14))) (* J (* l 2.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5e-11) || !(l <= 4.8e-14)) {
tmp = J * (l * 2.0);
} 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 <= (-5d-11)) .or. (.not. (l <= 4.8d-14))) then
tmp = j * (l * 2.0d0)
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 <= -5e-11) || !(l <= 4.8e-14)) {
tmp = J * (l * 2.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -5e-11) or not (l <= 4.8e-14): tmp = J * (l * 2.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -5e-11) || !(l <= 4.8e-14)) tmp = Float64(J * Float64(l * 2.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -5e-11) || ~((l <= 4.8e-14))) tmp = J * (l * 2.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -5e-11], N[Not[LessEqual[l, 4.8e-14]], $MachinePrecision]], N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-11} \lor \neg \left(\ell \leq 4.8 \cdot 10^{-14}\right):\\
\;\;\;\;J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -5.00000000000000018e-11 or 4.8e-14 < l Initial program 99.4%
Taylor expanded in l around 0 30.0%
Taylor expanded in K around 0 33.5%
Taylor expanded in K around 0 24.2%
associate-*r*24.2%
*-commutative24.2%
associate-*l*24.2%
*-commutative24.2%
Simplified24.2%
Taylor expanded in J around inf 24.3%
*-commutative24.3%
associate-*r*24.3%
Simplified24.3%
if -5.00000000000000018e-11 < l < 4.8e-14Initial program 64.0%
Taylor expanded in K around 0 64.0%
Taylor expanded in J around 0 64.0%
Final simplification40.6%
(FPCore (J l K U) :precision binary64 (+ U (* l (+ (* l (* l (* J 0.3333333333333333))) (* J 2.0)))))
double code(double J, double l, double K, double U) {
return U + (l * ((l * (l * (J * 0.3333333333333333))) + (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 * ((l * (l * (j * 0.3333333333333333d0))) + (j * 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * ((l * (l * (J * 0.3333333333333333))) + (J * 2.0)));
}
def code(J, l, K, U): return U + (l * ((l * (l * (J * 0.3333333333333333))) + (J * 2.0)))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(Float64(l * Float64(l * Float64(J * 0.3333333333333333))) + Float64(J * 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + (l * ((l * (l * (J * 0.3333333333333333))) + (J * 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(N[(l * N[(l * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(\ell \cdot \left(\ell \cdot \left(J \cdot 0.3333333333333333\right)\right) + J \cdot 2\right)
\end{array}
Initial program 84.9%
Taylor expanded in K around 0 70.1%
Taylor expanded in l around 0 60.5%
associate-*r*60.5%
Applied egg-rr60.5%
unpow260.5%
associate-*r*60.5%
*-commutative60.5%
Applied egg-rr60.5%
Final simplification60.5%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* 2.0 (/ (* l J) U)))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * ((l * J) / 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 * (1.0d0 + (2.0d0 * ((l * j) / u)))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * ((l * J) / U)));
}
def code(J, l, K, U): return U * (1.0 + (2.0 * ((l * J) / U)))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(2.0 * Float64(Float64(l * J) / U)))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (2.0 * ((l * J) / U))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(2.0 * N[(N[(l * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + 2 \cdot \frac{\ell \cdot J}{U}\right)
\end{array}
Initial program 84.9%
Taylor expanded in l around 0 58.7%
Taylor expanded in K around 0 41.7%
Taylor expanded in K around 0 46.6%
associate-*r*46.6%
*-commutative46.6%
associate-*l*46.6%
*-commutative46.6%
Simplified46.6%
Taylor expanded in U around inf 50.5%
Final simplification50.5%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 84.9%
Taylor expanded in K around 0 70.1%
Taylor expanded in l around 0 46.6%
Final simplification46.6%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 84.9%
Taylor expanded in K around 0 70.1%
Taylor expanded in J around 0 27.5%
herbie shell --seed 2024096
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))