Average Error: 31.4 → 6.9
Time: 1.1m
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 -0.06870261394782061:\\
\;\;\;\;\frac{1}{n \cdot x} - \left(\frac{\log x}{{n}^2 \cdot x} + \frac{1}{2} \cdot \frac{1}{n \cdot {x}^2}\right)\\
\mathbf{if}\;n \le 361619410.9503674:\\
\;\;\;\;{\left({\left(\sqrt[3]{\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)}^3\right)}^3\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x} - \left(\frac{\log x}{{n}^2 \cdot x} + \frac{1}{2} \cdot \frac{1}{n \cdot {x}^2}\right)\\
\end{array}\]
Derivation
- Split input into 2 regimes.
-
if n < -0.06870261394782061 or 361619410.9503674 < n
Initial program 44.4
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
Applied taylor 9.0
\[\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)\]
Taylor expanded around inf 9.0
\[\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)}\]
if -0.06870261394782061 < n < 361619410.9503674
Initial program 2.3
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
- Using strategy
rm
Applied add-cube-cbrt 2.3
\[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}\right)}^3}\]
- Using strategy
rm
Applied add-cube-cbrt 2.4
\[\leadsto {\color{blue}{\left({\left(\sqrt[3]{\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}}}\right)}^3\right)}}^3\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(2115778685 1105822334 741829391 2701590761 4045604641 1787403990)'
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
(- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))