Average Error: 29.9 → 22.5
Time: 31.7s
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 -41.568062850527504 \lor \neg \left(\frac{1}{n} \le 1.875720127712346 \cdot 10^{-16}\right):\\ \;\;\;\;\sqrt[3]{\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)} \cdot \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)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{1}{n}}{x} + \frac{\frac{\frac{-1}{2}}{x}}{x \cdot n}\right) + \frac{\log x}{\left(x \cdot n\right) \cdot n}\\ \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 2 regimes
  2. if (/ 1 n) < -41.568062850527504 or 1.875720127712346e-16 < (/ 1 n)

    1. Initial program 10.0

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

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

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

      \[\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 -41.568062850527504 < (/ 1 n) < 1.875720127712346e-16

    1. Initial program 44.5

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

      \[\leadsto {\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    3. Taylor expanded around inf 32.3

      \[\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)}\]
    4. Simplified32.3

      \[\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)}\]
    5. Using strategy rm
    6. Applied associate-/r*31.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \le -41.568062850527504 \lor \neg \left(\frac{1}{n} \le 1.875720127712346 \cdot 10^{-16}\right):\\ \;\;\;\;\sqrt[3]{\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)} \cdot \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)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{1}{n}}{x} + \frac{\frac{\frac{-1}{2}}{x}}{x \cdot n}\right) + \frac{\log x}{\left(x \cdot n\right) \cdot n}\\ \end{array}\]

Reproduce

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

Details

Time bar (total: 15.1s)Debug log

start455.0ms

Algorithm
intervals

setup20.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 26.1b

localize48.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))

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
3 → 44
Calls

3 calls. Slowest were:

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

series289.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

172.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
62.0ms
(pow (+ 1 x) (/ 1 n))
55.0ms
(pow x (/ 1 n))

simplify1.8s

Counts
28 → 53
Calls

28 calls. Slowest were:

688.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
392.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
265.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune580.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 17.9b

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)))

rewrite16.0ms

Algorithm
rewrite-expression-head
Counts
4 → 66
Calls

4 calls. Slowest were:

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

series436.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

207.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
81.0ms
(pow (+ 1 x) (/ 1 n))
77.0ms
(pow (+ 1 x) (/ 1 n))
71.0ms
(pow (+ 1 x) (/ 1 n))

simplify2.7s

Counts
45 → 78
Calls

45 calls. Slowest were:

694.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))
575.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))

prune1.1s

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 17.9b

localize11.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)))

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 66
Calls

4 calls. Slowest were:

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

series460.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

210.0ms
(- (pow (+ 1 x) (/ 1 n)) (pow x (/ 1 n)))
95.0ms
(pow (+ 1 x) (/ 1 n))
83.0ms
(pow (+ 1 x) (/ 1 n))
72.0ms
(pow (+ 1 x) (/ 1 n))

simplify2.8s

Counts
45 → 78
Calls

45 calls. Slowest were:

654.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
613.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
601.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))

prune1.3s

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 17.9b

localize23.0ms

Local error

Found 4 expressions with local error:

1.5b
(+ (/ (/ -1/2 x) (* n x)) (/ 1 (* n x)))
1.0b
(/ 1 (* n x))
0.5b
(/ (log x) (* n (* n x)))
0.2b
(/ (/ -1/2 x) (* n x))

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 72
Calls

4 calls. Slowest were:

12.0ms
(+ (/ (/ -1/2 x) (* n x)) (/ 1 (* n x)))
7.0ms
(/ (log x) (* n (* n x)))
3.0ms
(/ (/ -1/2 x) (* n x))

series100.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

60.0ms
(/ (log x) (* n (* n x)))
20.0ms
(+ (/ (/ -1/2 x) (* n x)) (/ 1 (* n x)))
13.0ms
(/ (/ -1/2 x) (* n x))
7.0ms
(/ 1 (* n x))

simplify1.7s

Counts
46 → 84
Calls

46 calls. Slowest were:

518.0ms
(* -1 (/ (log (/ 1 x)) (* x (pow n 2))))
176.0ms
(- (/ 1 (* x n)) (* 1/2 (/ 1 (* (pow x 2) n))))
171.0ms
(- (/ 1 (* x n)) (* 1/2 (/ 1 (* (pow x 2) n))))

prune936.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 17.2b

regimes278.0ms

Accuracy

83.7% (1.5b remaining)

Error of 22.5b against oracle of 21.0b and baseline of 30.0b

bsearch9.0ms