Average Error: 14.6 → 0.1
Time: 19.4s
Precision: 64
Internal Precision: 128
\[\frac{1}{x + 1} - \frac{1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -292.47442415369994 \lor \neg \left(x \le 484.8501943030043\right):\\ \;\;\;\;\left(\frac{\frac{-2}{x}}{x} + \frac{-2}{{x}^{6}}\right) + \frac{-2}{{x}^{4}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + x} - \frac{1}{x - 1}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -292.47442415369994 or 484.8501943030043 < x

    1. Initial program 29.3

      \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
    2. Taylor expanded around inf 0.8

      \[\leadsto \color{blue}{-\left(2 \cdot \frac{1}{{x}^{4}} + \left(2 \cdot \frac{1}{{x}^{6}} + 2 \cdot \frac{1}{{x}^{2}}\right)\right)}\]
    3. Simplified0.8

      \[\leadsto \color{blue}{\frac{-2}{{x}^{4}} + \left(\frac{-2}{{x}^{6}} + \frac{-2}{x \cdot x}\right)}\]
    4. Taylor expanded around 0 0.8

      \[\leadsto \color{blue}{-\left(2 \cdot \frac{1}{{x}^{4}} + \left(2 \cdot \frac{1}{{x}^{2}} + 2 \cdot \frac{1}{{x}^{6}}\right)\right)}\]
    5. Simplified0.1

      \[\leadsto \color{blue}{\frac{-2}{{x}^{4}} + \left(\frac{-2}{{x}^{6}} + \frac{\frac{-2}{x}}{x}\right)}\]

    if -292.47442415369994 < x < 484.8501943030043

    1. Initial program 0.0

      \[\frac{1}{x + 1} - \frac{1}{x - 1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -292.47442415369994 \lor \neg \left(x \le 484.8501943030043\right):\\ \;\;\;\;\left(\frac{\frac{-2}{x}}{x} + \frac{-2}{{x}^{6}}\right) + \frac{-2}{{x}^{4}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1 + x} - \frac{1}{x - 1}\\ \end{array}\]

Reproduce

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

Details

Time bar (total: 19.0s)Debug log

sample75.0ms

Algorithm
intervals

simplify6.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.1b

localize13.0ms

Local error

Found 3 expressions with local error:

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

rewrite7.0ms

Algorithm
rewrite-expression-head
Counts
3 → 55
Calls

3 calls. Slowest were:

5.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
1.0ms
(/ 1 (- x 1))
1.0ms
(/ 1 (+ x 1))

series69.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

40.0ms
(- (/ 1 (+ x 1)) (/ 1 (- x 1)))
22.0ms
(/ 1 (- x 1))
7.0ms
(/ 1 (+ x 1))

simplify1.5s

Counts
32 → 64
Calls

32 calls. Slowest were:

430.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
363.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
151.0ms
(- (* 1 (- x 1)) (* (+ x 1) 1))

prune509.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.5b

localize43.0ms

Local error

Found 4 expressions with local error:

0.5b
(/ -2 (* x x))
0.3b
(/ -2 (pow x 4))
0.2b
(/ -2 (pow x 6))
0.0b
(+ (/ -2 (pow x 4)) (+ (/ -2 (pow x 6)) (/ -2 (* x x))))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 56
Calls

4 calls. Slowest were:

13.0ms
(+ (/ -2 (pow x 4)) (+ (/ -2 (pow x 6)) (/ -2 (* x x))))
1.0ms
(/ -2 (pow x 4))
1.0ms
(/ -2 (* x x))

series88.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

29.0ms
(/ -2 (pow x 6))
25.0ms
(+ (/ -2 (pow x 4)) (+ (/ -2 (pow x 6)) (/ -2 (* x x))))
23.0ms
(/ -2 (pow x 4))
11.0ms
(/ -2 (* x x))

simplify2.2s

Counts
30 → 68
Calls

30 calls. Slowest were:

444.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
413.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 2))) (* 2 (/ 1 (pow x 6))))))
387.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))

prune670.0ms

Pruning

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 4 expressions with local error:

0.3b
(/ -2 (pow x 4))
0.2b
(/ -2 (pow x 6))
0.1b
(/ (/ -2 x) x)
0.0b
(+ (/ -2 (pow x 4)) (+ (/ -2 (pow x 6)) (/ (/ -2 x) x)))

rewrite36.0ms

Algorithm
rewrite-expression-head
Counts
4 → 59
Calls

4 calls. Slowest were:

29.0ms
(+ (/ -2 (pow x 4)) (+ (/ -2 (pow x 6)) (/ (/ -2 x) x)))
5.0ms
(/ (/ -2 x) x)
1.0ms
(/ -2 (pow x 4))

series111.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

36.0ms
(+ (/ -2 (pow x 4)) (+ (/ -2 (pow x 6)) (/ (/ -2 x) x)))
32.0ms
(/ -2 (pow x 6))
25.0ms
(/ -2 (pow x 4))
18.0ms
(/ (/ -2 x) x)

simplify2.0s

Counts
31 → 71
Calls

31 calls. Slowest were:

449.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 2))) (* 2 (/ 1 (pow x 6))))))
414.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))
363.0ms
(- (+ (* 2 (/ 1 (pow x 4))) (+ (* 2 (/ 1 (pow x 6))) (* 2 (/ 1 (pow x 2))))))

prune632.0ms

Pruning

4 alts after pruning (1 fresh and 3 done)

Merged error: 0.0b

localize51.0ms

Local error

Found 4 expressions with local error:

47.9b
(/ (pow x 6) (pow x 4))
45.3b
(* (pow x 4) (- (/ -2 (pow x 6)) (/ -2 (* x x))))
43.0b
(/ (* x x) (pow x 4))
33.4b
(/ (/ -4 (* x x)) (/ (* x x) (pow x 4)))

rewrite40.0ms

Algorithm
rewrite-expression-head
Counts
4 → 135
Calls

4 calls. Slowest were:

18.0ms
(* (pow x 4) (- (/ -2 (pow x 6)) (/ -2 (* x x))))
8.0ms
(/ (/ -4 (* x x)) (/ (* x x) (pow x 4)))
6.0ms
(/ (pow x 6) (pow x 4))

series127.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

108.0ms
(* (pow x 4) (- (/ -2 (pow x 6)) (/ -2 (* x x))))
10.0ms
(/ (pow x 6) (pow x 4))
8.0ms
(/ (* x x) (pow x 4))
1.0ms
(/ (/ -4 (* x x)) (/ (* x x) (pow x 4)))

simplify6.6s

Counts
143 → 147
Calls

143 calls. Slowest were:

1.2s
(/ (/ 1 (* x x)) (/ (* x x) (pow x 4)))
500.0ms
(/ (/ -4 (* x x)) (/ (* x x) (pow x 4)))
450.0ms
(- (log (/ -4 (* x x))) (- (log (* x x)) (* (log x) 4)))

prune2.2s

Pruning

4 alts after pruning (1 fresh and 3 done)

Merged error: 0b

regimes100.0ms

Accuracy

99.7% (0.0b remaining)

Error of 0.1b against oracle of 0.0b and baseline of 14.6b

bsearch116.0ms

end0.0ms

sample1.8s

Algorithm
intervals