Average Error: 29.4 → 22.6
Time: 28.4s
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 -5.456546428592114 \cdot 10^{-23}:\\ \;\;\;\;\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{elif}\;\frac{1}{n} \le 4.1761942342073333 \cdot 10^{-16}:\\ \;\;\;\;\frac{\log x}{\left(x \cdot n\right) \cdot n} + \left(\frac{\frac{\frac{-1}{2}}{x}}{x \cdot n} + \frac{1}{x \cdot n}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \log \left(e^{\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\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) < -5.456546428592114e-23

    1. Initial program 2.9

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

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

    if -5.456546428592114e-23 < (/ 1 n) < 4.1761942342073333e-16

    1. Initial program 45.2

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

      \[\leadsto \color{blue}{\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}\]
    4. Taylor expanded around inf 32.7

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

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

    if 4.1761942342073333e-16 < (/ 1 n)

    1. Initial program 26.3

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

      \[\leadsto \color{blue}{\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt26.4

      \[\leadsto \log \left(e^{\color{blue}{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}}\right)\]
    6. Applied exp-prod26.4

      \[\leadsto \log \color{blue}{\left({\left(e^{\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)}^{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}\right)}\]
    7. Applied log-pow26.4

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

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

Reproduce

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

Details

Time bar (total: 27.5s)Debug log

sample340.0ms

Algorithm
intervals

simplify5.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune6.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 31.4b

localize17.0ms

Local error

Found 3 expressions with local error:

1.3b
(pow (+ x 1) (/ 1 n))
1.1b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
0.5b
(pow x (/ 1 n))

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
3 → 44
Calls

3 calls. Slowest were:

9.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
4.0ms
(pow (+ x 1) (/ 1 n))
1.0ms
(pow x (/ 1 n))

series631.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

387.0ms
(pow (+ x 1) (/ 1 n))
183.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
61.0ms
(pow x (/ 1 n))

simplify1.7s

Counts
28 → 53
Calls

28 calls. Slowest were:

620.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
346.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
270.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune519.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 22.0b

localize18.0ms

Local error

Found 4 expressions with local error:

1.3b
(pow (+ x 1) (/ 1 n))
1.3b
(pow (+ x 1) (/ 1 n))
1.3b
(pow (+ x 1) (/ 1 n))
1.1b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

rewrite30.0ms

Algorithm
rewrite-expression-head
Counts
4 → 66
Calls

4 calls. Slowest were:

16.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
7.0ms
(pow (+ x 1) (/ 1 n))
3.0ms
(pow (+ x 1) (/ 1 n))

series511.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

221.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
100.0ms
(pow (+ x 1) (/ 1 n))
100.0ms
(pow (+ x 1) (/ 1 n))
89.0ms
(pow (+ x 1) (/ 1 n))

simplify2.8s

Counts
45 → 78
Calls

45 calls. Slowest were:

692.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
686.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
542.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))

prune941.0ms

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 22.0b

localize10.0ms

Local error

Found 4 expressions with local error:

1.3b
(pow (+ x 1) (/ 1 n))
1.1b
(log (exp (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))))
1.1b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
0.5b
(pow x (/ 1 n))

rewrite49.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

29.0ms
(log (exp (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))))
14.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
3.0ms
(pow (+ x 1) (/ 1 n))

series572.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

219.0ms
(log (exp (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))))
212.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
73.0ms
(pow x (/ 1 n))
67.0ms
(pow (+ x 1) (/ 1 n))

simplify2.5s

Counts
44 → 77
Calls

44 calls. Slowest were:

622.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
326.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
307.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune815.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 22.0b

localize16.0ms

Local error

Found 4 expressions with local error:

1.3b
(pow (+ x 1) (/ 1 n))
1.3b
(pow (+ x 1) (/ 1 n))
1.3b
(pow (+ x 1) (/ 1 n))
1.1b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
4 → 66
Calls

4 calls. Slowest were:

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

series453.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

228.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
96.0ms
(pow (+ x 1) (/ 1 n))
69.0ms
(pow (+ x 1) (/ 1 n))
61.0ms
(pow (+ x 1) (/ 1 n))

simplify2.7s

Counts
45 → 78
Calls

45 calls. Slowest were:

702.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
629.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
511.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))

prune1.2s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 22.0b

regimes371.0ms

Accuracy

81.9% (1.5b remaining)

Error of 22.6b against oracle of 21.1b and baseline of 29.4b

bsearch5.0ms

end0.0ms

sample11.2s

Algorithm
intervals