Average Error: 14.2 → 0.3
Time: 21.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 14.2

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

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

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

    \[\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.2

    \[\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.6

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

    \[\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 2019016 
(FPCore (x)
  :name "Asymptote A"
  (- (/ 1 (+ x 1)) (/ 1 (- x 1))))

Details

Time bar (total: 21.0s)Debug log

sample61.0ms

Algorithm
intervals
Results
256×(pre true 80)
132×(body real 80)
58×(body real 640)
34×(body real 160)
32×(body real 320)

simplify6.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
5.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.5b

localize13.0ms

Local error

Found 3 expressions with local error:

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

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
*-un-lft-identity
add-sqr-sqrt
div-inv
associate-/r/
associate-/r*
add-log-exp
distribute-lft-out--
add-cube-cbrt
add-exp-log
pow1
flip--
add-cbrt-cube
inv-pow
pow-flip
flip-+
flip3--
frac-2neg
clear-num
rec-exp
difference-of-squares
frac-sub
diff-log
flip3-+
sub-neg
Counts
3 → 55
Calls
3 calls:
Slowest
5.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
1.0ms
(/ 1 (+ x 1))
1.0ms
(/ 1 (- x 1))

series60.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
46.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
7.0ms
(/ 1 (+ x 1))
7.0ms
(/ 1 (- x 1))

simplify1.6s

Counts
32 → 64
Calls
32 calls:
Slowest
423.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
387.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
183.0ms
(- (* 1 (- x 1)) (* (+ x 1) 1))
116.0ms
(+ (* 2 (pow x 2)) (+ (* 2 (pow x 4)) 2))
56.0ms
(- (+ x (+ (pow x 2) 1)))

prune448.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.1b

localize12.0ms

Local error

Found 1 expressions with local error:

0.1b
(/ 1 (+ -1 (* x x)))

rewrite1.0ms

Algorithm
rewrite-expression-head
Rules
associate-/r*
add-cube-cbrt
associate-/r/
add-exp-log
*-un-lft-identity
pow1
add-sqr-sqrt
add-log-exp
inv-pow
pow-flip
div-inv
flip-+
add-cbrt-cube
flip3-+
frac-2neg
clear-num
rec-exp
Counts
1 → 18
Calls
1 calls:
Slowest
1.0ms
(/ 1 (+ -1 (* x x)))

series13.0ms

Counts
1 → 3
Calls
1 calls:
Slowest
13.0ms
(/ 1 (+ -1 (* x x)))

simplify427.0ms

Counts
9 → 21
Calls
9 calls:
Slowest
284.0ms
(+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))
62.0ms
(- (+ (pow x 2) (+ (pow x 4) 1)))
25.0ms
(sqrt (+ -1 (* x x)))
15.0ms
(cbrt (+ -1 (* x x)))
12.0ms
(+ (/ 1 (pow x 4)) (+ (/ 1 (pow x 6)) (/ 1 (pow x 2))))

prune156.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize16.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)))
1.0b
(/ 1 (* (cbrt (+ -1 (* x x))) (cbrt (+ -1 (* x x)))))

rewrite15.0ms

Algorithm
rewrite-expression-head
Rules
18×cbrt-div
10×pow1
flip-+
flip3-+
cbrt-prod
associate-/r/
pow-flip
add-cube-cbrt
add-exp-log
pow1/3
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-cbrt-cube
frac-times
pow-prod-up
associate-*r/
associate-*l/
pow-prod-down
rec-exp
inv-pow
div-inv
prod-exp
pow-plus
frac-2neg
associate-/r*
clear-num
pow2
Counts
4 → 68
Calls
4 calls:
Slowest
10.0ms
(/ 1 (* (cbrt (+ -1 (* x x))) (cbrt (+ -1 (* x x)))))
1.0ms
(cbrt (+ -1 (* x x)))
1.0ms
(cbrt (+ -1 (* x x)))
1.0ms
(cbrt (+ -1 (* x x)))

series491.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
133.0ms
(/ 1 (* (cbrt (+ -1 (* x x))) (cbrt (+ -1 (* x x)))))
128.0ms
(cbrt (+ -1 (* x x)))
124.0ms
(cbrt (+ -1 (* x x)))
105.0ms
(cbrt (+ -1 (* x x)))

simplify4.4s

Counts
43 → 80
Calls
43 calls:
Slowest
382.0ms
(* (cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))) (cbrt (- -1 (* x x))))
358.0ms
(cbrt (- (* -1 -1) (* (* x x) (* x x))))
358.0ms
(cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x)))))
356.0ms
(* (cbrt (- -1 (* x x))) (cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))))
334.0ms
(cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x)))))

prune919.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.0b

localize16.0ms

Local error

Found 4 expressions with local error:

14.9b
(cbrt (+ -1 (* x x)))
14.9b
(cbrt (+ -1 (* x x)))
0.2b
(pow (cbrt (+ -1 (* x x))) -2)
0.1b
(/ (pow (cbrt (+ -1 (* x x))) -2) (cbrt (+ -1 (* x x))))

rewrite19.0ms

Algorithm
rewrite-expression-head
Rules
60×cbrt-prod
54×times-frac
49×add-cube-cbrt
49×*-un-lft-identity
49×add-sqr-sqrt
48×unpow-prod-down
10×add-exp-log
associate-/l*
associate-/r*
cbrt-div
pow1
add-cbrt-cube
add-log-exp
flip-+
div-exp
pow1/3
flip3-+
associate-/r/
pow-exp
pow-pow
pow-to-exp
pow-div
div-inv
frac-2neg
clear-num
cbrt-undiv
Counts
4 → 129
Calls
4 calls:
Slowest
11.0ms
(/ (pow (cbrt (+ -1 (* x x))) -2) (cbrt (+ -1 (* x x))))
3.0ms
(pow (cbrt (+ -1 (* x x))) -2)
1.0ms
(cbrt (+ -1 (* x x)))
1.0ms
(cbrt (+ -1 (* x x)))

series469.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
169.0ms
(pow (cbrt (+ -1 (* x x))) -2)
142.0ms
(cbrt (+ -1 (* x x)))
137.0ms
(cbrt (+ -1 (* x x)))
22.0ms
(/ (pow (cbrt (+ -1 (* x x))) -2) (cbrt (+ -1 (* x x))))

simplify8.1s

Counts
161 → 141
Calls
161 calls:
Slowest
418.0ms
(cbrt (+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x)))))
301.0ms
(cbrt (- (* -1 -1) (* (* x x) (* x x))))
261.0ms
(cbrt (- (* -1 -1) (* (* x x) (* x x))))
228.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))
208.0ms
(- (pow -1 1/3) (+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (* 1/9 (* (pow x 4) (pow -1 1/3)))))

prune1.5s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0b

regimes62.0ms

Accuracy

0% (0.1b remaining)

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

bsearch2.0ms

end0.0ms

sample2.1s

Algorithm
intervals
Results
8000×(pre true 80)
4202×(body real 80)
1895×(body real 640)
1225×(body real 320)
678×(body real 160)