Average Error: 23.5 → 8.8
Time: 38.7s
Precision: 64
Internal precision: 1408
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \le -0.07976354662987911:\\ \;\;\;\;\left(\frac{\frac{1}{n}}{x} - \log \left(e^{\frac{\frac{\frac{1}{2}}{n}}{{x}^2}}\right)\right) + \frac{\log x}{n \cdot \left(n \cdot x\right)}\\ \mathbf{if}\;n \le 83871.435384827:\\ \;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{1}{n}}{x} - \log \left(e^{\frac{\frac{\frac{1}{2}}{n}}{{x}^2}}\right)\right) + \frac{\log x}{n \cdot \left(n \cdot x\right)}\\ \end{array}\]

Error

Bits error versus x

Bits error versus n

Derivation

  1. Split input into 2 regimes.
  2. if n < -0.07976354662987911 or 83871.435384827 < n

    1. Initial program 37.1

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Applied taylor 2.5

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

      \[\leadsto \color{blue}{\frac{1}{n \cdot x} - \left(\frac{\log x}{{n}^2 \cdot x} + \frac{1}{2} \cdot \frac{1}{n \cdot {x}^2}\right)}\]
    4. Applied simplify 2.5

      \[\leadsto \color{blue}{\frac{1}{x \cdot n} - \left(\frac{\frac{\frac{1}{2}}{x}}{x \cdot n} + \frac{\frac{\log x}{x}}{{n}^2}\right)}\]
    5. Applied taylor 1.3

      \[\leadsto \frac{1}{x \cdot n} - \left(\frac{1}{2} \cdot \frac{1}{n \cdot {x}^2} - \frac{\log x}{{n}^2 \cdot x}\right)\]
    6. Taylor expanded around inf 1.3

      \[\leadsto \frac{1}{x \cdot n} - \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{n \cdot {x}^2} - \frac{\log x}{{n}^2 \cdot x}\right)}\]
    7. Applied simplify 0.2

      \[\leadsto \color{blue}{\left(\frac{\frac{1}{n}}{x} - \frac{\frac{\frac{1}{2}}{n}}{{x}^2}\right) + \frac{\log x}{n \cdot \left(n \cdot x\right)}}\]
    8. Using strategy rm
    9. Applied add-log-exp 13.1

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

    if -0.07976354662987911 < n < 83871.435384827

    1. Initial program 1.9

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 38.7s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1064875752 1442698706 3150723005 1316518582 2592983078 3835530843)'
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))