?

Average Error: 17.3 → 0.5
Time: 24.2s
Precision: binary64
Cost: 13824

?

\[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
\[\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\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
 (+
  (* (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)) (* J (cos (* 0.5 K))))
  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 (((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)) * (J * cos((0.5 * K)))) + 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 = (((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)) * (j * cos((0.5d0 * k)))) + 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 (((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)) * (J * Math.cos((0.5 * K)))) + 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 (((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)) * (J * math.cos((0.5 * K)))) + 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(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)) * Float64(J * cos(Float64(0.5 * K)))) + 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 = (((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)) * (J * cos((0.5 * K)))) + 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[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right) + U

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 17.3

    \[\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 0.5

    \[\leadsto \left(J \cdot \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  3. Simplified0.5

    \[\leadsto \left(J \cdot \color{blue}{\left(2 \cdot \ell + 0.3333333333333333 \cdot {\ell}^{3}\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    Proof

    [Start]0.5

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

    rational.json-simplify-1 [=>]0.5

    \[ \left(J \cdot \color{blue}{\left(2 \cdot \ell + 0.3333333333333333 \cdot {\ell}^{3}\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  4. Taylor expanded in J around 0 0.5

    \[\leadsto \color{blue}{\cos \left(0.5 \cdot K\right) \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J\right)} + U \]
  5. Simplified0.5

    \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
    Proof

    [Start]0.5

    \[ \cos \left(0.5 \cdot K\right) \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot J\right) + U \]

    rational.json-simplify-43 [=>]0.5

    \[ \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right) \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]

    rational.json-simplify-2 [=>]0.5

    \[ \left(0.3333333333333333 \cdot {\ell}^{3} + \color{blue}{\ell \cdot 2}\right) \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
  6. Final simplification0.5

    \[\leadsto \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right) + U \]

Alternatives

Alternative 1
Error0.5
Cost13824
\[\left(J \cdot \left(2 \cdot \ell + 0.3333333333333333 \cdot {\ell}^{3}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
Alternative 2
Error0.7
Cost7104
\[2 \cdot \left(\ell \cdot \left(\cos \left(0.5 \cdot K\right) \cdot J\right)\right) + U \]
Alternative 3
Error0.7
Cost7104
\[J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell + \ell\right)\right) + U \]
Alternative 4
Error18.4
Cost848
\[\begin{array}{l} t_0 := 2 \cdot \left(\ell \cdot J\right)\\ \mathbf{if}\;U \leq -1.15 \cdot 10^{-97}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq -3.4 \cdot 10^{-124}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;U \leq -1.45 \cdot 10^{-244}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 8 \cdot 10^{-233}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 5
Error9.0
Cost448
\[\left(2 \cdot \ell\right) \cdot J + U \]
Alternative 6
Error18.7
Cost64
\[U \]

Error

Reproduce?

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