
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}
\end{array}
\end{array}
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U (* t_0 (* J 2.0))) 2.0)))))
(t_2 (* J t_0)))
(if (<= t_1 (- INFINITY))
(- U)
(if (<= t_1 1e+303) (* -2.0 (* t_2 (hypot 1.0 (/ U (* 2.0 t_2))))) U))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / (t_0 * (J * 2.0))), 2.0)));
double t_2 = J * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U;
} else if (t_1 <= 1e+303) {
tmp = -2.0 * (t_2 * hypot(1.0, (U / (2.0 * t_2))));
} else {
tmp = U;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / (t_0 * (J * 2.0))), 2.0)));
double t_2 = J * t_0;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = -U;
} else if (t_1 <= 1e+303) {
tmp = -2.0 * (t_2 * Math.hypot(1.0, (U / (2.0 * t_2))));
} else {
tmp = U;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) t_1 = ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / (t_0 * (J * 2.0))), 2.0))) t_2 = J * t_0 tmp = 0 if t_1 <= -math.inf: tmp = -U elif t_1 <= 1e+303: tmp = -2.0 * (t_2 * math.hypot(1.0, (U / (2.0 * t_2)))) else: tmp = U return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) t_2 = Float64(J * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U); elseif (t_1 <= 1e+303) tmp = Float64(-2.0 * Float64(t_2 * hypot(1.0, Float64(U / Float64(2.0 * t_2))))); else tmp = U; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / (t_0 * (J * 2.0))) ^ 2.0))); t_2 = J * t_0; tmp = 0.0; if (t_1 <= -Inf) tmp = -U; elseif (t_1 <= 1e+303) tmp = -2.0 * (t_2 * hypot(1.0, (U / (2.0 * t_2)))); else tmp = U; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(J * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U), If[LessEqual[t$95$1, 1e+303], N[(-2.0 * N[(t$95$2 * N[Sqrt[1.0 ^ 2 + N[(U / N[(2.0 * t$95$2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], U]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{t_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
t_2 := J \cdot t_0\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-U\\
\mathbf{elif}\;t_1 \leq 10^{+303}:\\
\;\;\;\;-2 \cdot \left(t_2 \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot t_2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < -inf.0Initial program 5.7%
associate-*l*5.7%
associate-*l*5.7%
*-commutative5.7%
unpow25.7%
sqr-neg5.7%
distribute-frac-neg5.7%
distribute-frac-neg5.7%
unpow25.7%
Simplified58.9%
Taylor expanded in J around 0 44.4%
Taylor expanded in U around 0 44.4%
mul-1-neg44.4%
Simplified44.4%
if -inf.0 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < 1e303Initial program 99.7%
associate-*l*99.7%
associate-*l*99.7%
unpow299.7%
sqr-neg99.7%
distribute-frac-neg99.7%
distribute-frac-neg99.7%
unpow299.7%
Simplified99.7%
if 1e303 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) Initial program 5.4%
associate-*l*5.4%
associate-*l*5.4%
*-commutative5.4%
unpow25.4%
sqr-neg5.4%
distribute-frac-neg5.4%
distribute-frac-neg5.4%
unpow25.4%
Simplified41.9%
Taylor expanded in U around -inf 46.5%
*-commutative46.5%
Simplified46.5%
Taylor expanded in U around 0 46.5%
Final simplification82.8%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* -2.0 (* t_0 (* J (hypot 1.0 (* (/ U (* J t_0)) 0.5)))))))
(if (<= J -6.9e-161)
t_1
(if (<= J -2e-310) U (if (<= J 6.2e-234) (- U) t_1)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = -2.0 * (t_0 * (J * hypot(1.0, ((U / (J * t_0)) * 0.5))));
double tmp;
if (J <= -6.9e-161) {
tmp = t_1;
} else if (J <= -2e-310) {
tmp = U;
} else if (J <= 6.2e-234) {
tmp = -U;
} else {
tmp = t_1;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = -2.0 * (t_0 * (J * Math.hypot(1.0, ((U / (J * t_0)) * 0.5))));
double tmp;
if (J <= -6.9e-161) {
tmp = t_1;
} else if (J <= -2e-310) {
tmp = U;
} else if (J <= 6.2e-234) {
tmp = -U;
} else {
tmp = t_1;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) t_1 = -2.0 * (t_0 * (J * math.hypot(1.0, ((U / (J * t_0)) * 0.5)))) tmp = 0 if J <= -6.9e-161: tmp = t_1 elif J <= -2e-310: tmp = U elif J <= 6.2e-234: tmp = -U else: tmp = t_1 return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(-2.0 * Float64(t_0 * Float64(J * hypot(1.0, Float64(Float64(U / Float64(J * t_0)) * 0.5))))) tmp = 0.0 if (J <= -6.9e-161) tmp = t_1; elseif (J <= -2e-310) tmp = U; elseif (J <= 6.2e-234) tmp = Float64(-U); else tmp = t_1; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); t_1 = -2.0 * (t_0 * (J * hypot(1.0, ((U / (J * t_0)) * 0.5)))); tmp = 0.0; if (J <= -6.9e-161) tmp = t_1; elseif (J <= -2e-310) tmp = U; elseif (J <= 6.2e-234) tmp = -U; else tmp = t_1; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * N[(t$95$0 * N[(J * N[Sqrt[1.0 ^ 2 + N[(N[(U / N[(J * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -6.9e-161], t$95$1, If[LessEqual[J, -2e-310], U, If[LessEqual[J, 6.2e-234], (-U), t$95$1]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := -2 \cdot \left(t_0 \cdot \left(J \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot t_0} \cdot 0.5\right)\right)\right)\\
\mathbf{if}\;J \leq -6.9 \cdot 10^{-161}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -2 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 6.2 \cdot 10^{-234}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if J < -6.90000000000000002e-161 or 6.2000000000000003e-234 < J Initial program 81.6%
associate-*l*81.6%
associate-*l*81.6%
*-commutative81.6%
unpow281.6%
sqr-neg81.6%
distribute-frac-neg81.6%
distribute-frac-neg81.6%
unpow281.6%
Simplified93.0%
if -6.90000000000000002e-161 < J < -1.999999999999994e-310Initial program 26.5%
associate-*l*26.5%
associate-*l*26.5%
*-commutative26.5%
unpow226.5%
sqr-neg26.5%
distribute-frac-neg26.5%
distribute-frac-neg26.5%
unpow226.5%
Simplified48.3%
Taylor expanded in U around -inf 46.1%
*-commutative46.1%
Simplified46.1%
Taylor expanded in U around 0 46.1%
if -1.999999999999994e-310 < J < 6.2000000000000003e-234Initial program 19.3%
associate-*l*19.3%
associate-*l*19.3%
*-commutative19.3%
unpow219.3%
sqr-neg19.3%
distribute-frac-neg19.3%
distribute-frac-neg19.3%
unpow219.3%
Simplified50.0%
Taylor expanded in J around 0 38.4%
Taylor expanded in U around 0 38.4%
mul-1-neg38.4%
Simplified38.4%
Final simplification83.2%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* (* J (cos (/ K 2.0))) (hypot 1.0 (* U (/ 0.5 J)))))))
(if (<= J -1e-156)
t_0
(if (<= J -7e-308) U (if (<= J 1.05e-49) (- U) t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * ((J * cos((K / 2.0))) * hypot(1.0, (U * (0.5 / J))));
double tmp;
if (J <= -1e-156) {
tmp = t_0;
} else if (J <= -7e-308) {
tmp = U;
} else if (J <= 1.05e-49) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * ((J * Math.cos((K / 2.0))) * Math.hypot(1.0, (U * (0.5 / J))));
double tmp;
if (J <= -1e-156) {
tmp = t_0;
} else if (J <= -7e-308) {
tmp = U;
} else if (J <= 1.05e-49) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * ((J * math.cos((K / 2.0))) * math.hypot(1.0, (U * (0.5 / J)))) tmp = 0 if J <= -1e-156: tmp = t_0 elif J <= -7e-308: tmp = U elif J <= 1.05e-49: tmp = -U else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(Float64(J * cos(Float64(K / 2.0))) * hypot(1.0, Float64(U * Float64(0.5 / J))))) tmp = 0.0 if (J <= -1e-156) tmp = t_0; elseif (J <= -7e-308) tmp = U; elseif (J <= 1.05e-49) tmp = Float64(-U); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * ((J * cos((K / 2.0))) * hypot(1.0, (U * (0.5 / J)))); tmp = 0.0; if (J <= -1e-156) tmp = t_0; elseif (J <= -7e-308) tmp = U; elseif (J <= 1.05e-49) tmp = -U; else tmp = t_0; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U * N[(0.5 / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -1e-156], t$95$0, If[LessEqual[J, -7e-308], U, If[LessEqual[J, 1.05e-49], (-U), t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(\left(J \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \mathsf{hypot}\left(1, U \cdot \frac{0.5}{J}\right)\right)\\
\mathbf{if}\;J \leq -1 \cdot 10^{-156}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -7 \cdot 10^{-308}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.05 \cdot 10^{-49}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -1.00000000000000004e-156 or 1.0499999999999999e-49 < J Initial program 85.3%
associate-*l*85.3%
associate-*l*85.3%
unpow285.3%
sqr-neg85.3%
distribute-frac-neg85.3%
distribute-frac-neg85.3%
unpow285.3%
Simplified95.7%
Taylor expanded in K around 0 82.0%
associate-*r/82.0%
*-commutative82.0%
associate-*r/81.9%
Simplified81.9%
if -1.00000000000000004e-156 < J < -7e-308Initial program 26.5%
associate-*l*26.5%
associate-*l*26.5%
*-commutative26.5%
unpow226.5%
sqr-neg26.5%
distribute-frac-neg26.5%
distribute-frac-neg26.5%
unpow226.5%
Simplified48.3%
Taylor expanded in U around -inf 46.1%
*-commutative46.1%
Simplified46.1%
Taylor expanded in U around 0 46.1%
if -7e-308 < J < 1.0499999999999999e-49Initial program 40.6%
associate-*l*40.6%
associate-*l*40.6%
*-commutative40.6%
unpow240.6%
sqr-neg40.6%
distribute-frac-neg40.6%
distribute-frac-neg40.6%
unpow240.6%
Simplified64.2%
Taylor expanded in J around 0 41.6%
Taylor expanded in U around 0 41.6%
mul-1-neg41.6%
Simplified41.6%
Final simplification70.5%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* J (cos (/ K 2.0)))) (t_1 (* -2.0 t_0)))
(if (<= J -2.75e-18)
t_1
(if (<= J -2e-310)
U
(if (<= J 4.2e-45)
(- U)
(if (<= J 1.5e+22)
(* -2.0 (* t_0 (+ 1.0 (* 0.125 (/ (* U U) (* J J))))))
(if (<= J 3.2e+57) (- U) t_1)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = J * cos((K / 2.0));
double t_1 = -2.0 * t_0;
double tmp;
if (J <= -2.75e-18) {
tmp = t_1;
} else if (J <= -2e-310) {
tmp = U;
} else if (J <= 4.2e-45) {
tmp = -U;
} else if (J <= 1.5e+22) {
tmp = -2.0 * (t_0 * (1.0 + (0.125 * ((U * U) / (J * J)))));
} else if (J <= 3.2e+57) {
tmp = -U;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = j * cos((k / 2.0d0))
t_1 = (-2.0d0) * t_0
if (j <= (-2.75d-18)) then
tmp = t_1
else if (j <= (-2d-310)) then
tmp = u
else if (j <= 4.2d-45) then
tmp = -u
else if (j <= 1.5d+22) then
tmp = (-2.0d0) * (t_0 * (1.0d0 + (0.125d0 * ((u * u) / (j * j)))))
else if (j <= 3.2d+57) then
tmp = -u
else
tmp = t_1
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = J * Math.cos((K / 2.0));
double t_1 = -2.0 * t_0;
double tmp;
if (J <= -2.75e-18) {
tmp = t_1;
} else if (J <= -2e-310) {
tmp = U;
} else if (J <= 4.2e-45) {
tmp = -U;
} else if (J <= 1.5e+22) {
tmp = -2.0 * (t_0 * (1.0 + (0.125 * ((U * U) / (J * J)))));
} else if (J <= 3.2e+57) {
tmp = -U;
} else {
tmp = t_1;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = J * math.cos((K / 2.0)) t_1 = -2.0 * t_0 tmp = 0 if J <= -2.75e-18: tmp = t_1 elif J <= -2e-310: tmp = U elif J <= 4.2e-45: tmp = -U elif J <= 1.5e+22: tmp = -2.0 * (t_0 * (1.0 + (0.125 * ((U * U) / (J * J))))) elif J <= 3.2e+57: tmp = -U else: tmp = t_1 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(J * cos(Float64(K / 2.0))) t_1 = Float64(-2.0 * t_0) tmp = 0.0 if (J <= -2.75e-18) tmp = t_1; elseif (J <= -2e-310) tmp = U; elseif (J <= 4.2e-45) tmp = Float64(-U); elseif (J <= 1.5e+22) tmp = Float64(-2.0 * Float64(t_0 * Float64(1.0 + Float64(0.125 * Float64(Float64(U * U) / Float64(J * J)))))); elseif (J <= 3.2e+57) tmp = Float64(-U); else tmp = t_1; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = J * cos((K / 2.0)); t_1 = -2.0 * t_0; tmp = 0.0; if (J <= -2.75e-18) tmp = t_1; elseif (J <= -2e-310) tmp = U; elseif (J <= 4.2e-45) tmp = -U; elseif (J <= 1.5e+22) tmp = -2.0 * (t_0 * (1.0 + (0.125 * ((U * U) / (J * J))))); elseif (J <= 3.2e+57) tmp = -U; else tmp = t_1; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * t$95$0), $MachinePrecision]}, If[LessEqual[J, -2.75e-18], t$95$1, If[LessEqual[J, -2e-310], U, If[LessEqual[J, 4.2e-45], (-U), If[LessEqual[J, 1.5e+22], N[(-2.0 * N[(t$95$0 * N[(1.0 + N[(0.125 * N[(N[(U * U), $MachinePrecision] / N[(J * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 3.2e+57], (-U), t$95$1]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := J \cdot \cos \left(\frac{K}{2}\right)\\
t_1 := -2 \cdot t_0\\
\mathbf{if}\;J \leq -2.75 \cdot 10^{-18}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -2 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 4.2 \cdot 10^{-45}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 1.5 \cdot 10^{+22}:\\
\;\;\;\;-2 \cdot \left(t_0 \cdot \left(1 + 0.125 \cdot \frac{U \cdot U}{J \cdot J}\right)\right)\\
\mathbf{elif}\;J \leq 3.2 \cdot 10^{+57}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if J < -2.75e-18 or 3.20000000000000029e57 < J Initial program 95.0%
associate-*l*95.0%
associate-*l*95.0%
*-commutative95.0%
unpow295.0%
sqr-neg95.0%
distribute-frac-neg95.0%
distribute-frac-neg95.0%
unpow295.0%
Simplified99.7%
Taylor expanded in J around inf 81.7%
if -2.75e-18 < J < -1.999999999999994e-310Initial program 43.2%
associate-*l*43.2%
associate-*l*43.2%
*-commutative43.2%
unpow243.2%
sqr-neg43.2%
distribute-frac-neg43.2%
distribute-frac-neg43.2%
unpow243.2%
Simplified67.9%
Taylor expanded in U around -inf 42.2%
*-commutative42.2%
Simplified42.2%
Taylor expanded in U around 0 42.2%
if -1.999999999999994e-310 < J < 4.1999999999999999e-45 or 1.5e22 < J < 3.20000000000000029e57Initial program 49.6%
associate-*l*49.6%
associate-*l*49.6%
*-commutative49.6%
unpow249.6%
sqr-neg49.6%
distribute-frac-neg49.6%
distribute-frac-neg49.6%
unpow249.6%
Simplified70.5%
Taylor expanded in J around 0 45.0%
Taylor expanded in U around 0 45.0%
mul-1-neg45.0%
Simplified45.0%
if 4.1999999999999999e-45 < J < 1.5e22Initial program 91.4%
associate-*l*91.4%
associate-*l*91.4%
unpow291.4%
sqr-neg91.4%
distribute-frac-neg91.4%
distribute-frac-neg91.4%
unpow291.4%
Simplified99.7%
Taylor expanded in K around 0 78.6%
associate-*r/78.6%
*-commutative78.6%
associate-*r/78.6%
Simplified78.6%
Taylor expanded in U around 0 66.6%
unpow266.6%
unpow266.6%
Simplified66.6%
Final simplification61.9%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* J (cos (/ K 2.0))))))
(if (<= J -3.95e-20)
t_0
(if (<= J -2e-310)
U
(if (or (<= J 2.65e-48) (and (not (<= J 4.5e+21)) (<= J 2.4e+57)))
(- U)
t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J * cos((K / 2.0)));
double tmp;
if (J <= -3.95e-20) {
tmp = t_0;
} else if (J <= -2e-310) {
tmp = U;
} else if ((J <= 2.65e-48) || (!(J <= 4.5e+21) && (J <= 2.4e+57))) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = (-2.0d0) * (j * cos((k / 2.0d0)))
if (j <= (-3.95d-20)) then
tmp = t_0
else if (j <= (-2d-310)) then
tmp = u
else if ((j <= 2.65d-48) .or. (.not. (j <= 4.5d+21)) .and. (j <= 2.4d+57)) then
tmp = -u
else
tmp = t_0
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * (J * Math.cos((K / 2.0)));
double tmp;
if (J <= -3.95e-20) {
tmp = t_0;
} else if (J <= -2e-310) {
tmp = U;
} else if ((J <= 2.65e-48) || (!(J <= 4.5e+21) && (J <= 2.4e+57))) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J * math.cos((K / 2.0))) tmp = 0 if J <= -3.95e-20: tmp = t_0 elif J <= -2e-310: tmp = U elif (J <= 2.65e-48) or (not (J <= 4.5e+21) and (J <= 2.4e+57)): tmp = -U else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J * cos(Float64(K / 2.0)))) tmp = 0.0 if (J <= -3.95e-20) tmp = t_0; elseif (J <= -2e-310) tmp = U; elseif ((J <= 2.65e-48) || (!(J <= 4.5e+21) && (J <= 2.4e+57))) tmp = Float64(-U); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (J * cos((K / 2.0))); tmp = 0.0; if (J <= -3.95e-20) tmp = t_0; elseif (J <= -2e-310) tmp = U; elseif ((J <= 2.65e-48) || (~((J <= 4.5e+21)) && (J <= 2.4e+57))) tmp = -U; else tmp = t_0; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -3.95e-20], t$95$0, If[LessEqual[J, -2e-310], U, If[Or[LessEqual[J, 2.65e-48], And[N[Not[LessEqual[J, 4.5e+21]], $MachinePrecision], LessEqual[J, 2.4e+57]]], (-U), t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\\
\mathbf{if}\;J \leq -3.95 \cdot 10^{-20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -2 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 2.65 \cdot 10^{-48} \lor \neg \left(J \leq 4.5 \cdot 10^{+21}\right) \land J \leq 2.4 \cdot 10^{+57}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -3.9499999999999999e-20 or 2.65e-48 < J < 4.5e21 or 2.40000000000000005e57 < J Initial program 94.0%
associate-*l*94.0%
associate-*l*94.0%
*-commutative94.0%
unpow294.0%
sqr-neg94.0%
distribute-frac-neg94.0%
distribute-frac-neg94.0%
unpow294.0%
Simplified99.7%
Taylor expanded in J around inf 79.9%
if -3.9499999999999999e-20 < J < -1.999999999999994e-310Initial program 43.2%
associate-*l*43.2%
associate-*l*43.2%
*-commutative43.2%
unpow243.2%
sqr-neg43.2%
distribute-frac-neg43.2%
distribute-frac-neg43.2%
unpow243.2%
Simplified67.9%
Taylor expanded in U around -inf 42.2%
*-commutative42.2%
Simplified42.2%
Taylor expanded in U around 0 42.2%
if -1.999999999999994e-310 < J < 2.65e-48 or 4.5e21 < J < 2.40000000000000005e57Initial program 49.5%
associate-*l*49.5%
associate-*l*49.5%
*-commutative49.5%
unpow249.5%
sqr-neg49.5%
distribute-frac-neg49.5%
distribute-frac-neg49.5%
unpow249.5%
Simplified69.4%
Taylor expanded in J around 0 44.8%
Taylor expanded in U around 0 44.8%
mul-1-neg44.8%
Simplified44.8%
Final simplification61.9%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -1.3e+109) (* -2.0 (+ J (* (* J -0.125) (* K K)))) (if (<= J -2e-310) U (if (<= J 1.25e+159) (- U) (* -2.0 J)))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -1.3e+109) {
tmp = -2.0 * (J + ((J * -0.125) * (K * K)));
} else if (J <= -2e-310) {
tmp = U;
} else if (J <= 1.25e+159) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (j <= (-1.3d+109)) then
tmp = (-2.0d0) * (j + ((j * (-0.125d0)) * (k * k)))
else if (j <= (-2d-310)) then
tmp = u
else if (j <= 1.25d+159) then
tmp = -u
else
tmp = (-2.0d0) * j
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (J <= -1.3e+109) {
tmp = -2.0 * (J + ((J * -0.125) * (K * K)));
} else if (J <= -2e-310) {
tmp = U;
} else if (J <= 1.25e+159) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -1.3e+109: tmp = -2.0 * (J + ((J * -0.125) * (K * K))) elif J <= -2e-310: tmp = U elif J <= 1.25e+159: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -1.3e+109) tmp = Float64(-2.0 * Float64(J + Float64(Float64(J * -0.125) * Float64(K * K)))); elseif (J <= -2e-310) tmp = U; elseif (J <= 1.25e+159) tmp = Float64(-U); else tmp = Float64(-2.0 * J); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (J <= -1.3e+109) tmp = -2.0 * (J + ((J * -0.125) * (K * K))); elseif (J <= -2e-310) tmp = U; elseif (J <= 1.25e+159) tmp = -U; else tmp = -2.0 * J; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[J, -1.3e+109], N[(-2.0 * N[(J + N[(N[(J * -0.125), $MachinePrecision] * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -2e-310], U, If[LessEqual[J, 1.25e+159], (-U), N[(-2.0 * J), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1.3 \cdot 10^{+109}:\\
\;\;\;\;-2 \cdot \left(J + \left(J \cdot -0.125\right) \cdot \left(K \cdot K\right)\right)\\
\mathbf{elif}\;J \leq -2 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.25 \cdot 10^{+159}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -1.2999999999999999e109Initial program 99.8%
associate-*l*99.8%
associate-*l*99.8%
*-commutative99.8%
unpow299.8%
sqr-neg99.8%
distribute-frac-neg99.8%
distribute-frac-neg99.8%
unpow299.8%
Simplified99.8%
Taylor expanded in J around inf 94.9%
Taylor expanded in K around 0 54.9%
fma-def54.9%
unpow254.9%
*-commutative54.9%
*-commutative54.9%
associate-*r*54.9%
Simplified54.9%
Taylor expanded in K around 0 55.8%
associate-*r*55.8%
unpow255.8%
Simplified55.8%
if -1.2999999999999999e109 < J < -1.999999999999994e-310Initial program 55.2%
associate-*l*55.2%
associate-*l*55.2%
*-commutative55.2%
unpow255.2%
sqr-neg55.2%
distribute-frac-neg55.2%
distribute-frac-neg55.2%
unpow255.2%
Simplified76.7%
Taylor expanded in U around -inf 38.9%
*-commutative38.9%
Simplified38.9%
Taylor expanded in U around 0 38.9%
if -1.999999999999994e-310 < J < 1.25000000000000001e159Initial program 62.8%
associate-*l*62.8%
associate-*l*62.8%
*-commutative62.8%
unpow262.8%
sqr-neg62.8%
distribute-frac-neg62.8%
distribute-frac-neg62.8%
unpow262.8%
Simplified80.2%
Taylor expanded in J around 0 37.0%
Taylor expanded in U around 0 37.0%
mul-1-neg37.0%
Simplified37.0%
if 1.25000000000000001e159 < J Initial program 99.5%
associate-*l*99.5%
associate-*l*99.5%
*-commutative99.5%
unpow299.5%
sqr-neg99.5%
distribute-frac-neg99.5%
distribute-frac-neg99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in J around inf 96.7%
Taylor expanded in K around 0 53.4%
Final simplification42.8%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -1.4e+67) (* -2.0 J) (if (<= J -8e-309) U (if (<= J 1.25e+159) (- U) (* -2.0 J)))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -1.4e+67) {
tmp = -2.0 * J;
} else if (J <= -8e-309) {
tmp = U;
} else if (J <= 1.25e+159) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (j <= (-1.4d+67)) then
tmp = (-2.0d0) * j
else if (j <= (-8d-309)) then
tmp = u
else if (j <= 1.25d+159) then
tmp = -u
else
tmp = (-2.0d0) * j
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (J <= -1.4e+67) {
tmp = -2.0 * J;
} else if (J <= -8e-309) {
tmp = U;
} else if (J <= 1.25e+159) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -1.4e+67: tmp = -2.0 * J elif J <= -8e-309: tmp = U elif J <= 1.25e+159: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -1.4e+67) tmp = Float64(-2.0 * J); elseif (J <= -8e-309) tmp = U; elseif (J <= 1.25e+159) tmp = Float64(-U); else tmp = Float64(-2.0 * J); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (J <= -1.4e+67) tmp = -2.0 * J; elseif (J <= -8e-309) tmp = U; elseif (J <= 1.25e+159) tmp = -U; else tmp = -2.0 * J; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[J, -1.4e+67], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -8e-309], U, If[LessEqual[J, 1.25e+159], (-U), N[(-2.0 * J), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1.4 \cdot 10^{+67}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -8 \cdot 10^{-309}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.25 \cdot 10^{+159}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -1.3999999999999999e67 or 1.25000000000000001e159 < J Initial program 99.7%
associate-*l*99.7%
associate-*l*99.7%
*-commutative99.7%
unpow299.7%
sqr-neg99.7%
distribute-frac-neg99.7%
distribute-frac-neg99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in J around inf 93.7%
Taylor expanded in K around 0 51.7%
if -1.3999999999999999e67 < J < -8.0000000000000003e-309Initial program 52.4%
associate-*l*52.4%
associate-*l*52.4%
*-commutative52.4%
unpow252.4%
sqr-neg52.4%
distribute-frac-neg52.4%
distribute-frac-neg52.4%
unpow252.4%
Simplified75.3%
Taylor expanded in U around -inf 40.2%
*-commutative40.2%
Simplified40.2%
Taylor expanded in U around 0 40.2%
if -8.0000000000000003e-309 < J < 1.25000000000000001e159Initial program 62.8%
associate-*l*62.8%
associate-*l*62.8%
*-commutative62.8%
unpow262.8%
sqr-neg62.8%
distribute-frac-neg62.8%
distribute-frac-neg62.8%
unpow262.8%
Simplified80.2%
Taylor expanded in J around 0 37.0%
Taylor expanded in U around 0 37.0%
mul-1-neg37.0%
Simplified37.0%
Final simplification42.8%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -7e-308) U (- U)))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -7e-308) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (j <= (-7d-308)) then
tmp = u
else
tmp = -u
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (J <= -7e-308) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -7e-308: tmp = U else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -7e-308) tmp = U; else tmp = Float64(-U); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (J <= -7e-308) tmp = U; else tmp = -U; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[J, -7e-308], U, (-U)]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -7 \cdot 10^{-308}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if J < -7e-308Initial program 67.4%
associate-*l*67.4%
associate-*l*67.4%
*-commutative67.4%
unpow267.4%
sqr-neg67.4%
distribute-frac-neg67.4%
distribute-frac-neg67.4%
unpow267.4%
Simplified83.0%
Taylor expanded in U around -inf 29.7%
*-commutative29.7%
Simplified29.7%
Taylor expanded in U around 0 29.7%
if -7e-308 < J Initial program 73.8%
associate-*l*73.8%
associate-*l*73.8%
*-commutative73.8%
unpow273.8%
sqr-neg73.8%
distribute-frac-neg73.8%
distribute-frac-neg73.8%
unpow273.8%
Simplified85.9%
Taylor expanded in J around 0 27.5%
Taylor expanded in U around 0 27.5%
mul-1-neg27.5%
Simplified27.5%
Final simplification28.7%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 U)
U = abs(U);
double code(double J, double K, double U) {
return U;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
return U;
}
U = abs(U) def code(J, K, U): return U
U = abs(U) function code(J, K, U) return U end
U = abs(U) function tmp = code(J, K, U) tmp = U; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := U
\begin{array}{l}
U = |U|\\
\\
U
\end{array}
Initial program 70.3%
associate-*l*70.3%
associate-*l*70.3%
*-commutative70.3%
unpow270.3%
sqr-neg70.3%
distribute-frac-neg70.3%
distribute-frac-neg70.3%
unpow270.3%
Simplified84.4%
Taylor expanded in U around -inf 28.1%
*-commutative28.1%
Simplified28.1%
Taylor expanded in U around 0 28.1%
Final simplification28.1%
herbie shell --seed 2023299
(FPCore (J K U)
:name "Maksimov and Kolovsky, Equation (3)"
:precision binary64
(* (* (* -2.0 J) (cos (/ K 2.0))) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) (cos (/ K 2.0)))) 2.0)))))