Average Error: 17.5 → 8.6
Time: 41.3s
Precision: 64
Internal Precision: 128
\[\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} \mathbf{if}\;U \le 1.6797080257385875 \cdot 10^{+166} \lor \neg \left(U \le 9.310461497300211 \cdot 10^{+222}\right):\\ \;\;\;\;\left(\left(J \cdot -2\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1^2 + \left(\frac{\frac{U}{2}}{J \cdot \cos \left(\frac{K}{2}\right)}\right)^2}^*\\ \mathbf{else}:\\ \;\;\;\;-U\\ \end{array}\]

Error

Bits error versus J

Bits error versus K

Bits error versus U

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if U < 1.6797080257385875e+166 or 9.310461497300211e+222 < U

    1. Initial program 16.7

      \[\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}}\]
    2. Initial simplification7.2

      \[\leadsto \sqrt{1^2 + \left(\frac{\frac{\frac{U}{2}}{J}}{\cos \left(\frac{K}{2}\right)}\right)^2}^* \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right)\]
    3. Using strategy rm
    4. Applied associate-/l/7.1

      \[\leadsto \sqrt{1^2 + \color{blue}{\left(\frac{\frac{U}{2}}{\cos \left(\frac{K}{2}\right) \cdot J}\right)}^2}^* \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right)\]

    if 1.6797080257385875e+166 < U < 9.310461497300211e+222

    1. Initial program 33.9

      \[\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}}\]
    2. Initial simplification18.8

      \[\leadsto \sqrt{1^2 + \left(\frac{\frac{\frac{U}{2}}{J}}{\cos \left(\frac{K}{2}\right)}\right)^2}^* \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right)\]
    3. Using strategy rm
    4. Applied associate-/l/18.8

      \[\leadsto \sqrt{1^2 + \color{blue}{\left(\frac{\frac{U}{2}}{\cos \left(\frac{K}{2}\right) \cdot J}\right)}^2}^* \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right)\]
    5. Taylor expanded around inf 38.7

      \[\leadsto \color{blue}{-1 \cdot U}\]
    6. Simplified38.7

      \[\leadsto \color{blue}{-U}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;U \le 1.6797080257385875 \cdot 10^{+166} \lor \neg \left(U \le 9.310461497300211 \cdot 10^{+222}\right):\\ \;\;\;\;\left(\left(J \cdot -2\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1^2 + \left(\frac{\frac{U}{2}}{J \cdot \cos \left(\frac{K}{2}\right)}\right)^2}^*\\ \mathbf{else}:\\ \;\;\;\;-U\\ \end{array}\]

Runtime

Time bar (total: 41.3s)Debug logProfile

herbie shell --seed 2018348 +o rules:numerics
(FPCore (J K U)
  :name "Maksimov and Kolovsky, Equation (3)"
  (* (* (* -2 J) (cos (/ K 2))) (sqrt (+ 1 (pow (/ U (* (* 2 J) (cos (/ K 2)))) 2)))))