Average Error: 32.2 → 23.4
Time: 10.9s
Precision: 64
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \le -35172.9164463997804:\\ \;\;\;\;\frac{1 \cdot \left(\frac{1}{n} - \frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}{x} + \frac{-0.5}{\log \left(e^{{x}^{2} \cdot n}\right)}\\ \mathbf{elif}\;n \le 2309.1261634880311:\\ \;\;\;\;\left({\left(\sqrt{x + 1}\right)}^{\left(\frac{1}{n}\right)} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left({\left(\sqrt{x + 1}\right)}^{\left(\frac{1}{n}\right)} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{1}{x \cdot n} + \frac{\log x}{x \cdot {n}^{2}}\right) + \frac{-0.5}{{x}^{2} \cdot n}\\ \end{array}\]
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\begin{array}{l}
\mathbf{if}\;n \le -35172.9164463997804:\\
\;\;\;\;\frac{1 \cdot \left(\frac{1}{n} - \frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}{x} + \frac{-0.5}{\log \left(e^{{x}^{2} \cdot n}\right)}\\

\mathbf{elif}\;n \le 2309.1261634880311:\\
\;\;\;\;\left({\left(\sqrt{x + 1}\right)}^{\left(\frac{1}{n}\right)} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left({\left(\sqrt{x + 1}\right)}^{\left(\frac{1}{n}\right)} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\frac{1}{x \cdot n} + \frac{\log x}{x \cdot {n}^{2}}\right) + \frac{-0.5}{{x}^{2} \cdot n}\\

\end{array}
double code(double x, double n) {
	return ((double) (((double) pow(((double) (x + 1.0)), ((double) (1.0 / n)))) - ((double) pow(x, ((double) (1.0 / n))))));
}
double code(double x, double n) {
	double VAR;
	if ((n <= -35172.91644639978)) {
		VAR = ((double) (((double) (((double) (1.0 * ((double) (((double) (1.0 / n)) - ((double) (((double) log(((double) (1.0 / x)))) / ((double) pow(n, 2.0)))))))) / x)) + ((double) (((double) -(0.5)) / ((double) log(((double) exp(((double) (((double) pow(x, 2.0)) * n))))))))));
	} else {
		double VAR_1;
		if ((n <= 2309.126163488031)) {
			VAR_1 = ((double) (((double) (((double) pow(((double) sqrt(((double) (x + 1.0)))), ((double) (1.0 / n)))) + ((double) sqrt(((double) pow(x, ((double) (1.0 / n)))))))) * ((double) (((double) pow(((double) sqrt(((double) (x + 1.0)))), ((double) (1.0 / n)))) - ((double) sqrt(((double) pow(x, ((double) (1.0 / n))))))))));
		} else {
			VAR_1 = ((double) (((double) (1.0 * ((double) (((double) (1.0 / ((double) (x * n)))) + ((double) (((double) log(x)) / ((double) (x * ((double) pow(n, 2.0)))))))))) + ((double) (((double) -(0.5)) / ((double) (((double) pow(x, 2.0)) * n))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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 n < -35172.91644639978

    1. Initial program 44.3

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

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

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \left(\frac{1}{n} - \frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right) + \frac{-0.5}{{x}^{2} \cdot n}}\]
    4. Using strategy rm
    5. Applied associate-*l/31.3

      \[\leadsto \color{blue}{\frac{1 \cdot \left(\frac{1}{n} - \frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}{x}} + \frac{-0.5}{{x}^{2} \cdot n}\]
    6. Using strategy rm
    7. Applied add-log-exp31.4

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

    if -35172.91644639978 < n < 2309.126163488031

    1. Initial program 2.0

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

      \[\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-sqrt2.0

      \[\leadsto {\color{blue}{\left(\sqrt{x + 1} \cdot \sqrt{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 unpow-prod-down2.0

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

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

    if 2309.126163488031 < n

    1. Initial program 44.5

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

      \[\leadsto \color{blue}{1 \cdot \frac{1}{x \cdot n} - \left(0.5 \cdot \frac{1}{{x}^{2} \cdot n} + 1 \cdot \frac{\log \left(\frac{1}{x}\right)}{x \cdot {n}^{2}}\right)}\]
    3. Simplified31.9

      \[\leadsto \color{blue}{\frac{1}{x} \cdot \left(\frac{1}{n} - \frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right) + \frac{-0.5}{{x}^{2} \cdot n}}\]
    4. Using strategy rm
    5. Applied associate-*l/31.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \le -35172.9164463997804:\\ \;\;\;\;\frac{1 \cdot \left(\frac{1}{n} - \frac{\log \left(\frac{1}{x}\right)}{{n}^{2}}\right)}{x} + \frac{-0.5}{\log \left(e^{{x}^{2} \cdot n}\right)}\\ \mathbf{elif}\;n \le 2309.1261634880311:\\ \;\;\;\;\left({\left(\sqrt{x + 1}\right)}^{\left(\frac{1}{n}\right)} + \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right) \cdot \left({\left(\sqrt{x + 1}\right)}^{\left(\frac{1}{n}\right)} - \sqrt{{x}^{\left(\frac{1}{n}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{1}{x \cdot n} + \frac{\log x}{x \cdot {n}^{2}}\right) + \frac{-0.5}{{x}^{2} \cdot n}\\ \end{array}\]

Reproduce

herbie shell --seed 2020121 
(FPCore (x n)
  :name "2nthrt (problem 3.4.6)"
  :precision binary64
  (- (pow (+ x 1) (/ 1 n)) (pow x (/ 1 n))))