Average Error: 14.7 → 0.4
Time: 32.2s
Precision: 64
Internal Precision: 128
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{1}{(x \cdot x + -1)_*} \cdot -2\]

Error

Bits error versus x

Derivation

  1. Initial program 14.7

    \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
  2. Using strategy rm
  3. Applied flip--28.9

    \[\leadsto \frac{1}{x + 1} - \frac{1}{\color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}}}\]
  4. Applied associate-/r/28.9

    \[\leadsto \frac{1}{x + 1} - \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\]
  5. Applied flip-+14.7

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

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x - 1\right)} - \frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)\]
  7. Applied distribute-lft-out--14.0

    \[\leadsto \color{blue}{\frac{1}{x \cdot x - 1 \cdot 1} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)}\]
  8. Simplified14.0

    \[\leadsto \color{blue}{\frac{1}{(x \cdot x + -1)_*}} \cdot \left(\left(x - 1\right) - \left(x + 1\right)\right)\]
  9. Simplified0.4

    \[\leadsto \frac{1}{(x \cdot x + -1)_*} \cdot \color{blue}{-2}\]
  10. Final simplification0.4

    \[\leadsto \frac{1}{(x \cdot x + -1)_*} \cdot -2\]

Reproduce

herbie shell --seed 2019002 +o rules:numerics
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))

Details

Time bar (total: 31.7s)Debug log

sample43.0ms

Algorithm
intervals

simplify27.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

27.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 13.2b

localize26.0ms

Local error

Found 3 expressions with local error:

1.6b
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
0.0b
(/ 1 (+ x 1))
0.0b
(/ 1 (- x 1))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
3 → 103
Calls

3 calls. Slowest were:

13.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
2.0ms
(/ 1 (- x 1))
2.0ms
(/ 1 (+ x 1))

series61.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

40.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
11.0ms
(/ 1 (- x 1))
10.0ms
(/ 1 (+ x 1))

simplify20.6s

Counts
108 → 112
Calls

108 calls. Slowest were:

1.7s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
1.3s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))
1.2s
(fma (- (+ x 1)) (/ 1 (- (* x x) (* 1 1))) (* (+ x 1) (/ 1 (- (* x x) (* 1 1)))))

prune786.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.4b

localize9.0ms

Local error

Found 2 expressions with local error:

0.4b
(/ 1 (fma x x -1))
0.0b
(* (/ 1 (fma x x -1)) -2)

rewrite4.0ms

Algorithm
rewrite-expression-head
Counts
2 → 33
Calls

2 calls. Slowest were:

3.0ms
(* (/ 1 (fma x x -1)) -2)
1.0ms
(/ 1 (fma x x -1))

series40.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

24.0ms
(* (/ 1 (fma x x -1)) -2)
15.0ms
(/ 1 (fma x x -1))

simplify2.2s

Counts
13 → 39
Calls

13 calls. Slowest were:

1.0s
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
888.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
130.0ms
(+ (* 2 (pow x 2)) (+ (* 2 (pow x 4)) 2))

prune241.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.4b

localize11.0ms

Local error

Found 4 expressions with local error:

13.5b
(cbrt (/ 1 (fma x x -1)))
13.5b
(cbrt (/ 1 (fma x x -1)))
13.5b
(cbrt (/ 1 (fma x x -1)))
0.4b
(/ 1 (fma x x -1))

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
4 → 63
Calls

4 calls. Slowest were:

1.0ms
(/ 1 (fma x x -1))
1.0ms
(cbrt (/ 1 (fma x x -1)))
1.0ms
(cbrt (/ 1 (fma x x -1)))

series415.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

164.0ms
(cbrt (/ 1 (fma x x -1)))
123.0ms
(cbrt (/ 1 (fma x x -1)))
104.0ms
(cbrt (/ 1 (fma x x -1)))
23.0ms
(/ 1 (fma x x -1))

simplify1.2s

Counts
31 → 75
Calls

31 calls. Slowest were:

209.0ms
(+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (+ (* 2/9 (* (pow x 4) (pow -1 1/3))) (pow -1 1/3)))
137.0ms
(+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (+ (* 2/9 (* (pow x 4) (pow -1 1/3))) (pow -1 1/3)))
137.0ms
(+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (+ (* 2/9 (* (pow x 4) (pow -1 1/3))) (pow -1 1/3)))

prune727.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.3b

localize15.0ms

Local error

Found 4 expressions with local error:

14.0b
(cbrt (* (/ 1 (fma x x -1)) -2))
14.0b
(cbrt (* (/ 1 (fma x x -1)) -2))
14.0b
(cbrt (* (/ 1 (fma x x -1)) -2))
0.4b
(/ 1 (fma x x -1))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

6.0ms
(cbrt (* (/ 1 (fma x x -1)) -2))
4.0ms
(cbrt (* (/ 1 (fma x x -1)) -2))
3.0ms
(cbrt (* (/ 1 (fma x x -1)) -2))

series553.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

187.0ms
(cbrt (* (/ 1 (fma x x -1)) -2))
171.0ms
(cbrt (* (/ 1 (fma x x -1)) -2))
170.0ms
(cbrt (* (/ 1 (fma x x -1)) -2))
25.0ms
(/ 1 (fma x x -1))

simplify1.8s

Counts
22 → 66
Calls

22 calls. Slowest were:

256.0ms
(+ (* (cbrt -2) (pow -1 1/3)) (+ (* 1/3 (* (* (pow x 2) (cbrt -2)) (pow -1 1/3))) (* 2/9 (* (* (pow x 4) (cbrt -2)) (pow -1 1/3)))))
251.0ms
(+ (* (cbrt -2) (pow -1 1/3)) (+ (* 1/3 (* (* (pow x 2) (cbrt -2)) (pow -1 1/3))) (* 2/9 (* (* (pow x 4) (cbrt -2)) (pow -1 1/3)))))
198.0ms
(+ (* (pow (/ 1 (pow x 2)) 1/3) (cbrt -2)) (+ (* 1/3 (* (pow (/ 1 (pow x 8)) 1/3) (cbrt -2))) (* 2/9 (* (pow (/ 1 (pow x 14)) 1/3) (cbrt -2)))))

prune740.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.3b

regimes51.0ms

Accuracy

0% (0.1b remaining)

Error of 0.4b against oracle of 0.4b and baseline of 0.4b

bsearch2.0ms

end0.0ms

sample2.1s

Algorithm
intervals