\[\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}
\]
↓
\[\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}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;U\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\]
(FPCore (J K U)
:precision binary64
(*
(* (* -2.0 J) (cos (/ K 2.0)))
(sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) (cos (/ K 2.0)))) 2.0)))))
↓
(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 (* (* 2.0 J) t_0)) 2.0))))))
(if (<= t_1 (- INFINITY)) U (if (<= t_1 INFINITY) t_1 (- U)))))double code(double J, double K, double U) {
return ((-2.0 * J) * cos((K / 2.0))) * sqrt((1.0 + pow((U / ((2.0 * J) * cos((K / 2.0)))), 2.0)));
}
↓
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 / ((2.0 * J) * t_0)), 2.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = U;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = -U;
}
return tmp;
}
public static double code(double J, double K, double U) {
return ((-2.0 * J) * Math.cos((K / 2.0))) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * Math.cos((K / 2.0)))), 2.0)));
}
↓
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 / ((2.0 * J) * t_0)), 2.0)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = U;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = -U;
}
return tmp;
}
def code(J, K, U):
return ((-2.0 * J) * math.cos((K / 2.0))) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * math.cos((K / 2.0)))), 2.0)))
↓
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 / ((2.0 * J) * t_0)), 2.0)))
tmp = 0
if t_1 <= -math.inf:
tmp = U
elif t_1 <= math.inf:
tmp = t_1
else:
tmp = -U
return tmp
function code(J, K, U)
return Float64(Float64(Float64(-2.0 * J) * cos(Float64(K / 2.0))) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * cos(Float64(K / 2.0)))) ^ 2.0))))
end
↓
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(Float64(2.0 * J) * t_0)) ^ 2.0))))
tmp = 0.0
if (t_1 <= Float64(-Inf))
tmp = U;
elseif (t_1 <= Inf)
tmp = t_1;
else
tmp = Float64(-U);
end
return tmp
end
function tmp = code(J, K, U)
tmp = ((-2.0 * J) * cos((K / 2.0))) * sqrt((1.0 + ((U / ((2.0 * J) * cos((K / 2.0)))) ^ 2.0)));
end
↓
function tmp_2 = code(J, K, U)
t_0 = cos((K / 2.0));
t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0)));
tmp = 0.0;
if (t_1 <= -Inf)
tmp = U;
elseif (t_1 <= Inf)
tmp = t_1;
else
tmp = -U;
end
tmp_2 = tmp;
end
code[J_, K_, U_] := N[(N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
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[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], U, If[LessEqual[t$95$1, Infinity], t$95$1, (-U)]]]]
\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}
↓
\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}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;U\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 17.3 |
|---|
| Cost | 27144 |
|---|
\[\begin{array}{l}
t_0 := \cos \left(0.5 \cdot K\right)\\
\mathbf{if}\;U \leq -6.2 \cdot 10^{+141}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 10^{+242}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{1 + {\left(U \cdot \frac{0.5}{J \cdot t_0}\right)}^{2}} \cdot \left(-2 \cdot J\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 23.4 |
|---|
| Cost | 20488 |
|---|
\[\begin{array}{l}
\mathbf{if}\;U \leq -6.8 \cdot 10^{-13}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 1.4 \cdot 10^{+237}:\\
\;\;\;\;\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{J + J}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 27.1 |
|---|
| Cost | 14624 |
|---|
\[\begin{array}{l}
t_0 := \left(-2 \cdot J\right) \cdot \sqrt{1 + {\left(\frac{U}{J + J}\right)}^{2}}\\
t_1 := \cos \left(0.5 \cdot K\right) \cdot \left(-2 \cdot J\right)\\
\mathbf{if}\;J \leq -2.65 \cdot 10^{+79}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -2.1 \cdot 10^{+67}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -1.3 \cdot 10^{-58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -4.4 \cdot 10^{-136}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -3.9 \cdot 10^{-266}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2 \cdot 10^{-261}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.5 \cdot 10^{-205}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2 \cdot 10^{-115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 1.55 \cdot 10^{-38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq 13.2:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-1 + \left(1 - \cos \left(-0.5 \cdot K\right) \cdot \left(J + J\right)\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 27.4 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
\mathbf{if}\;U \leq -1.75 \cdot 10^{-11}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 8000000000000:\\
\;\;\;\;\cos \left(0.5 \cdot K\right) \cdot \left(-2 \cdot J\right)\\
\mathbf{elif}\;U \leq 10^{+95}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 1.1 \cdot 10^{+177}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq 2.4 \cdot 10^{+236}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 39.0 |
|---|
| Cost | 1248 |
|---|
\[\begin{array}{l}
\mathbf{if}\;J \leq -2.05 \cdot 10^{+81}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1.6 \cdot 10^{+22}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -7.6 \cdot 10^{-21}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -2.9 \cdot 10^{-132}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -2.7 \cdot 10^{-266}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 4 \cdot 10^{-261}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 5 \cdot 10^{-209}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 9.5 \cdot 10^{+64}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 47.1 |
|---|
| Cost | 524 |
|---|
\[\begin{array}{l}
\mathbf{if}\;K \leq -1.12 \cdot 10^{-259}:\\
\;\;\;\;-U\\
\mathbf{elif}\;K \leq 4.6 \cdot 10^{-160}:\\
\;\;\;\;U\\
\mathbf{elif}\;K \leq 8 \cdot 10^{-43}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 46.6 |
|---|
| Cost | 64 |
|---|
\[U
\]