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

    1. Initial program 59.4

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

      \[\leadsto \color{blue}{\frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}}\]
    4. 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)}\]
    5. Simplified0.0

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

    if -21913.2379456452 < x < 22292.598586174332

    1. Initial program 0.1

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

      \[\leadsto \color{blue}{\frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}}\]
    4. Using strategy rm
    5. Applied add-cbrt-cube0.1

      \[\leadsto \frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \color{blue}{\sqrt[3]{\left(\left(\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) \cdot \left(\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right)\right) \cdot \left(\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right)}}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\]
    6. Using strategy rm
    7. Applied frac-times0.1

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

      \[\leadsto \frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \sqrt[3]{\left(\left(\frac{x + 1}{x - 1} \cdot \frac{x + 1}{x - 1}\right) \cdot \color{blue}{\frac{\left(x + 1\right) \cdot \left(x + 1\right)}{\left(x - 1\right) \cdot \left(x - 1\right)}}\right) \cdot \frac{\left(x + 1\right) \cdot \left(x + 1\right)}{\left(x - 1\right) \cdot \left(x - 1\right)}}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\]
    9. Applied frac-times0.1

      \[\leadsto \frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \sqrt[3]{\left(\color{blue}{\frac{\left(x + 1\right) \cdot \left(x + 1\right)}{\left(x - 1\right) \cdot \left(x - 1\right)}} \cdot \frac{\left(x + 1\right) \cdot \left(x + 1\right)}{\left(x - 1\right) \cdot \left(x - 1\right)}\right) \cdot \frac{\left(x + 1\right) \cdot \left(x + 1\right)}{\left(x - 1\right) \cdot \left(x - 1\right)}}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\]
    10. Applied frac-times0.1

      \[\leadsto \frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \sqrt[3]{\color{blue}{\frac{\left(\left(x + 1\right) \cdot \left(x + 1\right)\right) \cdot \left(\left(x + 1\right) \cdot \left(x + 1\right)\right)}{\left(\left(x - 1\right) \cdot \left(x - 1\right)\right) \cdot \left(\left(x - 1\right) \cdot \left(x - 1\right)\right)}} \cdot \frac{\left(x + 1\right) \cdot \left(x + 1\right)}{\left(x - 1\right) \cdot \left(x - 1\right)}}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\]
    11. Applied frac-times0.1

      \[\leadsto \frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \sqrt[3]{\color{blue}{\frac{\left(\left(\left(x + 1\right) \cdot \left(x + 1\right)\right) \cdot \left(\left(x + 1\right) \cdot \left(x + 1\right)\right)\right) \cdot \left(\left(x + 1\right) \cdot \left(x + 1\right)\right)}{\left(\left(\left(x - 1\right) \cdot \left(x - 1\right)\right) \cdot \left(\left(x - 1\right) \cdot \left(x - 1\right)\right)\right) \cdot \left(\left(x - 1\right) \cdot \left(x - 1\right)\right)}}}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\]
    12. Applied cbrt-div0.1

      \[\leadsto \frac{\frac{x}{x + 1} \cdot \frac{x}{x + 1} - \color{blue}{\frac{\sqrt[3]{\left(\left(\left(x + 1\right) \cdot \left(x + 1\right)\right) \cdot \left(\left(x + 1\right) \cdot \left(x + 1\right)\right)\right) \cdot \left(\left(x + 1\right) \cdot \left(x + 1\right)\right)}}{\sqrt[3]{\left(\left(\left(x - 1\right) \cdot \left(x - 1\right)\right) \cdot \left(\left(x - 1\right) \cdot \left(x - 1\right)\right)\right) \cdot \left(\left(x - 1\right) \cdot \left(x - 1\right)\right)}}}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\]
    13. Applied frac-times0.1

      \[\leadsto \frac{\color{blue}{\frac{x \cdot x}{\left(x + 1\right) \cdot \left(x + 1\right)}} - \frac{\sqrt[3]{\left(\left(\left(x + 1\right) \cdot \left(x + 1\right)\right) \cdot \left(\left(x + 1\right) \cdot \left(x + 1\right)\right)\right) \cdot \left(\left(x + 1\right) \cdot \left(x + 1\right)\right)}}{\sqrt[3]{\left(\left(\left(x - 1\right) \cdot \left(x - 1\right)\right) \cdot \left(\left(x - 1\right) \cdot \left(x - 1\right)\right)\right) \cdot \left(\left(x - 1\right) \cdot \left(x - 1\right)\right)}}}{\frac{x}{x + 1} + \frac{x + 1}{x - 1}}\]
    14. Applied frac-sub0.1

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

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

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

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

Reproduce

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

Details

Time bar (total: 2.8m)Debug log

sample91.0ms

Algorithm
intervals

simplify29.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 29.0b

localize25.0ms

Local error

Found 3 expressions with local error:

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

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
3 → 62
Calls

3 calls. Slowest were:

8.0ms
(- (/ x (+ x 1)) (/ (+ x 1) (- x 1)))
3.0ms
(/ (+ x 1) (- x 1))
0.0ms
(/ x (+ x 1))

series75.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

51.0ms
(- (/ x (+ x 1)) (/ (+ x 1) (- x 1)))
14.0ms
(/ (+ x 1) (- x 1))
10.0ms
(/ x (+ x 1))

simplify1.9s

Counts
51 → 71
Calls

51 calls. Slowest were:

474.0ms
(- (* x (- x 1)) (* (+ x 1) (+ x 1)))
273.0ms
(/ (* (* (+ x 1) (+ x 1)) (+ x 1)) (* (* (- x 1) (- x 1)) (- x 1)))
219.0ms
(- (+ (* 3 (/ 1 (pow x 3))) (+ (/ 1 (pow x 2)) (* 3 (/ 1 x)))))

prune524.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

2.6b
(- (* (/ x (+ x 1)) (/ x (+ x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))))
0.0b
(* (/ x (+ x 1)) (/ x (+ x 1)))
0.0b
(/ (- (* (/ x (+ x 1)) (/ x (+ x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))) (+ (/ x (+ x 1)) (/ (+ x 1) (- x 1))))
0.0b
(* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))

rewrite79.0ms

Algorithm
rewrite-expression-head
Counts
4 → 155
Calls

4 calls. Slowest were:

43.0ms
(/ (- (* (/ x (+ x 1)) (/ x (+ x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))) (+ (/ x (+ x 1)) (/ (+ x 1) (- x 1))))
14.0ms
(* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))
11.0ms
(- (* (/ x (+ x 1)) (/ x (+ x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))))

series204.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

113.0ms
(/ (- (* (/ x (+ x 1)) (/ x (+ x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))) (+ (/ x (+ x 1)) (/ (+ x 1) (- x 1))))
54.0ms
(- (* (/ x (+ x 1)) (/ x (+ x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))))
22.0ms
(* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))
15.0ms
(* (/ x (+ x 1)) (/ x (+ x 1)))

simplify21.5s

Counts
154 → 167
Calls

154 calls. Slowest were:

877.0ms
(* (* (* (/ x (+ x 1)) (/ x (+ x 1))) (/ x (+ x 1))) (* (* (/ x (+ x 1)) (/ x (+ x 1))) (/ x (+ x 1))))
723.0ms
(* (* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (/ (+ x 1) (- x 1))) (* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (/ (+ x 1) (- x 1))))
657.0ms
(- (* (* x x) (- x 1)) (* (* (+ x 1) (+ x 1)) (* (+ x 1) (/ (+ x 1) (- x 1)))))

prune1.4s

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.0b

localize24.0ms

Local error

Found 4 expressions with local error:

2.6b
(- (* (/ x (+ x 1)) (/ x (+ x 1))) (cbrt (* (* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))))))
0.0b
(* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))))
0.0b
(cbrt (* (* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))))
0.0b
(* (/ x (+ x 1)) (/ x (+ x 1)))

rewrite149.0ms

Algorithm
rewrite-expression-head
Counts
4 → 404
Calls

4 calls. Slowest were:

66.0ms
(cbrt (* (* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))))
40.0ms
(- (* (/ x (+ x 1)) (/ x (+ x 1))) (cbrt (* (* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))))))
27.0ms
(* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))))

series106.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

57.0ms
(- (* (/ x (+ x 1)) (/ x (+ x 1))) (cbrt (* (* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))))))
20.0ms
(* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))))
15.0ms
(cbrt (* (* (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))) (* (/ (+ x 1) (- x 1)) (/ (+ x 1) (- x 1)))))
14.0ms
(* (/ x (+ x 1)) (/ x (+ x 1)))

simplify2.1m

Counts
595 → 416
Calls

595 calls. Slowest were:

1.5s
(cbrt (* (* (* (+ x 1) (+ x 1)) (* (+ x 1) (/ (+ x 1) (- x 1)))) (* (+ x 1) (+ x 1))))
1.4s
(* (* (+ x 1) (+ x 1)) (* (+ x 1) (+ x 1)))
1.2s
(cbrt (* (* (* (/ (+ x 1) (- x 1)) (+ x 1)) (* (+ x 1) (+ x 1))) (* (+ x 1) (+ x 1))))

prune5.2s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

localize27.0ms

Local error

Found 4 expressions with local error:

2.6b
(- (pow (/ x (+ 1 x)) 4) (pow (/ (+ 1 x) (+ -1 x)) 4))
0.0b
(pow (/ (+ 1 x) (+ -1 x)) 4)
0.0b
(pow (/ x (+ 1 x)) 4)
0.0b
(* (/ x (+ x 1)) (/ x (+ x 1)))

rewrite26.0ms

Algorithm
rewrite-expression-head
Counts
4 → 91
Calls

4 calls. Slowest were:

17.0ms
(- (pow (/ x (+ 1 x)) 4) (pow (/ (+ 1 x) (+ -1 x)) 4))
4.0ms
(* (/ x (+ x 1)) (/ x (+ x 1)))
3.0ms
(pow (/ (+ 1 x) (+ -1 x)) 4)

series144.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

94.0ms
(- (pow (/ x (+ 1 x)) 4) (pow (/ (+ 1 x) (+ -1 x)) 4))
20.0ms
(pow (/ x (+ 1 x)) 4)
18.0ms
(pow (/ (+ 1 x) (+ -1 x)) 4)
11.0ms
(* (/ x (+ x 1)) (/ x (+ x 1)))

simplify2.7s

Counts
74 → 103
Calls

74 calls. Slowest were:

881.0ms
(* (* (* (/ x (+ x 1)) (/ x (+ x 1))) (/ x (+ x 1))) (* (* (/ x (+ x 1)) (/ x (+ x 1))) (/ x (+ x 1))))
219.0ms
(- (+ (* 108 (/ 1 (pow x 3))) (+ (* 22 (/ 1 (pow x 2))) (* 12 (/ 1 x)))))
185.0ms
(- (+ (* 108 (/ 1 (pow x 3))) (+ (* 22 (/ 1 (pow x 2))) (* 12 (/ 1 x)))))

prune1.3s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 0.0b

regimes69.0ms

Accuracy

99.9% (0.0b remaining)

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

bsearch176.0ms

end0.0ms

sample2.4s

Algorithm
intervals