Average Error: 28.8 → 22.2
Time: 42.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 -1.6368545052736208 \cdot 10^{-05}:\\ \;\;\;\;\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}} + \sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}\right) \cdot \left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{elif}\;\frac{1}{n} \le 1.999681619764839 \cdot 10^{-33}:\\ \;\;\;\;\frac{\log x}{\left(x \cdot n\right) \cdot n} + \left(\frac{1}{x \cdot n} + \frac{\frac{\frac{-1}{2}}{x}}{x \cdot n}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\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)} \cdot \left(\sqrt[3]{\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\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)} \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) < -1.6368545052736208e-05

    1. Initial program 0.6

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

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{\sqrt{{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt{{x}^{\left(\frac{1}{n}\right)}}}\]
    4. Applied add-sqr-sqrt0.6

      \[\leadsto \color{blue}{\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} \cdot \sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt{{x}^{\left(\frac{1}{n}\right)}}\]
    5. Applied difference-of-squares0.6

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

    if -1.6368545052736208e-05 < (/ 1 n) < 1.999681619764839e-33

    1. Initial program 44.0

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

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

      \[\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 1.999681619764839e-33 < (/ 1 n)

    1. Initial program 28.6

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

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

      \[\leadsto \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]{\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)}}}}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt28.6

      \[\leadsto \left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}} \cdot \sqrt[3]{\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) \cdot \sqrt[3]{\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)}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification22.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \le -1.6368545052736208 \cdot 10^{-05}:\\ \;\;\;\;\left(\sqrt{{x}^{\left(\frac{1}{n}\right)}} + \sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}}\right) \cdot \left(\sqrt{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)}} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{elif}\;\frac{1}{n} \le 1.999681619764839 \cdot 10^{-33}:\\ \;\;\;\;\frac{\log x}{\left(x \cdot n\right) \cdot n} + \left(\frac{1}{x \cdot n} + \frac{\frac{\frac{-1}{2}}{x}}{x \cdot n}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\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)} \cdot \left(\sqrt[3]{\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\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)} \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 1042149663 
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))

Details

Time bar (total: 40.4s)Debug log

sample531.0ms

Algorithm
intervals
Results
634×(pre true 80)
170×(body nan 80)
151×(body real 80)
97×(body real 1280)
53×(body real 640)
40×(body real 320)
40×(body exit 10240)
26×(body nan 640)
19×(body nan 1280)
18×(body real 160)
13×(body nan 320)
(body nan 160)

simplify12.0ms

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

prune13.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 27.2b

localize65.0ms

Local error

Found 3 expressions with local error:

2.0b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
1.0b
(pow (+ x 1) (/ 1 n))
0.5b
(pow x (/ 1 n))

rewrite25.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
19.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
3.0ms
(pow (+ x 1) (/ 1 n))
1.0ms
(pow x (/ 1 n))

series531.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
310.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
117.0ms
(pow (+ x 1) (/ 1 n))
103.0ms
(pow x (/ 1 n))

simplify2.3s

Counts
28 → 53
Calls
28 calls:
Slowest
796.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
424.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
370.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))
326.0ms
(- (+ (* 1/2 (/ (pow (log (/ 1 x)) 2) (pow n 2))) 1) (/ (log (/ 1 x)) n))
137.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))))

prune898.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 19.4b

localize24.0ms

Local error

Found 4 expressions with local error:

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

rewrite61.0ms

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

series1.0s

Counts
4 → 12
Calls
4 calls:
Slowest
314.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
304.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
301.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
116.0ms
(pow (+ x 1) (/ 1 n))

simplify3.6s

Counts
39 → 74
Calls
39 calls:
Slowest
805.0ms
(- (+ (/ (log -1) n) (+ 1 (/ 1 (* x n)))) (/ (log (/ -1 x)) n))
423.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
423.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
419.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
381.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune1.6s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 19.4b

localize24.0ms

Local error

Found 4 expressions with local error:

2.0b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
2.0b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
2.0b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
2.0b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

rewrite79.0ms

Algorithm
rewrite-expression-head
Rules
20×add-sqr-sqrt
12×add-log-exp
12×*-un-lft-identity
difference-of-squares
distribute-lft-out--
flip--
add-cube-cbrt
add-exp-log
diff-log
add-cbrt-cube
flip3--
unpow-prod-down
sub-neg
pow1
Counts
4 → 60
Calls
4 calls:
Slowest
21.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
19.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
19.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
19.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

series1.2s

Counts
4 → 12
Calls
4 calls:
Slowest
308.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
306.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
302.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
300.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

simplify3.6s

Counts
36 → 72
Calls
36 calls:
Slowest
427.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
427.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
423.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
420.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
375.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune1.7s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 19.4b

localize28.0ms

Local error

Found 4 expressions with local error:

2.0b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
2.0b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
2.0b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
2.0b
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

rewrite79.0ms

Algorithm
rewrite-expression-head
Rules
20×add-sqr-sqrt
12×add-log-exp
12×*-un-lft-identity
difference-of-squares
distribute-lft-out--
flip--
add-cube-cbrt
add-exp-log
diff-log
add-cbrt-cube
flip3--
unpow-prod-down
sub-neg
pow1
Counts
4 → 60
Calls
4 calls:
Slowest
21.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
19.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
19.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
19.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

series1.2s

Counts
4 → 12
Calls
4 calls:
Slowest
307.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
303.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
302.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))
301.0ms
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n)))

simplify3.6s

Counts
36 → 72
Calls
36 calls:
Slowest
441.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
422.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
421.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
420.0ms
(- (+ (/ (log -1) (* x (pow n 2))) (/ 1 (* x n))) (+ (* 1/2 (/ 1 (* (pow x 2) n))) (/ (log (/ -1 x)) (* x (pow n 2)))))
375.0ms
(- (/ 1 (* x n)) (+ (/ (log (/ 1 x)) (* x (pow n 2))) (* 1/2 (/ 1 (* (pow x 2) n)))))

prune1.9s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 19.4b

regimes619.0ms

Accuracy

79.1% (1.7b remaining)

Error of 22.2b against oracle of 20.5b and baseline of 28.8b

bsearch12.0ms

end0.0ms

sample15.6s

Algorithm
intervals
Results
18782×(pre true 80)
5020×(body nan 80)
4846×(body real 80)
3164×(body real 1280)
1567×(body real 640)
1115×(body exit 10240)
862×(body real 320)
642×(body nan 1280)
583×(body nan 640)
430×(body real 160)
343×(body nan 320)
210×(body nan 160)