Average Error: 29.9 → 18.7
Time: 38.3s
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 -1107.11790878709:\\ \;\;\;\;\frac{\frac{\frac{-1}{2}}{x}}{x \cdot n} + \left(\frac{\log x}{n \cdot \left(x \cdot n\right)} + \frac{\frac{1}{x}}{n}\right)\\ \mathbf{elif}\;n \le -2.3119635710276 \cdot 10^{-311}:\\ \;\;\;\;\sqrt[3]{\log \left(e^{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)} \cdot \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)\\ \mathbf{elif}\;n \le 12491945444.70525:\\ \;\;\;\;e^{\frac{\log_* (1 + x)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-1}{2}}{x}}{x \cdot n} + \left(\frac{\log x}{n \cdot \left(x \cdot n\right)} + \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 < -1107.11790878709 or 12491945444.70525 < n

    1. Initial program 44.7

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

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

      \[\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-exp44.7

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

      \[\leadsto e^{\color{blue}{\frac{\log_* (1 + x)}{n}}} - {x}^{\left(\frac{1}{n}\right)}\]
    7. 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)}\]
    8. Simplified31.4

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

    if -1107.11790878709 < n < -2.3119635710276e-311

    1. Initial program 0.4

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

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

      \[\leadsto \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)}}}\]
    5. Using strategy rm
    6. Applied add-log-exp0.7

      \[\leadsto \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]{\color{blue}{\log \left(e^{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}}\]

    if -2.3119635710276e-311 < n < 12491945444.70525

    1. Initial program 26.8

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

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

      \[\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-exp26.8

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

      \[\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.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \le -1107.11790878709:\\ \;\;\;\;\frac{\frac{\frac{-1}{2}}{x}}{x \cdot n} + \left(\frac{\log x}{n \cdot \left(x \cdot n\right)} + \frac{\frac{1}{x}}{n}\right)\\ \mathbf{elif}\;n \le -2.3119635710276 \cdot 10^{-311}:\\ \;\;\;\;\sqrt[3]{\log \left(e^{{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)} \cdot \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)\\ \mathbf{elif}\;n \le 12491945444.70525:\\ \;\;\;\;e^{\frac{\log_* (1 + x)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-1}{2}}{x}}{x \cdot n} + \left(\frac{\log x}{n \cdot \left(x \cdot n\right)} + \frac{\frac{1}{x}}{n}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2018362 +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: 22.4s)Debug log

start487.0ms

Algorithm
intervals

setup29.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 26.1b

localize37.0ms

Local error

Found 3 expressions with local error:

1.5b
(pow (+ 1 x) (/ 1 n))
1.0b
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
1.0b
(pow x (/ 1 n))

rewrite28.0ms

Algorithm
rewrite-expression-head
Counts
3 → 74
Calls

3 calls. Slowest were:

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

series378.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

219.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
90.0ms
(pow (+ 1 x) (/ 1 n))
69.0ms
(pow x (/ 1 n))

simplify2.7s

Counts
69 → 83
Calls

69 calls. Slowest were:

618.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
458.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))
410.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))

prune927.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 14.3b

localize20.0ms

Local error

Found 4 expressions with local error:

1.5b
(pow (+ 1 x) (/ 1 n))
1.5b
(pow (+ 1 x) (/ 1 n))
1.5b
(pow (+ 1 x) (/ 1 n))
1.0b
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))

rewrite33.0ms

Algorithm
rewrite-expression-head
Counts
4 → 98
Calls

4 calls. Slowest were:

21.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
4.0ms
(pow (+ 1 x) (/ 1 n))
3.0ms
(pow (+ 1 x) (/ 1 n))

series478.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

199.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
104.0ms
(pow (+ 1 x) (/ 1 n))
93.0ms
(pow (+ 1 x) (/ 1 n))
81.0ms
(pow (+ 1 x) (/ 1 n))

simplify3.9s

Counts
86 → 110
Calls

86 calls. Slowest were:

635.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
633.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
626.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))

prune1.6s

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 14.3b

localize23.0ms

Local error

Found 4 expressions with local error:

1.5b
(pow (+ 1 x) (/ 1 n))
1.5b
(pow (+ 1 x) (/ 1 n))
1.5b
(pow (+ 1 x) (/ 1 n))
1.0b
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
4 → 98
Calls

4 calls. Slowest were:

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

series507.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

234.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
100.0ms
(pow (+ 1 x) (/ 1 n))
98.0ms
(pow (+ 1 x) (/ 1 n))
74.0ms
(pow (+ 1 x) (/ 1 n))

simplify3.7s

Counts
86 → 110
Calls

86 calls. Slowest were:

623.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
560.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
488.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))

prune2.0s

Pruning

6 alts after pruning (5 fresh and 1 done)

Merged error: 14.3b

localize10.0ms

Local error

Found 3 expressions with local error:

1.0b
(- (exp (/ (log1p x) n)) (pow x (/ 1 n)))
1.0b
(pow x (/ 1 n))
0.1b
(/ (log1p x) n)

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
3 → 57
Calls

3 calls. Slowest were:

10.0ms
(- (exp (/ (log1p x) n)) (pow x (/ 1 n)))
2.0ms
(/ (log1p x) n)
1.0ms
(pow x (/ 1 n))

series334.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

207.0ms
(- (exp (/ (log1p x) n)) (pow x (/ 1 n)))
65.0ms
(/ (log1p x) n)
61.0ms
(pow x (/ 1 n))

simplify2.8s

Counts
39 → 66
Calls

39 calls. Slowest were:

473.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))
465.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
388.0ms
(- (+ (/ x n) (* 1/3 (/ (pow x 3) n))) (* 1/2 (/ (pow x 2) n)))

prune845.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 14.3b

regimes244.0ms

Accuracy

89.8% (1.3b remaining)

Error of 18.7b against oracle of 17.4b and baseline of 30.0b

bsearch1.3s