?

Average Accuracy: 37.8% → 52.6%
Time: 8.8s
Precision: binary64
Cost: 7104

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 30.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 45.2%

    \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
  3. Simplified45.2%

    \[\leadsto \color{blue}{\left(\ell \cdot \left(2 \cdot J\right)\right)} \cdot \cos \left(\frac{K}{2}\right) + U \]
  4. Applied egg-rr29.3%

    \[\leadsto \color{blue}{\log \left(1 + \mathsf{expm1}\left(\ell \cdot \left(\left(J + J\right) \cdot \cos \left(K \cdot 0.5\right)\right)\right)\right)} + U \]
  5. Applied egg-rr45.3%

    \[\leadsto \color{blue}{\left(J + J\right) \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \ell\right)} + U \]
  6. Final simplification45.3%

    \[\leadsto \left(J + J\right) \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \ell\right) + U \]

Alternatives

Alternative 1
Accuracy52.6%
Cost7104
\[U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right) \]
Alternative 2
Accuracy45.7%
Cost448
\[U + \left(J + J\right) \cdot \ell \]
Alternative 3
Accuracy38.0%
Cost64
\[U \]

Error

Reproduce?

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