Average Error: 29.4 → 22.8
Time: 30.0s
Precision: 64
Internal Precision: 128
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{n} \le -0.0004894433671653746:\\ \;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{{x}^{\left(\frac{1}{n}\right)}} \cdot \left(\sqrt[3]{{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{elif}\;\frac{1}{n} \le 2.5145598140327372 \cdot 10^{-26}:\\ \;\;\;\;\left(\frac{\frac{1}{4}}{n} \cdot \frac{\log x}{x \cdot n} - \left(\frac{\frac{\frac{1}{4}}{x}}{x \cdot n} - \frac{\frac{1}{2}}{x \cdot n}\right)\right) \cdot \left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus n

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (/ 1 n) < -0.0004894433671653746

    1. Initial program 0.4

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.4

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

    if -0.0004894433671653746 < (/ 1 n) < 2.5145598140327372e-26

    1. Initial program 44.7

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt44.8

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt{{x}^{\left(\frac{1}{n}\right)}}}\]
    4. Applied add-sqr-sqrt44.7

      \[\leadsto \color{blue}{\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \cdot \sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt{{x}^{\left(\frac{1}{n}\right)}}\]
    5. Applied difference-of-squares44.7

      \[\leadsto \color{blue}{\left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)}\]
    6. Taylor expanded around inf 32.8

      \[\leadsto \left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{x \cdot n} - \left(\frac{1}{4} \cdot \frac{\log \left(\frac{1}{x}\right)}{x \cdot {n}^{2}} + \frac{1}{4} \cdot \frac{1}{{x}^{2} \cdot n}\right)\right)}\]
    7. Simplified32.8

      \[\leadsto \left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \color{blue}{\left(\frac{\log x}{x \cdot n} \cdot \frac{\frac{1}{4}}{n} - \left(\frac{\frac{\frac{1}{4}}{x}}{x \cdot n} - \frac{\frac{1}{2}}{x \cdot n}\right)\right)}\]

    if 2.5145598140327372e-26 < (/ 1 n)

    1. Initial program 28.1

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Using strategy rm
    3. Applied add-log-exp28.2

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{\log \left(e^{{x}^{\left(\frac{1}{n}\right)}}\right)}\]
    4. Applied add-log-exp28.2

      \[\leadsto \color{blue}{\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}\right)} - \log \left(e^{{x}^{\left(\frac{1}{n}\right)}}\right)\]
    5. Applied diff-log28.3

      \[\leadsto \color{blue}{\log \left(\frac{e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}}{e^{{x}^{\left(\frac{1}{n}\right)}}}\right)}\]
    6. Simplified28.2

      \[\leadsto \log \color{blue}{\left(e^{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification22.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \le -0.0004894433671653746:\\ \;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{{x}^{\left(\frac{1}{n}\right)}} \cdot \left(\sqrt[3]{{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{elif}\;\frac{1}{n} \le 2.5145598140327372 \cdot 10^{-26}:\\ \;\;\;\;\left(\frac{\frac{1}{4}}{n} \cdot \frac{\log x}{x \cdot n} - \left(\frac{\frac{\frac{1}{4}}{x}}{x \cdot n} - \frac{\frac{1}{2}}{x \cdot n}\right)\right) \cdot \left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019005 
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))

Details

Time bar (total: 28.9s)Debug log

sample311.0ms

Algorithm
intervals

simplify10.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

10.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

prune10.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 29.3b

localize24.0ms

Local error

Found 3 expressions with local error:

0.9b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
0.7b
(pow (+ x 1) (/ 1 n))
0.5b
(pow x (/ 1 n))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
3 → 44
Calls

3 calls. Slowest were:

8.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
2.0ms
(pow (+ x 1) (/ 1 n))
1.0ms
(pow x (/ 1 n))

series331.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

206.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
65.0ms
(pow (+ x 1) (/ 1 n))
60.0ms
(pow x (/ 1 n))

simplify1.4s

Counts
28 → 53
Calls

28 calls. Slowest were:

564.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
250.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
213.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune524.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 19.7b

localize18.0ms

Local error

Found 4 expressions with local error:

0.9b
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
0.7b
(pow (+ x 1) (/ 1 n))
0.7b
(pow (+ x 1) (/ 1 n))
0.5b
(pow x (/ 1 n))

rewrite15.0ms

Algorithm
rewrite-expression-head
Counts
4 → 66
Calls

4 calls. Slowest were:

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

series480.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

242.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
94.0ms
(pow (+ x 1) (/ 1 n))
87.0ms
(pow (+ x 1) (/ 1 n))
58.0ms
(pow x (/ 1 n))

simplify2.3s

Counts
50 → 78
Calls

50 calls. Slowest were:

614.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
536.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
303.0ms
(- (+ (* 1/4 (/ (log -1) (* x (pow n 2)))) (* 1/2 (/ 1 (* x n)))) (+ (* 1/4 (/ 1 (* (pow x 2) n))) (* 1/4 (/ (log (/ -1 x)) (* x (pow n 2))))))

prune1.2s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 19.6b

localize17.0ms

Local error

Found 4 expressions with local error:

0.9b
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
0.9b
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
0.9b
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
0.7b
(pow (+ x 1) (/ 1 n))

rewrite35.0ms

Algorithm
rewrite-expression-head
Counts
4 → 77
Calls

4 calls. Slowest were:

11.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
11.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
11.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))

series845.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

281.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
260.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
242.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
62.0ms
(pow (+ x 1) (/ 1 n))

simplify2.8s

Counts
69 → 89
Calls

69 calls. Slowest were:

676.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
303.0ms
(- (+ (* 1/4 (/ (log -1) (* x (pow n 2)))) (* 1/2 (/ 1 (* x n)))) (+ (* 1/4 (/ 1 (* (pow x 2) n))) (* 1/4 (/ (log (/ -1 x)) (* x (pow n 2))))))
289.0ms
(- (+ (* 1/4 (/ (log -1) (* x (pow n 2)))) (* 1/2 (/ 1 (* x n)))) (+ (* 1/4 (/ 1 (* (pow x 2) n))) (* 1/4 (/ (log (/ -1 x)) (* x (pow n 2))))))

prune1.7s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 19.6b

localize22.0ms

Local error

Found 4 expressions with local error:

0.9b
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
0.9b
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
0.9b
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
0.9b
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))

rewrite66.0ms

Algorithm
rewrite-expression-head
Counts
4 → 80
Calls

4 calls. Slowest were:

24.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
18.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
11.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))

series997.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

272.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
255.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
238.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))
232.0ms
(- (sqrt (pow (+ x 1) (/ 1 n))) (sqrt (pow x (/ 1 n))))

simplify2.7s

Counts
76 → 92
Calls

76 calls. Slowest were:

328.0ms
(- (+ (* 1/4 (/ (log -1) (* x (pow n 2)))) (* 1/2 (/ 1 (* x n)))) (+ (* 1/4 (/ 1 (* (pow x 2) n))) (* 1/4 (/ (log (/ -1 x)) (* x (pow n 2))))))
327.0ms
(- (+ (* 1/4 (/ (log -1) (* x (pow n 2)))) (* 1/2 (/ 1 (* x n)))) (+ (* 1/4 (/ 1 (* (pow x 2) n))) (* 1/4 (/ (log (/ -1 x)) (* x (pow n 2))))))
293.0ms
(- (+ (* 1/4 (/ (log -1) (* x (pow n 2)))) (* 1/2 (/ 1 (* x n)))) (+ (* 1/4 (/ 1 (* (pow x 2) n))) (* 1/4 (/ (log (/ -1 x)) (* x (pow n 2))))))

prune2.0s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 19.6b

regimes360.0ms

Accuracy

81.2% (1.6b remaining)

Error of 22.8b against oracle of 21.2b and baseline of 29.5b

bsearch10.0ms

end0.0ms

sample10.7s

Algorithm
intervals