Average Error: 43.6 → 12.4
Time: 31.1s
Precision: 64
Internal Precision: 2368
$\frac{1 - {\left(1 + x\right)}^{\left(-n\right)}}{x}$
$\begin{array}{l} \mathbf{if}\;x \le -4.4976252341662096 \cdot 10^{-11} \lor \neg \left(x \le 1.6080273876425427 \cdot 10^{-15}\right):\\ \;\;\;\;\frac{1 - {\left({\left(1 + x\right)}^{\left(-n\right)}\right)}^{3}}{x \cdot \left(\left({\left(1 + x\right)}^{\left(-n\right)} \cdot {\left(1 + x\right)}^{\left(-n\right)} + {\left(1 + x\right)}^{\left(-n\right)}\right) + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\left(\frac{1}{3} \cdot x - \frac{1}{2}\right) \cdot \left(n \cdot x\right)}\right) + n\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if x < -4.4976252341662096e-11 or 1.6080273876425427e-15 < x

1. Initial program 16.4

$\frac{1 - {\left(1 + x\right)}^{\left(-n\right)}}{x}$
2. Initial simplification16.4

$\leadsto \frac{1 - {\left(x + 1\right)}^{\left(-n\right)}}{x}$
3. Using strategy rm
4. Applied flip3--16.5

$\leadsto \frac{\color{blue}{\frac{{1}^{3} - {\left({\left(x + 1\right)}^{\left(-n\right)}\right)}^{3}}{1 \cdot 1 + \left({\left(x + 1\right)}^{\left(-n\right)} \cdot {\left(x + 1\right)}^{\left(-n\right)} + 1 \cdot {\left(x + 1\right)}^{\left(-n\right)}\right)}}}{x}$
5. Applied associate-/l/16.5

$\leadsto \color{blue}{\frac{{1}^{3} - {\left({\left(x + 1\right)}^{\left(-n\right)}\right)}^{3}}{x \cdot \left(1 \cdot 1 + \left({\left(x + 1\right)}^{\left(-n\right)} \cdot {\left(x + 1\right)}^{\left(-n\right)} + 1 \cdot {\left(x + 1\right)}^{\left(-n\right)}\right)\right)}}$
6. Simplified16.5

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

## if -4.4976252341662096e-11 < x < 1.6080273876425427e-15

1. Initial program 61.1

$\frac{1 - {\left(1 + x\right)}^{\left(-n\right)}}{x}$
2. Initial simplification61.1

$\leadsto \frac{1 - {\left(x + 1\right)}^{\left(-n\right)}}{x}$
3. Taylor expanded around 0 9.3

$\leadsto \color{blue}{\left(n + \frac{1}{3} \cdot \left(n \cdot {x}^{2}\right)\right) - \frac{1}{2} \cdot \left(n \cdot x\right)}$
4. Simplified9.3

$\leadsto \color{blue}{\left(\frac{1}{3} \cdot x - \frac{1}{2}\right) \cdot \left(n \cdot x\right) + n}$
5. Using strategy rm

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

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.4976252341662096 \cdot 10^{-11} \lor \neg \left(x \le 1.6080273876425427 \cdot 10^{-15}\right):\\ \;\;\;\;\frac{1 - {\left({\left(1 + x\right)}^{\left(-n\right)}\right)}^{3}}{x \cdot \left(\left({\left(1 + x\right)}^{\left(-n\right)} \cdot {\left(1 + x\right)}^{\left(-n\right)} + {\left(1 + x\right)}^{\left(-n\right)}\right) + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{\left(\frac{1}{3} \cdot x - \frac{1}{2}\right) \cdot \left(n \cdot x\right)}\right) + n\\ \end{array}$

# Runtime

Time bar (total: 31.1s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (x n)
:name "(1-(1+x)^-n)/x"
(/ (- 1 (pow (+ 1 x) (- n))) x))