?

Average Accuracy: 73.0% → 99.5%
Time: 13.9s
Precision: binary64
Cost: 27648

?

\[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
\[\left(2 \cdot \left(\ell \cdot J\right) + \left(0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right) + \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
(FPCore (J l K U)
 :precision binary64
 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
(FPCore (J l K U)
 :precision binary64
 (+
  (*
   (+
    (* 2.0 (* l J))
    (+
     (* 0.0003968253968253968 (* J (pow l 7.0)))
     (+
      (* 0.3333333333333333 (* J (pow l 3.0)))
      (* 0.016666666666666666 (* J (pow l 5.0))))))
   (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;
}
double code(double J, double l, double K, double U) {
	return (((2.0 * (l * J)) + ((0.0003968253968253968 * (J * pow(l, 7.0))) + ((0.3333333333333333 * (J * pow(l, 3.0))) + (0.016666666666666666 * (J * pow(l, 5.0)))))) * 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
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 = (((2.0d0 * (l * j)) + ((0.0003968253968253968d0 * (j * (l ** 7.0d0))) + ((0.3333333333333333d0 * (j * (l ** 3.0d0))) + (0.016666666666666666d0 * (j * (l ** 5.0d0)))))) * 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;
}
public static double code(double J, double l, double K, double U) {
	return (((2.0 * (l * J)) + ((0.0003968253968253968 * (J * Math.pow(l, 7.0))) + ((0.3333333333333333 * (J * Math.pow(l, 3.0))) + (0.016666666666666666 * (J * Math.pow(l, 5.0)))))) * 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
def code(J, l, K, U):
	return (((2.0 * (l * J)) + ((0.0003968253968253968 * (J * math.pow(l, 7.0))) + ((0.3333333333333333 * (J * math.pow(l, 3.0))) + (0.016666666666666666 * (J * math.pow(l, 5.0)))))) * 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 code(J, l, K, U)
	return Float64(Float64(Float64(Float64(2.0 * Float64(l * J)) + Float64(Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0))) + Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))) + Float64(0.016666666666666666 * Float64(J * (l ^ 5.0)))))) * 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
function tmp = code(J, l, K, U)
	tmp = (((2.0 * (l * J)) + ((0.0003968253968253968 * (J * (l ^ 7.0))) + ((0.3333333333333333 * (J * (l ^ 3.0))) + (0.016666666666666666 * (J * (l ^ 5.0)))))) * 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]
code[J_, l_, K_, U_] := N[(N[(N[(N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision] + N[(N[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.016666666666666666 * N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\left(2 \cdot \left(\ell \cdot J\right) + \left(0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right) + \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 73.0%

    \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  2. Taylor expanded in l around 0 99.5%

    \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right) + \left(0.0003968253968253968 \cdot \left({\ell}^{7} \cdot J\right) + \left(0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right) + 0.016666666666666666 \cdot \left({\ell}^{5} \cdot J\right)\right)\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
  3. Final simplification99.5%

    \[\leadsto \left(2 \cdot \left(\ell \cdot J\right) + \left(0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right) + \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]

Alternatives

Alternative 1
Accuracy99.5%
Cost27264
\[U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \left(0.0003968253968253968 \cdot {\ell}^{7} + \left(0.016666666666666666 \cdot {\ell}^{5} + 2 \cdot \ell\right)\right)\right)\right) \]
Alternative 2
Accuracy99.4%
Cost13824
\[U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \]
Alternative 3
Accuracy99.1%
Cost7104
\[U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J + J\right)\right) \]
Alternative 4
Accuracy99.1%
Cost7104
\[U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(2 \cdot \ell\right)\right) \]
Alternative 5
Accuracy86.2%
Cost960
\[U + \ell \cdot \left(J \cdot \left(0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right) + 2 \cdot J\right) \]
Alternative 6
Accuracy86.2%
Cost832
\[U + \ell \cdot \left(J \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right) \]
Alternative 7
Accuracy69.2%
Cost717
\[\begin{array}{l} \mathbf{if}\;J \leq -1.3 \cdot 10^{+244}:\\ \;\;\;\;U + -2\\ \mathbf{elif}\;J \leq -1.35 \cdot 10^{+185} \lor \neg \left(J \leq 7.4 \cdot 10^{+112}\right):\\ \;\;\;\;J \cdot \left(\ell + \ell\right)\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 8
Accuracy86.0%
Cost448
\[U + J \cdot \left(2 \cdot \ell\right) \]
Alternative 9
Accuracy71.1%
Cost64
\[U \]

Error

Reproduce?

herbie shell --seed 2023146 
(FPCore (J l K U)
  :name "Maksimov and Kolovsky, Equation (4)"
  :precision binary64
  (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))