Average Error: 19.7 → 0.5
Time: 16.0s
Precision: 64
Internal Precision: 128
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
\[\frac{\frac{1}{\left(\sqrt{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \cdot \sqrt{x}\right) \cdot \sqrt{\sqrt[3]{x + 1}}}}{\sqrt{x} + \sqrt{x + 1}}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.7
Target0.7
Herbie0.5
\[\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}\]

Derivation

  1. Initial program 19.7

    \[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
  2. Using strategy rm
  3. Applied frac-sub19.7

    \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{x + 1} - \sqrt{x} \cdot 1}{\sqrt{x} \cdot \sqrt{x + 1}}}\]
  4. Simplified19.7

    \[\leadsto \frac{\color{blue}{\sqrt{x + 1} - \sqrt{x}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  5. Using strategy rm
  6. Applied flip--19.5

    \[\leadsto \frac{\color{blue}{\frac{\sqrt{x + 1} \cdot \sqrt{x + 1} - \sqrt{x} \cdot \sqrt{x}}{\sqrt{x + 1} + \sqrt{x}}}}{\sqrt{x} \cdot \sqrt{x + 1}}\]
  7. Applied associate-/l/19.5

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

    \[\leadsto \frac{\color{blue}{1}}{\left(\sqrt{x} \cdot \sqrt{x + 1}\right) \cdot \left(\sqrt{x + 1} + \sqrt{x}\right)}\]
  9. Using strategy rm
  10. Applied associate-/r*0.4

    \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{x} \cdot \sqrt{x + 1}}}{\sqrt{x + 1} + \sqrt{x}}}\]
  11. Using strategy rm
  12. Applied add-cube-cbrt0.5

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

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

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

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

Reproduce

herbie shell --seed 2019004 
(FPCore (x)
  :name "2isqrt (example 3.6)"

  :herbie-target
  (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1)))))

  (- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1)))))

Details

Time bar (total: 15.1s)Debug log

sample152.0ms

Algorithm
intervals

simplify101.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

34.0ms
(- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1))))

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 21.2b

localize31.0ms

Local error

Found 4 expressions with local error:

3.2b
(- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1))))
0.3b
(/ 1 (sqrt x))
0.2b
(/ 1 (sqrt (+ x 1)))
0.0b
(sqrt (+ x 1))

rewrite18.0ms

Algorithm
rewrite-expression-head
Counts
4 → 71
Calls

4 calls. Slowest were:

11.0ms
(- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1))))
2.0ms
(/ 1 (sqrt (+ x 1)))
2.0ms
(/ 1 (sqrt x))

series104.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

41.0ms
(- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1))))
27.0ms
(/ 1 (sqrt (+ x 1)))
18.0ms
(/ 1 (sqrt x))
17.0ms
(sqrt (+ x 1))

simplify372.0ms

Counts
42 → 83
Calls

42 calls. Slowest were:

60.0ms
(- (+ (* 3/8 (pow x 2)) 1) (* 1/2 x))
49.0ms
(- (+ (* 1/2 x) 1) (* 1/8 (pow x 2)))
44.0ms
(sqrt (+ (* x x) (- (* 1 1) (* x 1))))

prune773.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 20.6b

localize17.0ms

Local error

Found 4 expressions with local error:

3.2b
(- (sqrt (+ x 1)) (sqrt x))
0.3b
(* (sqrt x) (sqrt (+ x 1)))
0.1b
(/ (- (sqrt (+ x 1)) (sqrt x)) (* (sqrt x) (sqrt (+ x 1))))
0.0b
(sqrt (+ x 1))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 85
Calls

4 calls. Slowest were:

14.0ms
(/ (- (sqrt (+ x 1)) (sqrt x)) (* (sqrt x) (sqrt (+ x 1))))
13.0ms
(- (sqrt (+ x 1)) (sqrt x))
4.0ms
(* (sqrt x) (sqrt (+ x 1)))

series120.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

58.0ms
(/ (- (sqrt (+ x 1)) (sqrt x)) (* (sqrt x) (sqrt (+ x 1))))
30.0ms
(- (sqrt (+ x 1)) (sqrt x))
21.0ms
(* (sqrt x) (sqrt (+ x 1)))
10.0ms
(sqrt (+ x 1))

simplify1.3s

Counts
65 → 97
Calls

65 calls. Slowest were:

344.0ms
(/ (* (cbrt (- (sqrt (+ x 1)) (sqrt x))) (cbrt (- (sqrt (+ x 1)) (sqrt x)))) (sqrt x))
270.0ms
(* (* (* (sqrt x) (sqrt x)) (sqrt x)) (* (* (sqrt (+ x 1)) (sqrt (+ x 1))) (sqrt (+ x 1))))
104.0ms
(/ (* (* (- (sqrt (+ x 1)) (sqrt x)) (- (sqrt (+ x 1)) (sqrt x))) (- (sqrt (+ x 1)) (sqrt x))) (* (* (* (sqrt x) (sqrt x)) (sqrt x)) (* (* (sqrt (+ x 1)) (sqrt (+ x 1))) (sqrt (+ x 1)))))

prune885.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.8b

localize17.0ms

Local error

Found 4 expressions with local error:

0.7b
(/ 1 (* (* (sqrt x) (sqrt (+ x 1))) (+ (sqrt (+ x 1)) (sqrt x))))
0.3b
(* (sqrt x) (sqrt (+ x 1)))
0.1b
(* (* (sqrt x) (sqrt (+ x 1))) (+ (sqrt (+ x 1)) (sqrt x)))
0.0b
(+ (sqrt (+ x 1)) (sqrt x))

rewrite87.0ms

Algorithm
rewrite-expression-head
Counts
4 → 91
Calls

4 calls. Slowest were:

37.0ms
(* (* (sqrt x) (sqrt (+ x 1))) (+ (sqrt (+ x 1)) (sqrt x)))
31.0ms
(/ 1 (* (* (sqrt x) (sqrt (+ x 1))) (+ (sqrt (+ x 1)) (sqrt x))))
9.0ms
(+ (sqrt (+ x 1)) (sqrt x))

series214.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

91.0ms
(/ 1 (* (* (sqrt x) (sqrt (+ x 1))) (+ (sqrt (+ x 1)) (sqrt x))))
70.0ms
(* (* (sqrt x) (sqrt (+ x 1))) (+ (sqrt (+ x 1)) (sqrt x)))
32.0ms
(* (sqrt x) (sqrt (+ x 1)))
20.0ms
(+ (sqrt (+ x 1)) (sqrt x))

simplify3.7s

Counts
66 → 103
Calls

66 calls. Slowest were:

415.0ms
(* (sqrt (- x 1)) (+ (* (sqrt (+ x 1)) (sqrt (+ x 1))) (- (* (sqrt x) (sqrt x)) (* (sqrt (+ x 1)) (sqrt x)))))
351.0ms
(* (sqrt (+ (* x x) (- (* 1 1) (* x 1)))) (+ (* (sqrt (+ x 1)) (sqrt (+ x 1))) (- (* (sqrt x) (sqrt x)) (* (sqrt (+ x 1)) (sqrt x)))))
338.0ms
(* (* (* (sqrt x) (sqrt x)) (sqrt x)) (* (* (sqrt (+ x 1)) (sqrt (+ x 1))) (sqrt (+ x 1))))

prune900.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize6.0ms

Local error

Found 4 expressions with local error:

0.3b
(* (sqrt x) (sqrt (+ x 1)))
0.1b
(/ 1 (* (sqrt x) (sqrt (+ x 1))))
0.1b
(/ (/ 1 (* (sqrt x) (sqrt (+ x 1)))) (+ (sqrt (+ x 1)) (sqrt x)))
0.0b
(+ (sqrt (+ x 1)) (sqrt x))

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
4 → 106
Calls

4 calls. Slowest were:

12.0ms
(/ (/ 1 (* (sqrt x) (sqrt (+ x 1)))) (+ (sqrt (+ x 1)) (sqrt x)))
6.0ms
(+ (sqrt (+ x 1)) (sqrt x))
4.0ms
(* (sqrt x) (sqrt (+ x 1)))

series189.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

103.0ms
(/ (/ 1 (* (sqrt x) (sqrt (+ x 1)))) (+ (sqrt (+ x 1)) (sqrt x)))
36.0ms
(/ 1 (* (sqrt x) (sqrt (+ x 1))))
29.0ms
(* (sqrt x) (sqrt (+ x 1)))
20.0ms
(+ (sqrt (+ x 1)) (sqrt x))

simplify2.3s

Counts
97 → 118
Calls

97 calls. Slowest were:

342.0ms
(* (* (* (sqrt x) (sqrt x)) (sqrt x)) (* (* (sqrt (+ x 1)) (sqrt (+ x 1))) (sqrt (+ x 1))))
129.0ms
(- (+ (* 3/8 (/ 1 (pow x 3))) (/ 1 x)) (* 1/2 (/ 1 (pow x 2))))
128.0ms
(- (log (/ 1 (* (sqrt x) (sqrt (+ x 1))))) (log (+ (sqrt (+ x 1)) (sqrt x))))

prune979.0ms

Pruning

12 alts after pruning (12 fresh and 0 done)

Merged error: 0.0b

regimes60.0ms

Accuracy

0% (0.4b remaining)

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

bsearch3.0ms

end0.0ms

sample2.7s

Algorithm
intervals