Average Error: 20.3 → 5.0
Time: 19.0s
Precision: 64
Internal Precision: 2368
$4 \cdot x + \frac{4 \cdot {x}^{2} + 2}{\sqrt{{x}^{2} + 1}}$
$\begin{array}{l} \mathbf{if}\;x \le -1.3131630713136956 \cdot 10^{+46}:\\ \;\;\;\;4 \cdot x + \left(\left(\frac{\frac{1}{2}}{{x}^{5}} - 4 \cdot x\right) - \frac{\frac{\frac{1}{2}}{x}}{x \cdot x}\right)\\ \mathbf{elif}\;x \le 71.59438483683662:\\ \;\;\;\;\frac{\sqrt[3]{\left(2 + x \cdot \left(4 \cdot x\right)\right) \cdot \left(\left(2 + x \cdot \left(4 \cdot x\right)\right) \cdot \left(2 + x \cdot \left(4 \cdot x\right)\right)\right)}}{\sqrt{x \cdot x + 1}} + 4 \cdot x\\ \mathbf{else}:\\ \;\;\;\;4 \cdot x + \left(\left(\frac{\frac{\frac{1}{2}}{x}}{x \cdot x} - \frac{\frac{1}{2}}{{x}^{5}}\right) + 4 \cdot x\right)\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if x < -1.3131630713136956e+46

1. Initial program 51.8

$4 \cdot x + \frac{4 \cdot {x}^{2} + 2}{\sqrt{{x}^{2} + 1}}$
2. Initial simplification51.8

$\leadsto 4 \cdot x + \frac{x \cdot \left(4 \cdot x\right) + 2}{\sqrt{x \cdot x + 1}}$
3. Taylor expanded around -inf 14.3

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

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

## if -1.3131630713136956e+46 < x < 71.59438483683662

1. Initial program 3.7

$4 \cdot x + \frac{4 \cdot {x}^{2} + 2}{\sqrt{{x}^{2} + 1}}$
2. Initial simplification3.7

$\leadsto 4 \cdot x + \frac{x \cdot \left(4 \cdot x\right) + 2}{\sqrt{x \cdot x + 1}}$
3. Using strategy rm

$\leadsto 4 \cdot x + \frac{\color{blue}{\sqrt[3]{\left(\left(x \cdot \left(4 \cdot x\right) + 2\right) \cdot \left(x \cdot \left(4 \cdot x\right) + 2\right)\right) \cdot \left(x \cdot \left(4 \cdot x\right) + 2\right)}}}{\sqrt{x \cdot x + 1}}$

## if 71.59438483683662 < x

1. Initial program 28.7

$4 \cdot x + \frac{4 \cdot {x}^{2} + 2}{\sqrt{{x}^{2} + 1}}$
2. Initial simplification28.7

$\leadsto 4 \cdot x + \frac{x \cdot \left(4 \cdot x\right) + 2}{\sqrt{x \cdot x + 1}}$
3. Taylor expanded around inf 0.0

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

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

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.3131630713136956 \cdot 10^{+46}:\\ \;\;\;\;4 \cdot x + \left(\left(\frac{\frac{1}{2}}{{x}^{5}} - 4 \cdot x\right) - \frac{\frac{\frac{1}{2}}{x}}{x \cdot x}\right)\\ \mathbf{elif}\;x \le 71.59438483683662:\\ \;\;\;\;\frac{\sqrt[3]{\left(2 + x \cdot \left(4 \cdot x\right)\right) \cdot \left(\left(2 + x \cdot \left(4 \cdot x\right)\right) \cdot \left(2 + x \cdot \left(4 \cdot x\right)\right)\right)}}{\sqrt{x \cdot x + 1}} + 4 \cdot x\\ \mathbf{else}:\\ \;\;\;\;4 \cdot x + \left(\left(\frac{\frac{\frac{1}{2}}{x}}{x \cdot x} - \frac{\frac{1}{2}}{{x}^{5}}\right) + 4 \cdot x\right)\\ \end{array}$

# Runtime

Time bar (total: 19.0s)Debug log

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