\[\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)\\
\left(t_0 \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\right) \cdot \left(-2 \cdot J\right)
\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_0 (hypot 1.0 (/ U (* J (* 2.0 t_0))))) (* -2.0 J))))
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));
return (t_0 * hypot(1.0, (U / (J * (2.0 * t_0))))) * (-2.0 * J);
}
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));
return (t_0 * Math.hypot(1.0, (U / (J * (2.0 * t_0))))) * (-2.0 * J);
}
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))
return (t_0 * math.hypot(1.0, (U / (J * (2.0 * t_0))))) * (-2.0 * J)
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))
return Float64(Float64(t_0 * hypot(1.0, Float64(U / Float64(J * Float64(2.0 * t_0))))) * Float64(-2.0 * J))
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 = code(J, K, U)
t_0 = cos((K / 2.0));
tmp = (t_0 * hypot(1.0, (U / (J * (2.0 * t_0))))) * (-2.0 * J);
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]}, N[(N[(t$95$0 * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(-2.0 * J), $MachinePrecision]), $MachinePrecision]]
\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)\\
\left(t_0 \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\right) \cdot \left(-2 \cdot J\right)
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 17.3 |
|---|
| Cost | 14224 |
|---|
\[\begin{array}{l}
t_0 := \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right) \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\\
\mathbf{if}\;J \leq -1.55 \cdot 10^{-259}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 3.6 \cdot 10^{-199}:\\
\;\;\;\;-2 \cdot \left(J \cdot \frac{J}{U}\right) - U\\
\mathbf{elif}\;J \leq 8.8 \cdot 10^{-187}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 6.8 \cdot 10^{-161}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 26.0 |
|---|
| Cost | 7640 |
|---|
\[\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right) \cdot \left(-2 \cdot J\right)\\
\mathbf{if}\;J \leq -1 \cdot 10^{-95}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-190}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.35 \cdot 10^{-198}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 4.6 \cdot 10^{-187}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 4.6 \cdot 10^{-154}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 8.5 \cdot 10^{-20}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 21.0 |
|---|
| Cost | 7568 |
|---|
\[\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right) \cdot \left(-2 \cdot J\right)\\
\mathbf{if}\;K \leq -1.1 \cdot 10^{+151}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;K \leq -7.4 \cdot 10^{+97}:\\
\;\;\;\;U\\
\mathbf{elif}\;K \leq -0.06:\\
\;\;\;\;t_0\\
\mathbf{elif}\;K \leq 9.8 \cdot 10^{+29}:\\
\;\;\;\;J \cdot \left(-2 \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 38.8 |
|---|
| Cost | 1356 |
|---|
\[\begin{array}{l}
\mathbf{if}\;J \leq -2.1 \cdot 10^{+182}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -2.5 \cdot 10^{+157}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -2.2 \cdot 10^{-10}:\\
\;\;\;\;J \cdot \left(-2 \cdot \left(1 + 0.125 \cdot \left(\frac{U}{J} \cdot \frac{U}{J}\right)\right)\right)\\
\mathbf{elif}\;J \leq -1.45 \cdot 10^{-192}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.02 \cdot 10^{-197}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 1.75 \cdot 10^{-186}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.9 \cdot 10^{-152}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 5 \cdot 10^{-16}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 38.7 |
|---|
| Cost | 1248 |
|---|
\[\begin{array}{l}
\mathbf{if}\;J \leq -8.5 \cdot 10^{+184}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1.15 \cdot 10^{+162}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -7 \cdot 10^{-15}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -7.8 \cdot 10^{-191}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 4.4 \cdot 10^{-198}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 5.5 \cdot 10^{-187}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 3 \cdot 10^{-152}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 1.4 \cdot 10^{-18}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 38.8 |
|---|
| Cost | 1248 |
|---|
\[\begin{array}{l}
\mathbf{if}\;J \leq -2.1 \cdot 10^{+182}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1.15 \cdot 10^{+162}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -1.56 \cdot 10^{-12}:\\
\;\;\;\;-2 \cdot J + \frac{U}{J} \cdot \left(U \cdot -0.25\right)\\
\mathbf{elif}\;J \leq -4 \cdot 10^{-186}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 9 \cdot 10^{-199}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 7.8 \cdot 10^{-187}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 2.2 \cdot 10^{-152}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 3.3 \cdot 10^{-18}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 46.8 |
|---|
| Cost | 920 |
|---|
\[\begin{array}{l}
\mathbf{if}\;J \leq -3.3 \cdot 10^{-188}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 2.8 \cdot 10^{-198}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2.2 \cdot 10^{-186}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.6 \cdot 10^{-153}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 4.8 \cdot 10^{+96}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 2.4 \cdot 10^{+248}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 46.8 |
|---|
| Cost | 64 |
|---|
\[U
\]