Average Error: 14.4 → 0.3
Time: 14.4s
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.4

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

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

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

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

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

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

Details

Time bar (total: 14.0s)Debug log

sample68.0ms

Algorithm
intervals

simplify11.0ms

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

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.9b

localize25.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))

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

series75.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
52.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
12.0ms
(/ 1 (- x 1))
11.0ms
(/ 1 (+ x 1))

simplify1.6s

Counts
32 → 64
Calls
32 calls:
Slowest
424.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
408.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
196.0ms
(- (* 1 (- x 1)) (* (+ x 1) 1))
80.0ms
(- (+ x (+ (pow x 2) 1)))
71.0ms
(+ (* 2 (pow x 2)) (+ (* 2 (pow x 4)) 2))

prune376.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.3b

localize12.0ms

Local error

Found 2 expressions with local error:

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

rewrite4.0ms

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

series27.0ms

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

simplify1.7s

Counts
17 → 39
Calls
17 calls:
Slowest
395.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
391.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
330.0ms
(/ 1 (- (* -1 -1) (* (* x x) (* x x))))
281.0ms
(+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))
79.0ms
(+ (* 2 (pow x 2)) (+ (* 2 (pow x 4)) 2))

prune382.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.2b

localize19.0ms

Local error

Found 4 expressions with local error:

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

rewrite6.0ms

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

series431.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
147.0ms
(cbrt (/ 1 (+ -1 (* x x))))
133.0ms
(cbrt (/ 1 (+ -1 (* x x))))
130.0ms
(cbrt (/ 1 (+ -1 (* x x))))
21.0ms
(/ 1 (+ -1 (* x x)))

simplify2.5s

Counts
39 → 75
Calls
39 calls:
Slowest
348.0ms
(cbrt (/ 1 (- (* -1 -1) (* (* x x) (* x x)))))
330.0ms
(cbrt (/ 1 (- (* -1 -1) (* (* x x) (* x x)))))
323.0ms
(+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))
315.0ms
(cbrt (/ 1 (- (* -1 -1) (* (* x x) (* x x)))))
117.0ms
(+ (* 1/3 (* (pow x 2) (pow -1 1/3))) (+ (* 2/9 (* (pow x 4) (pow -1 1/3))) (pow -1 1/3)))

prune798.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.2b

localize22.0ms

Local error

Found 4 expressions with local error:

13.0b
(cbrt (+ -1 (* x x)))
12.8b
(cbrt (/ 1 (+ -1 (* x x))))
12.8b
(cbrt (/ 1 (+ -1 (* x x))))
0.3b
(/ 1 (+ -1 (* x x)))

rewrite6.0ms

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

series417.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
154.0ms
(cbrt (/ 1 (+ -1 (* x x))))
144.0ms
(cbrt (/ 1 (+ -1 (* x x))))
98.0ms
(cbrt (+ -1 (* x x)))
21.0ms
(/ 1 (+ -1 (* x x)))

simplify2.9s

Counts
37 → 73
Calls
37 calls:
Slowest
364.0ms
(- (pow (/ 1 x) -2/3) (+ (* 1/9 (pow (/ 1 (pow x 10)) 1/3)) (* 1/3 (pow (/ 1 (pow x 4)) 1/3))))
344.0ms
(+ (* -1 -1) (- (* (* x x) (* x x)) (* -1 (* x x))))
327.0ms
(cbrt (- (* -1 -1) (* (* x x) (* x x))))
303.0ms
(cbrt (/ 1 (- (* -1 -1) (* (* x x) (* x x)))))
293.0ms
(cbrt (/ 1 (- (* -1 -1) (* (* x x) (* x x)))))

prune910.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.2b

regimes27.0ms

Accuracy

0% (0.0b remaining)

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

bsearch1.0ms

end0.0ms

sample1.6s

Algorithm
intervals