Average Error: 33.9 → 1.0
Time: 54.8s
Precision: 64
Internal Precision: 1344
\[\frac{\left(\left(e^{x - 2 \cdot h} - e^{x + 2 \cdot h}\right) + 8 \cdot e^{x + h}\right) - 8 \cdot e^{x - h}}{12 \cdot h}\]
\[\begin{array}{l} \mathbf{if}\;x \le -38.57065323485066:\\ \;\;\;\;\frac{\left(e^{x - h \cdot 2} \cdot \frac{1}{12} + e^{x + h} \cdot \frac{2}{3}\right) - \left(\frac{1}{12} \cdot e^{x + h \cdot 2} + e^{x - h} \cdot \frac{2}{3}\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;1 + \log \left(e^{x + {x}^{2} \cdot \frac{1}{2}}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus h

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -38.57065323485066

    1. Initial program 0.1

      \[\frac{\left(\left(e^{x - 2 \cdot h} - e^{x + 2 \cdot h}\right) + 8 \cdot e^{x + h}\right) - 8 \cdot e^{x - h}}{12 \cdot h}\]
    2. Taylor expanded around inf 0.1

      \[\leadsto \color{blue}{\frac{\left(\frac{2}{3} \cdot e^{h + x} + \frac{1}{12} \cdot e^{x - 2 \cdot h}\right) - \left(\frac{2}{3} \cdot e^{x - h} + \frac{1}{12} \cdot e^{2 \cdot h + x}\right)}{h}}\]

    if -38.57065323485066 < x

    1. Initial program 59.4

      \[\frac{\left(\left(e^{x - 2 \cdot h} - e^{x + 2 \cdot h}\right) + 8 \cdot e^{x + h}\right) - 8 \cdot e^{x - h}}{12 \cdot h}\]
    2. Taylor expanded around 0 1.7

      \[\leadsto \color{blue}{1 + \left(\frac{1}{2} \cdot {x}^{2} + x\right)}\]
    3. Using strategy rm
    4. Applied add-log-exp1.7

      \[\leadsto 1 + \color{blue}{\log \left(e^{\frac{1}{2} \cdot {x}^{2} + x}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -38.57065323485066:\\ \;\;\;\;\frac{\left(e^{x - h \cdot 2} \cdot \frac{1}{12} + e^{x + h} \cdot \frac{2}{3}\right) - \left(\frac{1}{12} \cdot e^{x + h \cdot 2} + e^{x - h} \cdot \frac{2}{3}\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;1 + \log \left(e^{x + {x}^{2} \cdot \frac{1}{2}}\right)\\ \end{array}\]

Runtime

Time bar (total: 54.8s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (x h)
  :name "(exp(x - 2*h) - exp(x + 2*h) + 8*exp(x+h) - 8*exp(x-h))/(12*h)"
  (/ (- (+ (- (exp (- x (* 2 h))) (exp (+ x (* 2 h)))) (* 8 (exp (+ x h)))) (* 8 (exp (- x h)))) (* 12 h)))