Average Error: 9.4 → 0.2
Time: 47.2s
Precision: 64
Internal Precision: 128
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -107.3467989013554:\\ \;\;\;\;\frac{2}{{x}^{3}} + \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right)\\ \mathbf{elif}\;x \le 104.27982465385276:\\ \;\;\;\;\left(\frac{1}{x \cdot x - 1} \cdot \left(x - 1\right) - \frac{2}{x}\right) + \frac{1}{x - 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + {x}^{-2} \cdot \frac{2}{x}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original9.4
Target0.3
Herbie0.2
\[\frac{2}{x \cdot \left(x \cdot x - 1\right)}\]

Derivation

  1. Split input into 3 regimes
  2. if x < -107.3467989013554

    1. Initial program 19.1

      \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    2. Using strategy rm
    3. Applied flip-+50.8

      \[\leadsto \left(\frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    4. Applied associate-/r/53.1

      \[\leadsto \left(\color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    5. Taylor expanded around -inf 0.5

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{x}^{7}} + \left(2 \cdot \frac{1}{{x}^{3}} + 2 \cdot \frac{1}{{x}^{5}}\right)}\]
    6. Simplified0.1

      \[\leadsto \color{blue}{\left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \frac{\frac{2}{x}}{x \cdot x}}\]
    7. Taylor expanded around inf 0.5

      \[\leadsto \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \color{blue}{\frac{2}{{x}^{3}}}\]

    if -107.3467989013554 < x < 104.27982465385276

    1. Initial program 0.0

      \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    2. Using strategy rm
    3. Applied flip-+0.0

      \[\leadsto \left(\frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    4. Applied associate-/r/0.1

      \[\leadsto \left(\color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{2}{x}\right) + \frac{1}{x - 1}\]

    if 104.27982465385276 < x

    1. Initial program 18.7

      \[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    2. Using strategy rm
    3. Applied flip-+49.9

      \[\leadsto \left(\frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x - 1}}} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    4. Applied associate-/r/52.7

      \[\leadsto \left(\color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
    5. Taylor expanded around -inf 0.5

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{x}^{7}} + \left(2 \cdot \frac{1}{{x}^{3}} + 2 \cdot \frac{1}{{x}^{5}}\right)}\]
    6. Simplified0.1

      \[\leadsto \color{blue}{\left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \frac{\frac{2}{x}}{x \cdot x}}\]
    7. Using strategy rm
    8. Applied div-inv0.1

      \[\leadsto \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \color{blue}{\frac{2}{x} \cdot \frac{1}{x \cdot x}}\]
    9. Using strategy rm
    10. Applied pow20.1

      \[\leadsto \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \frac{2}{x} \cdot \frac{1}{\color{blue}{{x}^{2}}}\]
    11. Applied pow-flip0.1

      \[\leadsto \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \frac{2}{x} \cdot \color{blue}{{x}^{\left(-2\right)}}\]
    12. Simplified0.1

      \[\leadsto \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \frac{2}{x} \cdot {x}^{\color{blue}{-2}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -107.3467989013554:\\ \;\;\;\;\frac{2}{{x}^{3}} + \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right)\\ \mathbf{elif}\;x \le 104.27982465385276:\\ \;\;\;\;\left(\frac{1}{x \cdot x - 1} \cdot \left(x - 1\right) - \frac{2}{x}\right) + \frac{1}{x - 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + {x}^{-2} \cdot \frac{2}{x}\\ \end{array}\]

Runtime

Time bar (total: 47.2s)Debug logProfile

herbie shell --seed 2018273 
(FPCore (x)
  :name "3frac (problem 3.3.3)"

  :herbie-target
  (/ 2 (* x (- (* x x) 1)))

  (+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))))