Average Error: 10.0 → 0.3
Time: 41.7s
Precision: 64
Internal Precision: 128
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
\[\frac{2}{{x}^{3} - x}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 10.0

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

    \[\leadsto \color{blue}{\frac{1 \cdot x - \left(x + 1\right) \cdot 2}{\left(x + 1\right) \cdot x}} + \frac{1}{x - 1}\]
  4. Applied frac-add25.3

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

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

    \[\leadsto \frac{2}{\color{blue}{{x}^{3} - x}}\]
  7. Final simplification0.3

    \[\leadsto \frac{2}{{x}^{3} - x}\]

Reproduce

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

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

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

Details

Time bar (total: 41.4s)Debug log

sample95.0ms

Algorithm
intervals

simplify53.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune5.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 9.7b

localize35.0ms

Local error

Found 4 expressions with local error:

2.4b
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1)))
0.0b
(- (/ 1 (+ x 1)) (/ 2 x))
0.0b
(/ 1 (+ x 1))
0.0b
(/ 1 (- x 1))

rewrite32.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

21.0ms
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1)))
5.0ms
(- (/ 1 (+ x 1)) (/ 2 x))
5.0ms
(/ 1 (- x 1))

series89.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

49.0ms
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1)))
18.0ms
(- (/ 1 (+ x 1)) (/ 2 x))
11.0ms
(/ 1 (- x 1))
11.0ms
(/ 1 (+ x 1))

simplify3.5s

Counts
48 → 88
Calls

48 calls. Slowest were:

529.0ms
(* (+ (/ 1 (+ x 1)) (/ 2 x)) (- x 1))
438.0ms
(- (+ (* 2 x) (+ (* 2 (pow x 3)) (* 2 (/ 1 x)))))
402.0ms
(+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1))

prune654.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

localize29.0ms

Local error

Found 4 expressions with local error:

7.1b
(+ (- (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1))) (/ 2 x)) (/ 1 (- x 1)))
0.1b
(/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1)))
0.1b
(/ 1 (sqrt (+ x 1)))
0.0b
(- (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1))) (/ 2 x))

rewrite111.0ms

Algorithm
rewrite-expression-head
Counts
4 → 129
Calls

4 calls. Slowest were:

79.0ms
(+ (- (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1))) (/ 2 x)) (/ 1 (- x 1)))
18.0ms
(- (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1))) (/ 2 x))
9.0ms
(/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1)))

series94.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

42.0ms
(+ (- (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1))) (/ 2 x)) (/ 1 (- x 1)))
20.0ms
(/ 1 (sqrt (+ x 1)))
20.0ms
(- (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1))) (/ 2 x))
11.0ms
(/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1)))

simplify4.6s

Counts
142 → 141
Calls

142 calls. Slowest were:

563.0ms
(+ (* (- (* (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1))) (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1)))) (* (/ 2 x) (/ 2 x))) (- x 1)) (* (+ (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1))) (/ 2 x)) 1))
439.0ms
(* (+ (/ (/ 1 (sqrt (+ x 1))) (sqrt (+ x 1))) (/ 2 x)) (- x 1))
409.0ms
(- (+ (* 2 x) (+ (* 2 (pow x 3)) (* 2 (/ 1 x)))))

prune1.4s

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.1b

localize32.0ms

Local error

Found 4 expressions with local error:

16.0b
(+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1))
0.1b
(* (* (+ x 1) x) (- x 1))
0.0b
(- (* 1 x) (* (+ x 1) 2))
0.0b
(/ (+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1)) (* (* (+ x 1) x) (- x 1)))

rewrite58.0ms

Algorithm
rewrite-expression-head
Counts
4 → 117
Calls

4 calls. Slowest were:

36.0ms
(/ (+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1)) (* (* (+ x 1) x) (- x 1)))
8.0ms
(+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1))
7.0ms
(* (* (+ x 1) x) (- x 1))

series97.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

40.0ms
(/ (+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1)) (* (* (+ x 1) x) (- x 1)))
38.0ms
(* (* (+ x 1) x) (- x 1))
16.0ms
(- (* 1 x) (* (+ x 1) 2))
3.0ms
(+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1))

simplify23.7s

Counts
112 → 129
Calls

112 calls. Slowest were:

989.0ms
(+ (* (* (- (pow (* 1 x) 3) (pow (* (+ x 1) 2) 3)) (- (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1)))) (* (* (+ (* (* 1 x) (* 1 x)) (+ (* (* (+ x 1) 2) (* (+ x 1) 2)) (* (* 1 x) (* (+ x 1) 2)))) (+ (* x x) (+ (* 1 1) (* x 1)))) (* (* (+ (pow x 3) (pow 1 3)) x) 1)))
982.0ms
(+ (* (* (- (pow (* 1 x) 3) (pow (* (+ x 1) 2) 3)) (- (pow x 3) (pow 1 3))) (+ (* x x) (- (* 1 1) (* x 1)))) (* (* (+ (* (* 1 x) (* 1 x)) (+ (* (* (+ x 1) 2) (* (+ x 1) 2)) (* (* 1 x) (* (+ x 1) 2)))) (+ (* x x) (+ (* 1 1) (* x 1)))) (* (* (+ (pow x 3) (pow 1 3)) x) 1)))
817.0ms
(+ (* (* (- (pow (* 1 x) 3) (pow (* (+ x 1) 2) 3)) (- (pow x 3) (pow 1 3))) (- x 1)) (* (* (+ (* (* 1 x) (* 1 x)) (+ (* (* (+ x 1) 2) (* (+ x 1) 2)) (* (* 1 x) (* (+ x 1) 2)))) (+ (* x x) (+ (* 1 1) (* x 1)))) (* (* (- (* x x) (* 1 1)) x) 1)))

prune1.2s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize4.0ms

Local error

Found 3 expressions with local error:

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

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
3 → 59
Calls

3 calls. Slowest were:

9.0ms
(* (* (+ x 1) x) (- x 1))
3.0ms
(/ 2 (* (* (+ x 1) x) (- x 1)))
2.0ms
(* (+ x 1) x)

series74.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

34.0ms
(* (* (+ x 1) x) (- x 1))
23.0ms
(/ 2 (* (* (+ x 1) x) (- x 1)))
17.0ms
(* (+ x 1) x)

simplify3.2s

Counts
45 → 68
Calls

45 calls. Slowest were:

313.0ms
(* (* (- (* x x) (* 1 1)) x) (- (pow x 3) (pow 1 3)))
286.0ms
(- (+ (* 2 x) (+ (* 2 (pow x 3)) (* 2 (/ 1 x)))))
232.0ms
(* (* (- (* x x) (* 1 1)) x) (- x 1))

prune435.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0b

regimes28.0ms

Accuracy

0% (0.3b remaining)

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

bsearch1.0ms

end0.0ms

sample1.9s

Algorithm
intervals