Average Error: 29.6 → 23.3
Time: 27.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}\;n \le -2.2887113156536344 \cdot 10^{+34} \lor \neg \left(n \le 1898011495.8334541\right):\\ \;\;\;\;\left(\frac{1}{x \cdot n} + \frac{\frac{\frac{-1}{2}}{x}}{x \cdot n}\right) + \frac{\log x}{\left(x \cdot n\right) \cdot n}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\right) \cdot \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 2 regimes
  2. if n < -2.2887113156536344e+34 or 1898011495.8334541 < n

    1. Initial program 45.0

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

      \[\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)}\]
    3. Simplified33.2

      \[\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 -2.2887113156536344e+34 < n < 1898011495.8334541

    1. Initial program 11.5

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

      \[\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-cbrt-cube11.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \le -2.2887113156536344 \cdot 10^{+34} \lor \neg \left(n \le 1898011495.8334541\right):\\ \;\;\;\;\left(\frac{1}{x \cdot n} + \frac{\frac{\frac{-1}{2}}{x}}{x \cdot n}\right) + \frac{\log x}{\left(x \cdot n\right) \cdot n}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(\log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right) \cdot \log \left(e^{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)\right) \cdot \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 2019018 
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))

Details

Time bar (total: 26.9s)Debug log

sample430.0ms

Algorithm
intervals
Results
103.0ms85×body1280valid
65.0ms48×body640valid
59.0ms47×body10240exit
37.0ms31×body1280nan
32.0ms186×body80valid
25.0ms27×body640nan
24.0ms195×body80nan
20.0ms37×body320valid
7.0ms11×body320nan
5.0ms14×body160valid
5.0ms13×body160nan

simplify11.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
11.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

prune10.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 27.8b

localize29.0ms

Local error

Found 3 expressions with local error:

1.7b
(pow (+ x 1) (/ 1 n))
1.5b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
0.7b
(pow x (/ 1 n))

rewrite21.0ms

Algorithm
rewrite-expression-head
Rules
10×add-sqr-sqrt
*-un-lft-identity
pow-unpow
add-cube-cbrt
add-log-exp
add-exp-log
unpow-prod-down
pow1
add-cbrt-cube
difference-of-squares
div-inv
pow-to-exp
distribute-lft-out--
flip--
pow-exp
diff-log
flip3--
pow-pow
sub-neg
Counts
3 → 44
Calls
3 calls:
Slowest
16.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
3.0ms
(pow (+ x 1) (/ 1 n))
1.0ms
(pow x (/ 1 n))

series439.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
238.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
116.0ms
(pow (+ x 1) (/ 1 n))
85.0ms
(pow x (/ 1 n))

simplify1.8s

Counts
28 → 53
Calls
28 calls:
Slowest
578.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
570.0ms
(- (+ (* 1/2 (/ (pow (log (/ 1 x)) 2) (pow n 2))) 1) (/ (log (/ 1 x)) n))
283.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
198.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))
72.0ms
(- (+ (/ (log -1) n) (+ (* 1/2 (/ (pow (log -1) 2) (pow n 2))) (+ (* 1/2 (/ (pow (log (/ -1 x)) 2) (pow n 2))) 1))) (+ (/ (log (/ -1 x)) n) (/ (* (log (/ -1 x)) (log -1)) (pow n 2))))

prune620.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 20.3b

localize11.0ms

Local error

Found 4 expressions with local error:

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

rewrite32.0ms

Algorithm
rewrite-expression-head
Rules
17×add-sqr-sqrt
13×*-un-lft-identity
add-cube-cbrt
pow-unpow
log-pow
add-log-exp
exp-prod
pow1
add-exp-log
unpow-prod-down
log-prod
difference-of-squares
add-cbrt-cube
distribute-lft-out--
div-inv
exp-sum
sub-neg
pow-to-exp
flip--
pow-exp
rem-log-exp
diff-log
exp-diff
flip3--
pow-pow
log-div
Counts
4 → 65
Calls
4 calls:
Slowest
16.0ms
(log (exp (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))))
11.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
3.0ms
(pow (+ x 1) (/ 1 n))
1.0ms
(pow x (/ 1 n))

series560.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
205.0ms
(log (exp (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))))
201.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
88.0ms
(pow x (/ 1 n))
65.0ms
(pow (+ x 1) (/ 1 n))

simplify2.3s

Counts
44 → 77
Calls
44 calls:
Slowest
510.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
314.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
297.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
289.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))
270.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune846.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 20.3b

localize12.0ms

Local error

Found 4 expressions with local error:

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Rules
14×add-sqr-sqrt
12×*-un-lft-identity
12×pow-unpow
10×add-cube-cbrt
10×unpow-prod-down
add-exp-log
pow1
add-log-exp
add-cbrt-cube
div-inv
pow-exp
pow-pow
pow-to-exp
difference-of-squares
distribute-lft-out--
flip--
diff-log
flip3--
sub-neg
Counts
4 → 66
Calls
4 calls:
Slowest
8.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
2.0ms
(pow (+ x 1) (/ 1 n))
1.0ms
(pow (+ x 1) (/ 1 n))
1.0ms
(pow (+ x 1) (/ 1 n))

series430.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
214.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
76.0ms
(pow (+ x 1) (/ 1 n))
76.0ms
(pow (+ x 1) (/ 1 n))
64.0ms
(pow (+ x 1) (/ 1 n))

simplify2.5s

Counts
45 → 78
Calls
45 calls:
Slowest
576.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
562.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
523.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
311.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
236.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune1.2s

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 20.3b

localize14.0ms

Local error

Found 4 expressions with local error:

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

rewrite17.0ms

Algorithm
rewrite-expression-head
Rules
14×add-sqr-sqrt
12×*-un-lft-identity
12×pow-unpow
10×add-cube-cbrt
10×unpow-prod-down
add-exp-log
pow1
add-log-exp
add-cbrt-cube
div-inv
pow-exp
pow-pow
pow-to-exp
difference-of-squares
distribute-lft-out--
flip--
diff-log
flip3--
sub-neg
Counts
4 → 66
Calls
4 calls:
Slowest
11.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
2.0ms
(pow (+ x 1) (/ 1 n))
2.0ms
(pow (+ x 1) (/ 1 n))
1.0ms
(pow (+ x 1) (/ 1 n))

series412.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
178.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
83.0ms
(pow (+ x 1) (/ 1 n))
77.0ms
(pow (+ x 1) (/ 1 n))
75.0ms
(pow (+ x 1) (/ 1 n))

simplify2.6s

Counts
45 → 78
Calls
45 calls:
Slowest
622.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
556.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
509.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
310.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
248.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune1.2s

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 20.3b

regimes339.0ms

Accuracy

77.8% (1.8b remaining)

Error of 23.3b against oracle of 21.4b and baseline of 29.6b

bsearch480.0ms

end0.0ms

sample10.4s

Algorithm
intervals
Results
3.2s3116×body1280valid
1.7s1166×body10240exit
1.3s1624×body640valid
898.0ms5066×body80nan
802.0ms4758×body80valid
770.0ms656×body1280nan
568.0ms641×body640nan
465.0ms874×body320valid
225.0ms342×body320nan
161.0ms443×body160valid
59.0ms196×body160nan