Average Error: 13.9 → 0.3
Time: 22.6s
Precision: 64
Internal Precision: 128
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\frac{1}{-1 + x \cdot x} \cdot -2\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 13.9

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

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

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

    \[\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/13.9

    \[\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--13.3

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

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

    \[\leadsto \frac{1}{-1 + x \cdot x} \cdot \color{blue}{-2}\]
  10. Final simplification0.3

    \[\leadsto \frac{1}{-1 + x \cdot x} \cdot -2\]

Reproduce

herbie shell --seed 2018360 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))

Details

Time bar (total: 17.7s)Debug log

start103.0ms

Algorithm
intervals

setup35.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 12.5b

localize59.0ms

Local error

Found 3 expressions with local error:

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

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
3 → 55
Calls

3 calls. Slowest were:

10.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
2.0ms
(/ 1 (- x 1))
1.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))

simplify1.1s

Counts
32 → 64
Calls

32 calls. Slowest were:

237.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
223.0ms
(- (* 1 (- x 1)) (* (+ x 1) 1))
207.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))

prune610.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 3 expressions with local error:

0.3b
(/ 1 (+ -1 (* x x)))
0.0b
(* (/ 1 (+ -1 (* x x))) -2)
0.0b
(+ -1 (* x x))

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
3 → 43
Calls

3 calls. Slowest were:

5.0ms
(* (/ 1 (+ -1 (* x x))) -2)
2.0ms
(/ 1 (+ -1 (* x x)))
1.0ms
(+ -1 (* x x))

series57.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

23.0ms
(/ 1 (+ -1 (* x x)))
18.0ms
(+ -1 (* x x))
15.0ms
(* (/ 1 (+ -1 (* x x))) -2)

simplify1.4s

Counts
20 → 52
Calls

20 calls. Slowest were:

281.0ms
(+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))
266.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
265.0ms
(/ 1 (- (* -1 -1) (* (* x x) (* x x))))

prune491.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

14.9b
(cbrt (+ -1 (* x x)))
14.9b
(cbrt (+ -1 (* x x)))
14.9b
(cbrt (+ -1 (* x x)))
0.3b
(/ 1 (* (* (cbrt (+ -1 (* x x))) (cbrt (+ -1 (* x x)))) (cbrt (+ -1 (* x x)))))

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
4 → 92
Calls

4 calls. Slowest were:

18.0ms
(/ 1 (* (* (cbrt (+ -1 (* x x))) (cbrt (+ -1 (* x x)))) (cbrt (+ -1 (* x x)))))
1.0ms
(cbrt (+ -1 (* x x)))
1.0ms
(cbrt (+ -1 (* x x)))

series362.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

125.0ms
(cbrt (+ -1 (* x x)))
111.0ms
(cbrt (+ -1 (* x x)))
106.0ms
(cbrt (+ -1 (* x x)))
18.0ms
(/ 1 (* (* (cbrt (+ -1 (* x x))) (cbrt (+ -1 (* x x)))) (cbrt (+ -1 (* x x)))))

simplify7.9s

Counts
66 → 104
Calls

66 calls. Slowest were:

352.0ms
(* (* (cbrt (- -1 (* x x))) (cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x)))))) (cbrt (- -1 (* x x))))
350.0ms
(* (cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))) (cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))))
335.0ms
(* (* (cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))) (cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x)))))) (cbrt (- -1 (* x x))))

prune1.8s

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.0b

localize22.0ms

Local error

Found 4 expressions with local error:

15.1b
(cbrt (* (/ 1 (+ -1 (* x x))) -2))
15.1b
(cbrt (* (/ 1 (+ -1 (* x x))) -2))
15.1b
(cbrt (* (/ 1 (+ -1 (* x x))) -2))
0.3b
(/ 1 (+ -1 (* x x)))

rewrite7.0ms

Algorithm
rewrite-expression-head
Counts
4 → 48
Calls

4 calls. Slowest were:

2.0ms
(cbrt (* (/ 1 (+ -1 (* x x))) -2))
2.0ms
(cbrt (* (/ 1 (+ -1 (* x x))) -2))
2.0ms
(cbrt (* (/ 1 (+ -1 (* x x))) -2))

series523.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

185.0ms
(cbrt (* (/ 1 (+ -1 (* x x))) -2))
165.0ms
(cbrt (* (/ 1 (+ -1 (* x x))) -2))
152.0ms
(cbrt (* (/ 1 (+ -1 (* x x))) -2))
21.0ms
(/ 1 (+ -1 (* x x)))

simplify2.1s

Counts
24 → 60
Calls

24 calls. Slowest were:

409.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)))))
361.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)))))
313.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)))))

prune903.0ms

Pruning

5 alts after pruning (2 fresh and 3 done)

Merged error: 0.0b

regimes33.0ms

Accuracy

0% (0.3b remaining)

Error of 0.3b against oracle of 0.0b and baseline of 0.3b

bsearch1.0ms