Maksimov and Kolovsky, Equation (4)

Percentage Accurate: 86.5% → 99.5%
Time: 10.9s
Alternatives: 13
Speedup: TODO×

Specification

?
\[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]

Your Program's Arguments

Results

Enter valid numbers for all inputs

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Alternative 1?

\[\begin{array}{l} t_0 := e^{\ell} - e^{-\ell}\\ \mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0\right):\\ \;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))

    1. Initial program 100.0%

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

    if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0

    1. Initial program 71.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.9%

      \[\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. Taylor expanded in J around 0 99.9%

      \[\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 \]
    4. Step-by-step derivation
      1. associate-*r*99.9%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J} + U \]
      2. *-commutative99.9%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J + U \]
      3. fma-def99.9%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative99.9%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \color{blue}{\ell \cdot 2}\right)\right) \cdot J + U \]
      5. *-commutative99.9%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative99.9%

        \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      7. *-commutative99.9%

        \[\leadsto J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \color{blue}{\left(0.5 \cdot K\right)}\right) + U \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
    6. Step-by-step derivation
      1. fma-udef99.9%

        \[\leadsto J \cdot \left(\color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Applied egg-rr99.9%

      \[\leadsto J \cdot \left(\color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
  3. Recombined 2 regimes into one program.
  4. Final simplification100.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{\ell} - e^{-\ell} \leq -\infty \lor \neg \left(e^{\ell} - e^{-\ell} \leq 0\right):\\ \;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right) + U\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \end{array} \]

Alternative 2?

\[\begin{array}{l} \mathbf{if}\;\ell \leq -7.8 \cdot 10^{+121} \lor \neg \left(\ell \leq -1 \cdot 10^{+16} \lor \neg \left(\ell \leq 0.048\right) \land \ell \leq 5.5 \cdot 10^{+102}\right):\\ \;\;\;\;U + J \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if l < -7.79999999999999967e121 or -1e16 < l < 0.048000000000000001 or 5.49999999999999981e102 < l

    1. Initial program 83.4%

      \[\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.0%

      \[\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. Taylor expanded in J around 0 99.0%

      \[\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 \]
    4. Step-by-step derivation
      1. associate-*r*99.0%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J} + U \]
      2. *-commutative99.0%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J + U \]
      3. fma-def99.0%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative99.0%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \color{blue}{\ell \cdot 2}\right)\right) \cdot J + U \]
      5. *-commutative99.0%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative99.0%

        \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      7. *-commutative99.0%

        \[\leadsto J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \color{blue}{\left(0.5 \cdot K\right)}\right) + U \]
    5. Simplified99.0%

      \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
    6. Step-by-step derivation
      1. fma-udef99.0%

        \[\leadsto J \cdot \left(\color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Applied egg-rr99.0%

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

    if -7.79999999999999967e121 < l < -1e16 or 0.048000000000000001 < l < 5.49999999999999981e102

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7.8 \cdot 10^{+121} \lor \neg \left(\ell \leq -1 \cdot 10^{+16} \lor \neg \left(\ell \leq 0.048\right) \land \ell \leq 5.5 \cdot 10^{+102}\right):\\ \;\;\;\;U + J \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \end{array} \]

Alternative 3?

\[\begin{array}{l} t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ t_1 := U + J \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{if}\;\ell \leq -2.95 \cdot 10^{+94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq -160:\\ \;\;\;\;U + \left(-0.125 \cdot \left(K \cdot K\right) + 1\right) \cdot t_0\\ \mathbf{elif}\;\ell \leq 0.175 \lor \neg \left(\ell \leq 5.6 \cdot 10^{+102}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;U + t_0\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if l < -2.94999999999999995e94 or -160 < l < 0.17499999999999999 or 5.60000000000000037e102 < l

    1. Initial program 83.5%

      \[\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.9%

      \[\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. Taylor expanded in J around 0 99.9%

      \[\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 \]
    4. Step-by-step derivation
      1. associate-*r*99.9%

        \[\leadsto \color{blue}{\left(\cos \left(0.5 \cdot K\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J} + U \]
      2. *-commutative99.9%

        \[\leadsto \left(\cos \color{blue}{\left(K \cdot 0.5\right)} \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right) \cdot J + U \]
      3. fma-def99.9%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative99.9%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \color{blue}{\ell \cdot 2}\right)\right) \cdot J + U \]
      5. *-commutative99.9%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative99.9%

        \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      7. *-commutative99.9%

        \[\leadsto J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \color{blue}{\left(0.5 \cdot K\right)}\right) + U \]
    5. Simplified99.9%

      \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
    6. Step-by-step derivation
      1. fma-udef99.9%

        \[\leadsto J \cdot \left(\color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Applied egg-rr99.9%

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

    if -2.94999999999999995e94 < l < -160

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(\left(e^{\ell} - e^{-\ell}\right) \cdot J + -0.125 \cdot \left({K}^{2} \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)\right)\right)} + U \]
    3. Step-by-step derivation
      1. associate-*r*0.0%

        \[\leadsto \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J + \color{blue}{\left(-0.125 \cdot {K}^{2}\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)}\right) + U \]
      2. distribute-rgt1-in70.8%

        \[\leadsto \color{blue}{\left(-0.125 \cdot {K}^{2} + 1\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]
      3. unpow270.8%

        \[\leadsto \left(-0.125 \cdot \color{blue}{\left(K \cdot K\right)} + 1\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right) + U \]
    4. Simplified70.8%

      \[\leadsto \color{blue}{\left(-0.125 \cdot \left(K \cdot K\right) + 1\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)} + U \]

    if 0.17499999999999999 < l < 5.60000000000000037e102

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]
  3. Recombined 3 regimes into one program.
  4. Final simplification96.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.95 \cdot 10^{+94}:\\ \;\;\;\;U + J \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{elif}\;\ell \leq -160:\\ \;\;\;\;U + \left(-0.125 \cdot \left(K \cdot K\right) + 1\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)\\ \mathbf{elif}\;\ell \leq 0.175 \lor \neg \left(\ell \leq 5.6 \cdot 10^{+102}\right):\\ \;\;\;\;U + J \cdot \left(\left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \end{array} \]

Alternative 4?

\[\begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.11:\\ \;\;\;\;U + J \cdot \left(\left(\ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (cos.f64 (/.f64 K 2)) < 0.110000000000000001

    1. Initial program 79.8%

      \[\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 89.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. Taylor expanded in J around 0 89.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 \]
    4. Step-by-step derivation
      1. associate-*r*89.5%

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

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

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative89.5%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \color{blue}{\ell \cdot 2}\right)\right) \cdot J + U \]
      5. *-commutative89.5%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative89.5%

        \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      7. *-commutative89.5%

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

      \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
    6. Taylor expanded in l around 0 68.7%

      \[\leadsto J \cdot \left(\color{blue}{\left(2 \cdot \ell\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Step-by-step derivation
      1. *-commutative68.7%

        \[\leadsto J \cdot \left(\color{blue}{\left(\ell \cdot 2\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    8. Simplified68.7%

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

    if 0.110000000000000001 < (cos.f64 (/.f64 K 2))

    1. Initial program 89.2%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]
    3. Taylor expanded in l around 0 79.8%

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)} \cdot J + U \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.11:\\ \;\;\;\;U + J \cdot \left(\left(\ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\ \end{array} \]

Alternative 5?

\[\begin{array}{l} \mathbf{if}\;\ell \leq -1 \cdot 10^{+16} \lor \neg \left(\ell \leq 0.0058\right):\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if l < -1e16 or 0.0058 < l

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]

    if -1e16 < l < 0.0058

    1. Initial program 71.5%

      \[\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 98.3%

      \[\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. Taylor expanded in l around 0 98.0%

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. associate-*r*98.0%

        \[\leadsto \color{blue}{\left(2 \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \left(\ell \cdot J\right)} + U \]
      2. *-commutative98.0%

        \[\leadsto \left(2 \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \color{blue}{\left(J \cdot \ell\right)} + U \]
      3. associate-*r*98.0%

        \[\leadsto \color{blue}{\left(\left(2 \cdot \cos \left(0.5 \cdot K\right)\right) \cdot J\right) \cdot \ell} + U \]
      4. *-commutative98.0%

        \[\leadsto \left(\left(2 \cdot \cos \color{blue}{\left(K \cdot 0.5\right)}\right) \cdot J\right) \cdot \ell + U \]
      5. *-commutative98.0%

        \[\leadsto \left(\color{blue}{\left(\cos \left(K \cdot 0.5\right) \cdot 2\right)} \cdot J\right) \cdot \ell + U \]
      6. associate-*r*98.0%

        \[\leadsto \color{blue}{\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot J\right)\right)} \cdot \ell + U \]
      7. *-commutative98.0%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot 2\right)}\right) \cdot \ell + U \]
      8. *-commutative98.0%

        \[\leadsto \color{blue}{\ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)} + U \]
      9. *-commutative98.0%

        \[\leadsto \ell \cdot \color{blue}{\left(\left(J \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      10. *-commutative98.0%

        \[\leadsto \ell \cdot \left(\color{blue}{\left(2 \cdot J\right)} \cdot \cos \left(K \cdot 0.5\right)\right) + U \]
      11. *-commutative98.0%

        \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \color{blue}{\left(0.5 \cdot K\right)}\right) + U \]
    5. Simplified98.0%

      \[\leadsto \color{blue}{\ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1 \cdot 10^{+16} \lor \neg \left(\ell \leq 0.0058\right):\\ \;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\ \mathbf{else}:\\ \;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\ \end{array} \]

Alternative 6?

\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.45 \cdot 10^{+16} \lor \neg \left(\ell \leq 66000\right):\\ \;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\left(\ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if l < -1.45e16 or 66000 < l

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]
    3. Taylor expanded in l around 0 56.6%

      \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right) + 0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)\right)} + U \]
    4. Taylor expanded in l around inf 56.6%

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

    if -1.45e16 < l < 66000

    1. Initial program 71.5%

      \[\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 98.3%

      \[\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. Taylor expanded in J around 0 98.3%

      \[\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 \]
    4. Step-by-step derivation
      1. associate-*r*98.3%

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

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

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, 2 \cdot \ell\right)}\right) \cdot J + U \]
      4. *-commutative98.3%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \color{blue}{\ell \cdot 2}\right)\right) \cdot J + U \]
      5. *-commutative98.3%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} \cdot J + U \]
      6. *-commutative98.3%

        \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      7. *-commutative98.3%

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

      \[\leadsto \color{blue}{J \cdot \left(\mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right) \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
    6. Taylor expanded in l around 0 98.0%

      \[\leadsto J \cdot \left(\color{blue}{\left(2 \cdot \ell\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    7. Step-by-step derivation
      1. *-commutative98.0%

        \[\leadsto J \cdot \left(\color{blue}{\left(\ell \cdot 2\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
    8. Simplified98.0%

      \[\leadsto J \cdot \left(\color{blue}{\left(\ell \cdot 2\right)} \cdot \cos \left(0.5 \cdot K\right)\right) + U \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.45 \cdot 10^{+16} \lor \neg \left(\ell \leq 66000\right):\\ \;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;U + J \cdot \left(\left(\ell \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\ \end{array} \]

Alternative 7?

\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.4 \cdot 10^{+16} \lor \neg \left(\ell \leq 120000\right):\\ \;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if l < -1.4e16 or 1.2e5 < l

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]
    3. Taylor expanded in l around 0 56.6%

      \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right) + 0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)\right)} + U \]
    4. Taylor expanded in l around inf 56.6%

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

    if -1.4e16 < l < 1.2e5

    1. Initial program 71.5%

      \[\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 98.3%

      \[\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. Taylor expanded in l around 0 98.0%

      \[\leadsto \color{blue}{2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)} + U \]
    4. Step-by-step derivation
      1. associate-*r*98.0%

        \[\leadsto \color{blue}{\left(2 \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \left(\ell \cdot J\right)} + U \]
      2. *-commutative98.0%

        \[\leadsto \left(2 \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \color{blue}{\left(J \cdot \ell\right)} + U \]
      3. associate-*r*98.0%

        \[\leadsto \color{blue}{\left(\left(2 \cdot \cos \left(0.5 \cdot K\right)\right) \cdot J\right) \cdot \ell} + U \]
      4. *-commutative98.0%

        \[\leadsto \left(\left(2 \cdot \cos \color{blue}{\left(K \cdot 0.5\right)}\right) \cdot J\right) \cdot \ell + U \]
      5. *-commutative98.0%

        \[\leadsto \left(\color{blue}{\left(\cos \left(K \cdot 0.5\right) \cdot 2\right)} \cdot J\right) \cdot \ell + U \]
      6. associate-*r*98.0%

        \[\leadsto \color{blue}{\left(\cos \left(K \cdot 0.5\right) \cdot \left(2 \cdot J\right)\right)} \cdot \ell + U \]
      7. *-commutative98.0%

        \[\leadsto \left(\cos \left(K \cdot 0.5\right) \cdot \color{blue}{\left(J \cdot 2\right)}\right) \cdot \ell + U \]
      8. *-commutative98.0%

        \[\leadsto \color{blue}{\ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)} + U \]
      9. *-commutative98.0%

        \[\leadsto \ell \cdot \color{blue}{\left(\left(J \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)} + U \]
      10. *-commutative98.0%

        \[\leadsto \ell \cdot \left(\color{blue}{\left(2 \cdot J\right)} \cdot \cos \left(K \cdot 0.5\right)\right) + U \]
      11. *-commutative98.0%

        \[\leadsto \ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \color{blue}{\left(0.5 \cdot K\right)}\right) + U \]
    5. Simplified98.0%

      \[\leadsto \color{blue}{\ell \cdot \left(\left(2 \cdot J\right) \cdot \cos \left(0.5 \cdot K\right)\right)} + U \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.4 \cdot 10^{+16} \lor \neg \left(\ell \leq 120000\right):\\ \;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\ \end{array} \]

Alternative 8?

\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.16 \cdot 10^{+16} \lor \neg \left(\ell \leq 2.4\right):\\ \;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if l < -1.16e16 or 2.39999999999999991 < l

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]
    3. Taylor expanded in l around 0 56.6%

      \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right) + 0.3333333333333333 \cdot \left({\ell}^{3} \cdot J\right)\right)} + U \]
    4. Taylor expanded in l around inf 56.6%

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

    if -1.16e16 < l < 2.39999999999999991

    1. Initial program 71.5%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]
    3. Taylor expanded in l around 0 80.2%

      \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative80.2%

        \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot 2} + U \]
    5. Simplified80.2%

      \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot 2} + U \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.16 \cdot 10^{+16} \lor \neg \left(\ell \leq 2.4\right):\\ \;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\ \mathbf{else}:\\ \;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\ \end{array} \]

Alternative 9?

\[\begin{array}{l} t_0 := U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{if}\;\ell \leq -420:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq 125000:\\ \;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\ \mathbf{elif}\;\ell \leq 3.4 \cdot 10^{+124}:\\ \;\;\;\;U \cdot U\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if l < -420 or 3.4e124 < l

    1. Initial program 100.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 29.9%

      \[\leadsto \left(J \cdot \color{blue}{\left(2 \cdot \ell\right)}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    3. Taylor expanded in K around 0 13.8%

      \[\leadsto \color{blue}{\left(2 \cdot \left(\ell \cdot J\right) + -0.25 \cdot \left({K}^{2} \cdot \left(\ell \cdot J\right)\right)\right)} + U \]
    4. Step-by-step derivation
      1. +-commutative13.8%

        \[\leadsto \color{blue}{\left(-0.25 \cdot \left({K}^{2} \cdot \left(\ell \cdot J\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)} + U \]
      2. associate-*r*13.8%

        \[\leadsto \left(\color{blue}{\left(-0.25 \cdot {K}^{2}\right) \cdot \left(\ell \cdot J\right)} + 2 \cdot \left(\ell \cdot J\right)\right) + U \]
      3. distribute-rgt-out36.0%

        \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot \left(-0.25 \cdot {K}^{2} + 2\right)} + U \]
      4. *-commutative36.0%

        \[\leadsto \left(\ell \cdot J\right) \cdot \left(\color{blue}{{K}^{2} \cdot -0.25} + 2\right) + U \]
      5. unpow236.0%

        \[\leadsto \left(\ell \cdot J\right) \cdot \left(\color{blue}{\left(K \cdot K\right)} \cdot -0.25 + 2\right) + U \]
    5. Simplified36.0%

      \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot \left(\left(K \cdot K\right) \cdot -0.25 + 2\right)} + U \]

    if -420 < l < 125000

    1. Initial program 71.2%

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

      \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]
    3. Taylor expanded in l around 0 80.8%

      \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right)} + U \]
    4. Step-by-step derivation
      1. *-commutative80.8%

        \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot 2} + U \]
    5. Simplified80.8%

      \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot 2} + U \]

    if 125000 < l < 3.4e124

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr1.6%

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

      \[\leadsto \color{blue}{U \cdot U} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification56.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -420:\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \mathbf{elif}\;\ell \leq 125000:\\ \;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\ \mathbf{elif}\;\ell \leq 3.4 \cdot 10^{+124}:\\ \;\;\;\;U \cdot U\\ \mathbf{else}:\\ \;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\ \end{array} \]

Alternative 10?

\[\begin{array}{l} \mathbf{if}\;\ell \leq -3.8 \cdot 10^{+104}:\\ \;\;\;\;U \cdot U\\ \mathbf{elif}\;\ell \leq 190000:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;U \cdot U\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if l < -3.79999999999999969e104 or 1.9e5 < l

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr2.1%

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

      \[\leadsto \color{blue}{U \cdot U} \]

    if -3.79999999999999969e104 < l < 1.9e5

    1. Initial program 76.2%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr36.4%

      \[\leadsto \left(J \cdot \color{blue}{-8}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    3. Taylor expanded in J around 0 57.3%

      \[\leadsto \color{blue}{U} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification40.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.8 \cdot 10^{+104}:\\ \;\;\;\;U \cdot U\\ \mathbf{elif}\;\ell \leq 190000:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;U \cdot U\\ \end{array} \]

Alternative 11?

\[\begin{array}{l} \mathbf{if}\;\ell \leq -4.2 \cdot 10^{+20}:\\ \;\;\;\;U \cdot \left(U \cdot -134217728\right)\\ \mathbf{elif}\;\ell \leq 190000:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;U \cdot U\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if l < -4.2e20

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr3.1%

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

      \[\leadsto \color{blue}{\left(U \cdot -134217728\right) \cdot U} \]

    if -4.2e20 < l < 1.9e5

    1. Initial program 72.1%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr42.0%

      \[\leadsto \left(J \cdot \color{blue}{-8}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    3. Taylor expanded in J around 0 66.6%

      \[\leadsto \color{blue}{U} \]

    if 1.9e5 < l

    1. Initial program 100.0%

      \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
    2. Applied egg-rr1.6%

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

      \[\leadsto \color{blue}{U \cdot U} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification42.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -4.2 \cdot 10^{+20}:\\ \;\;\;\;U \cdot \left(U \cdot -134217728\right)\\ \mathbf{elif}\;\ell \leq 190000:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;U \cdot U\\ \end{array} \]

Alternative 12?

\[U + 2 \cdot \left(\ell \cdot J\right) \]
Derivation
  1. Initial program 86.5%

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

    \[\leadsto \color{blue}{\left(e^{\ell} - e^{-\ell}\right) \cdot J} + U \]
  3. Taylor expanded in l around 0 49.7%

    \[\leadsto \color{blue}{2 \cdot \left(\ell \cdot J\right)} + U \]
  4. Step-by-step derivation
    1. *-commutative49.7%

      \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot 2} + U \]
  5. Simplified49.7%

    \[\leadsto \color{blue}{\left(\ell \cdot J\right) \cdot 2} + U \]
  6. Final simplification49.7%

    \[\leadsto U + 2 \cdot \left(\ell \cdot J\right) \]

Alternative 13?

\[U \]
Derivation
  1. Initial program 86.5%

    \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  2. Applied egg-rr21.5%

    \[\leadsto \left(J \cdot \color{blue}{-8}\right) \cdot \cos \left(\frac{K}{2}\right) + U \]
  3. Taylor expanded in J around 0 33.3%

    \[\leadsto \color{blue}{U} \]
  4. Final simplification33.3%

    \[\leadsto U \]

Reproduce

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