Average Error: 32.7 → 23.9
Time: 13.7s
Precision: 64
\[{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}\]
\[\begin{array}{l} \mathbf{if}\;n \le -45586875.4459134862:\\ \;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{{x}^{2} \cdot n}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\\ \mathbf{elif}\;n \le 2742253.5313715958:\\ \;\;\;\;\left(\sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}} \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}}\right) \cdot \sqrt[3]{{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 \cdot \frac{1}{x \cdot n} + 1 \cdot \frac{\log x}{x \cdot {n}^{2}}\right) - 0.5 \cdot \frac{1}{{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 -45586875.4459134862:\\
\;\;\;\;\frac{\frac{1}{n}}{x} - \left(\log \left(e^{\frac{0.5}{{x}^{2} \cdot n}}\right) - \frac{\log x \cdot 1}{x \cdot {n}^{2}}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\left(1 \cdot \frac{1}{x \cdot n} + 1 \cdot \frac{\log x}{x \cdot {n}^{2}}\right) - 0.5 \cdot \frac{1}{{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 <= -45586875.445913486)) {
		VAR = ((double) (((double) (((double) (1.0 / n)) / x)) - ((double) (((double) log(((double) exp(((double) (0.5 / ((double) (((double) pow(x, 2.0)) * n)))))))) - ((double) (((double) (((double) log(x)) * 1.0)) / ((double) (x * ((double) pow(n, 2.0))))))))));
	} else {
		double VAR_1;
		if ((n <= 2742253.531371596)) {
			VAR_1 = ((double) (((double) (((double) cbrt(((double) (((double) pow(((double) (x + 1.0)), ((double) (1.0 / n)))) - ((double) pow(((double) pow(x, ((double) (1.0 / ((double) (((double) cbrt(n)) * ((double) cbrt(n)))))))), ((double) (1.0 / ((double) cbrt(n)))))))))) * ((double) cbrt(((double) (((double) pow(((double) (x + 1.0)), ((double) (1.0 / n)))) - ((double) pow(((double) pow(x, ((double) (1.0 / ((double) (((double) cbrt(n)) * ((double) cbrt(n)))))))), ((double) (1.0 / ((double) cbrt(n)))))))))))) * ((double) cbrt(((double) (((double) pow(((double) (x + 1.0)), ((double) (1.0 / n)))) - ((double) pow(((double) pow(x, ((double) (1.0 / ((double) (((double) cbrt(n)) * ((double) cbrt(n)))))))), ((double) (1.0 / ((double) cbrt(n))))))))))));
		} else {
			VAR_1 = ((double) (((double) (((double) (1.0 * ((double) (1.0 / ((double) (x * n)))))) + ((double) (1.0 * ((double) (((double) log(x)) / ((double) (x * ((double) pow(n, 2.0)))))))))) - ((double) (0.5 * ((double) (1.0 / ((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 < -45586875.445913486

    1. Initial program 44.4

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

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

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

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

    if -45586875.445913486 < n < 2742253.531371596

    1. Initial program 3.0

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

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{\color{blue}{\left(\sqrt[3]{n} \cdot \sqrt[3]{n}\right) \cdot \sqrt[3]{n}}}\right)}\]
    4. Applied *-un-lft-identity3.1

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{\color{blue}{1 \cdot 1}}{\left(\sqrt[3]{n} \cdot \sqrt[3]{n}\right) \cdot \sqrt[3]{n}}\right)}\]
    5. Applied times-frac3.1

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\color{blue}{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}} \cdot \frac{1}{\sqrt[3]{n}}\right)}}\]
    6. Applied pow-unpow3.1

      \[\leadsto {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \color{blue}{{\left({x}^{\left(\frac{1}{\sqrt[3]{n} \cdot \sqrt[3]{n}}\right)}\right)}^{\left(\frac{1}{\sqrt[3]{n}}\right)}}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt3.1

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

    if 2742253.531371596 < n

    1. Initial program 45.1

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

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

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

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

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

Reproduce

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