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-sub25.8

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

    \[\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 2019002 
(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.0s)Debug log

sample54.0ms

Algorithm
intervals

simplify55.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 7.5b

localize54.0ms

Local error

Found 4 expressions with local error:

1.0b
(+ (- (/ 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))

rewrite58.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

43.0ms
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1)))
10.0ms
(- (/ 1 (+ x 1)) (/ 2 x))
2.0ms
(/ 1 (+ x 1))

series108.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

66.0ms
(+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1)))
18.0ms
(- (/ 1 (+ x 1)) (/ 2 x))
12.0ms
(/ 1 (- x 1))
11.0ms
(/ 1 (+ x 1))

simplify3.9s

Counts
48 → 88
Calls

48 calls. Slowest were:

481.0ms
(* (+ (/ 1 (+ x 1)) (/ 2 x)) (- x 1))
458.0ms
(+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1))
389.0ms
(- (+ (* 2 x) (+ (* 2 (pow x 3)) (* 2 (/ 1 x)))))

prune716.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.1b

localize34.0ms

Local error

Found 4 expressions with local error:

14.5b
(+ (* (- (* 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)))

rewrite63.0ms

Algorithm
rewrite-expression-head
Counts
4 → 117
Calls

4 calls. Slowest were:

37.0ms
(/ (+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1)) (* (* (+ x 1) x) (- x 1)))
13.0ms
(+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1))
8.0ms
(* (* (+ x 1) x) (- x 1))

series92.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

41.0ms
(* (* (+ x 1) x) (- x 1))
38.0ms
(/ (+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1)) (* (* (+ x 1) x) (- x 1)))
11.0ms
(- (* 1 x) (* (+ x 1) 2))
2.0ms
(+ (* (- (* 1 x) (* (+ x 1) 2)) (- x 1)) (* (* (+ x 1) x) 1))

simplify27.0s

Counts
112 → 129
Calls

112 calls. Slowest were:

1.3s
(+ (* (* (- (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)))
1.1s
(+ (* (* (- (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)))
939.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.6s

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize3.0ms

Local error

Found 3 expressions with local error:

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

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
3 → 59
Calls

3 calls. Slowest were:

10.0ms
(* (* (+ x 1) x) (- x 1))
5.0ms
(* (+ x 1) x)
3.0ms
(/ 2 (* (* (+ x 1) x) (- x 1)))

series102.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

43.0ms
(* (* (+ x 1) x) (- x 1))
32.0ms
(* (+ x 1) x)
28.0ms
(/ 2 (* (* (+ x 1) x) (- x 1)))

simplify4.4s

Counts
45 → 68
Calls

45 calls. Slowest were:

571.0ms
(* (* (+ (pow x 3) (pow 1 3)) x) (- (* x x) (* 1 1)))
486.0ms
(* (* (- (* x x) (* 1 1)) x) (- (pow x 3) (pow 1 3)))
330.0ms
(- (+ (* 2 x) (+ (* 2 (pow x 3)) (* 2 (/ 1 x)))))

prune354.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 2 expressions with local error:

0.4b
(/ 2 (- (pow x 3) x))
0.0b
(- (pow x 3) x)

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
2 → 26
Calls

2 calls. Slowest were:

5.0ms
(- (pow x 3) x)
2.0ms
(/ 2 (- (pow x 3) x))

series45.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

27.0ms
(- (pow x 3) x)
18.0ms
(/ 2 (- (pow x 3) x))

simplify700.0ms

Counts
11 → 32
Calls

11 calls. Slowest were:

286.0ms
(- (+ (* 2 x) (+ (* 2 (pow x 3)) (* 2 (/ 1 x)))))
175.0ms
(+ (* (pow x 3) (pow x 3)) (+ (* x x) (* (pow x 3) x)))
107.0ms
(+ (* 2 (/ 1 (pow x 7))) (+ (* 2 (/ 1 (pow x 3))) (* 2 (/ 1 (pow x 5)))))

prune162.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.0b

regimes25.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.6s

Algorithm
intervals