Average Error: 28.9 → 18.8
Time: 48.2s
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}\;n \le -8170750499256.65:\\ \;\;\;\;\frac{\frac{\log x}{n \cdot n}}{x} + \left(\frac{\frac{\frac{-1}{2}}{x}}{x \cdot n} + \frac{\frac{1}{x}}{n}\right)\\ \mathbf{elif}\;n \le -3.2441857736692268 \cdot 10^{-304}:\\ \;\;\;\;\sqrt[3]{\left(\sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left(\sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)} \cdot \left(\log \left(e^{\sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right) \cdot \sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{elif}\;n \le 28497336.429138504:\\ \;\;\;\;e^{\frac{\log_* (1 + x)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\log x}{n \cdot n}}{x} + \left(\frac{\frac{\frac{-1}{2}}{x}}{x \cdot n} + \frac{\frac{1}{x}}{n}\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 n < -8170750499256.65 or 28497336.429138504 < n

    1. Initial program 44.8

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Initial simplification44.8

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

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

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

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

    if -8170750499256.65 < n < -3.2441857736692268e-304

    1. Initial program 1.6

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Initial simplification1.6

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

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

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

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

      \[\leadsto \color{blue}{\sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \log \left(e^{\sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt1.8

      \[\leadsto \sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt{{x}^{\left(\frac{1}{n}\right)}}}} \cdot \log \left(e^{\sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)\]
    11. Applied add-sqr-sqrt1.8

      \[\leadsto \sqrt[3]{\color{blue}{\sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}} \cdot \sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt{{x}^{\left(\frac{1}{n}\right)}}} \cdot \log \left(e^{\sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)\]
    12. Applied difference-of-squares1.8

      \[\leadsto \sqrt[3]{\color{blue}{\left(\sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left(\sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)}} \cdot \log \left(e^{\sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)\]
    13. Using strategy rm
    14. Applied add-log-exp1.8

      \[\leadsto \sqrt[3]{\left(\sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left(\sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)} \cdot \log \left(e^{\color{blue}{\log \left(e^{\sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)} \cdot \sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)\]
    15. Applied exp-to-pow1.8

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

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

    if -3.2441857736692268e-304 < n < 28497336.429138504

    1. Initial program 23.2

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Initial simplification23.2

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \le -8170750499256.65:\\ \;\;\;\;\frac{\frac{\log x}{n \cdot n}}{x} + \left(\frac{\frac{\frac{-1}{2}}{x}}{x \cdot n} + \frac{\frac{1}{x}}{n}\right)\\ \mathbf{elif}\;n \le -3.2441857736692268 \cdot 10^{-304}:\\ \;\;\;\;\sqrt[3]{\left(\sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left(\sqrt{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)} \cdot \left(\log \left(e^{\sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right) \cdot \sqrt[3]{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{elif}\;n \le 28497336.429138504:\\ \;\;\;\;e^{\frac{\log_* (1 + x)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\log x}{n \cdot n}}{x} + \left(\frac{\frac{\frac{-1}{2}}{x}}{x \cdot n} + \frac{\frac{1}{x}}{n}\right)\\ \end{array}\]

Reproduce

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

Details

Time bar (total: 32.3s)Debug log

start344.0ms

Algorithm
intervals

setup59.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 28.8b

localize18.0ms

Local error

Found 2 expressions with local error:

1.7b
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
0.5b
(pow (+ 1 x) (/ 1 n))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
2 → 60
Calls

2 calls. Slowest were:

25.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
3.0ms
(pow (+ 1 x) (/ 1 n))

series269.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

196.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
73.0ms
(pow (+ 1 x) (/ 1 n))

simplify1.8s

Counts
62 → 66
Calls

62 calls. Slowest were:

512.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
269.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
183.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune775.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 18.5b

localize5.0ms

Local error

Found 3 expressions with local error:

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

rewrite49.0ms

Algorithm
rewrite-expression-head
Counts
3 → 101
Calls

3 calls. Slowest were:

33.0ms
(log (exp (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))))
10.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
3.0ms
(pow (+ 1 x) (/ 1 n))

series509.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

232.0ms
(log (exp (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))))
198.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
79.0ms
(pow (+ 1 x) (/ 1 n))

simplify4.1s

Counts
96 → 110
Calls

96 calls. Slowest were:

592.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
394.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
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)))))

prune1.7s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 18.5b

localize28.0ms

Local error

Found 4 expressions with local error:

1.7b
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
1.7b
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
1.7b
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
1.4b
(log (exp (* (cbrt (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))) (cbrt (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))))))

rewrite68.0ms

Algorithm
rewrite-expression-head
Counts
4 → 139
Calls

4 calls. Slowest were:

24.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
20.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
19.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))

series1.0s

Counts
4 → 12
Calls

4 calls. Slowest were:

473.0ms
(log (exp (* (cbrt (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))) (cbrt (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))))))
209.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
169.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
153.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))

simplify4.8s

Counts
159 → 151
Calls

159 calls. Slowest were:

355.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
298.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
290.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))

prune2.8s

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 18.4b

localize20.0ms

Local error

Found 4 expressions with local error:

1.7b
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
1.7b
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
1.5b
(- (sqrt (pow (+ 1 x) (/ 1 n))) (sqrt (pow x (/ 1 n))))
1.4b
(log (exp (* (cbrt (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))) (cbrt (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))))))

rewrite45.0ms

Algorithm
rewrite-expression-head
Counts
4 → 183
Calls

4 calls. Slowest were:

15.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
13.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
12.0ms
(- (sqrt (pow (+ 1 x) (/ 1 n))) (sqrt (pow x (/ 1 n))))

series1.1s

Counts
4 → 12
Calls

4 calls. Slowest were:

462.0ms
(log (exp (* (cbrt (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))) (cbrt (- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))))))
249.0ms
(- (sqrt (pow (+ 1 x) (/ 1 n))) (sqrt (pow x (/ 1 n))))
220.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
172.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))

simplify7.2s

Counts
244 → 195
Calls

244 calls. Slowest were:

732.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))))))
358.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
292.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))

prune4.6s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 18.4b

regimes597.0ms

Accuracy

88.1% (1.4b remaining)

Error of 18.8b against oracle of 17.4b and baseline of 29.0b

bsearch341.0ms