Average Error: 29.4 → 0.1
Time: 25.5s
Precision: 64
Internal Precision: 128
\[\frac{x}{x + 1} - \frac{x + 1}{x - 1}\]
\[\begin{array}{l} \mathbf{if}\;x \le -9392.422930906088 \lor \neg \left(x \le 9865.742309267576\right):\\ \;\;\;\;\left(\frac{-3}{x} - \frac{1}{x \cdot x}\right) + \frac{\frac{-3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 + x} - \frac{1 + x}{x \cdot x - 1} \cdot \left(1 + x\right)\\ \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 < -9392.422930906088 or 9865.742309267576 < x

    1. Initial program 59.2

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

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

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

    if -9392.422930906088 < x < 9865.742309267576

    1. Initial program 0.1

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

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

      \[\leadsto \frac{x}{x + 1} - \color{blue}{\frac{x + 1}{x \cdot x - 1 \cdot 1} \cdot \left(x + 1\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -9392.422930906088 \lor \neg \left(x \le 9865.742309267576\right):\\ \;\;\;\;\left(\frac{-3}{x} - \frac{1}{x \cdot x}\right) + \frac{\frac{-3}{x}}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{1 + x} - \frac{1 + x}{x \cdot x - 1} \cdot \left(1 + x\right)\\ \end{array}\]

Reproduce

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

Details

Time bar (total: 25.0s)Debug log

sample76.0ms

Algorithm
intervals

simplify19.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.6b

localize25.0ms

Local error

Found 3 expressions with local error:

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

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
3 → 62
Calls

3 calls. Slowest were:

12.0ms
(- (/ x (+ x 1)) (/ (+ x 1) (- x 1)))
6.0ms
(/ (+ x 1) (- x 1))
1.0ms
(/ x (+ x 1))

series91.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

58.0ms
(- (/ x (+ x 1)) (/ (+ x 1) (- x 1)))
16.0ms
(/ (+ x 1) (- x 1))
16.0ms
(/ x (+ x 1))

simplify2.4s

Counts
51 → 71
Calls

51 calls. Slowest were:

695.0ms
(/ (* (* (+ x 1) (+ x 1)) (+ x 1)) (* (* (- x 1) (- x 1)) (- x 1)))
431.0ms
(- (* x (- x 1)) (* (+ x 1) (+ x 1)))
244.0ms
(- (+ (* 3 (/ 1 (pow x 3))) (+ (/ 1 (pow x 2)) (* 3 (/ 1 x)))))

prune486.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 4 expressions with local error:

6.4b
(+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x)))
0.5b
(/ 1 (* x x))
0.1b
(/ (/ -3 x) (* x x))
0.0b
(- (/ -3 x) (/ 1 (* x x)))

rewrite44.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

27.0ms
(+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x)))
8.0ms
(- (/ -3 x) (/ 1 (* x x)))
6.0ms
(/ (/ -3 x) (* x x))

series80.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

25.0ms
(+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x)))
24.0ms
(- (/ -3 x) (/ 1 (* x x)))
18.0ms
(/ (/ -3 x) (* x x))
13.0ms
(/ 1 (* x x))

simplify2.8s

Counts
47 → 86
Calls

47 calls. Slowest were:

569.0ms
(/ (* (* (/ -3 x) (/ -3 x)) (/ -3 x)) (* (* (* x x) (* x x)) (* x x)))
301.0ms
(+ (* (- (* (/ -3 x) (/ -3 x)) (* (/ 1 (* x x)) (/ 1 (* x x)))) (* x x)) (* (+ (/ -3 x) (/ 1 (* x x))) (/ -3 x)))
297.0ms
(* (+ (* (/ -3 x) (/ -3 x)) (+ (* (/ 1 (* x x)) (/ 1 (* x x))) (* (/ -3 x) (/ 1 (* x x))))) (* x x))

prune576.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

localize21.0ms

Local error

Found 4 expressions with local error:

18.6b
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
18.6b
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
18.6b
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
6.4b
(+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x)))

rewrite71.0ms

Algorithm
rewrite-expression-head
Counts
4 → 78
Calls

4 calls. Slowest were:

21.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
19.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
18.0ms
(+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x)))

series228.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

86.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
69.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
60.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
13.0ms
(+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x)))

simplify6.6s

Counts
59 → 90
Calls

59 calls. Slowest were:

370.0ms
(* (+ (* (/ -3 x) (/ -3 x)) (+ (* (/ 1 (* x x)) (/ 1 (* x x))) (* (/ -3 x) (/ 1 (* x x))))) (* x x))
329.0ms
(cbrt (+ (pow (- (/ -3 x) (/ 1 (* x x))) 3) (pow (/ (/ -3 x) (* x x)) 3)))
296.0ms
(cbrt (+ (pow (- (/ -3 x) (/ 1 (* x x))) 3) (pow (/ (/ -3 x) (* x x)) 3)))

prune782.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

localize23.0ms

Local error

Found 4 expressions with local error:

18.6b
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
18.6b
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
18.6b
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
18.6b
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))

rewrite59.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

22.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
13.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
11.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))

series343.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

88.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
87.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
86.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))
82.0ms
(cbrt (+ (- (/ -3 x) (/ 1 (* x x))) (/ (/ -3 x) (* x x))))

simplify6.5s

Counts
56 → 88
Calls

56 calls. Slowest were:

341.0ms
(cbrt (+ (* (- (* (/ -3 x) (/ -3 x)) (* (/ 1 (* x x)) (/ 1 (* x x)))) (* x x)) (* (+ (/ -3 x) (/ 1 (* x x))) (/ -3 x))))
321.0ms
(cbrt (+ (pow (- (/ -3 x) (/ 1 (* x x))) 3) (pow (/ (/ -3 x) (* x x)) 3)))
302.0ms
(cbrt (+ (pow (- (/ -3 x) (/ 1 (* x x))) 3) (pow (/ (/ -3 x) (* x x)) 3)))

prune1.1s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0b

regimes99.0ms

Accuracy

99.9% (0.0b remaining)

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

bsearch133.0ms

end0.0ms

sample2.4s

Algorithm
intervals