Average Error: 32.9 → 24.1
Time: 1.9m
Precision: 64
Internal Precision: 1344
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;\frac{1}{n} \le -0.04724028872149798 \lor \neg \left(\frac{1}{n} \le 1.283013620914861 \cdot 10^{-19}\right):\\ \;\;\;\;e^{\frac{\log_* (1 + x)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log x}{x \cdot \left(n \cdot n\right)} + \left(\frac{\frac{1}{x}}{n} - \frac{\frac{\frac{1}{2}}{x}}{x \cdot n}\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 (/ 1 n) < -0.04724028872149798 or 1.283013620914861e-19 < (/ 1 n)

    1. Initial program 4.8

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

      \[\leadsto {\color{blue}{\left(e^{\log \left(x + 1\right)}\right)}}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    4. Applied pow-exp4.9

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

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

    if -0.04724028872149798 < (/ 1 n) < 1.283013620914861e-19

    1. Initial program 44.7

      \[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
    2. Taylor expanded around inf 33.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)}\]
    3. Simplified33.3

      \[\leadsto \color{blue}{(\left(\frac{1}{n \cdot x}\right) \cdot \left(-\frac{\frac{1}{2}}{x}\right) + \left(\frac{1}{n \cdot x}\right))_* + \frac{\frac{\log x}{n \cdot x}}{n}}\]
    4. Taylor expanded around 0 33.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{1}{n} \le -0.04724028872149798 \lor \neg \left(\frac{1}{n} \le 1.283013620914861 \cdot 10^{-19}\right):\\ \;\;\;\;e^{\frac{\log_* (1 + x)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log x}{x \cdot \left(n \cdot n\right)} + \left(\frac{\frac{1}{x}}{n} - \frac{\frac{\frac{1}{2}}{x}}{x \cdot n}\right)\\ \end{array}\]

Runtime

Time bar (total: 1.9m)Debug logProfile

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