Average Error: 30.9 → 1.3
Time: 1.3m
Precision: 64
Ground Truth: 128
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \le -31.329673016395393:\\ \;\;\;\;\left(\frac{\frac{1}{n}}{x} - \frac{\frac{\frac{1}{2}}{x}}{n \cdot x}\right) - \frac{\frac{\log x}{n \cdot n}}{x}\\ \mathbf{if}\;n \le 5667669302503732.0:\\ \;\;\;\;{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^3\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{1}{n}}{x} - \frac{\frac{\frac{1}{2}}{x}}{n \cdot x}\right) - \frac{\frac{\log x}{n \cdot n}}{x}\\ \end{array}\]

Error

Bits error versus x

Bits error versus n

Derivation

  1. Split input into 2 regimes.
  2. if n < -31.329673016395393 or 5667669302503732.0 < n

    1. Initial program 44.0

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

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

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

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

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

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

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

    if -31.329673016395393 < n < 5667669302503732.0

    1. Initial program 3.5

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

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

Runtime

Total time: 1.3m Debug log

Please include this information when filing a bug report:

herbie --seed '#(1317229083 385665165 927243142 4133899538 3082641653 3120456537)'
(FPCore (x n)
  :name "NMSE problem 3.4.6"
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))