- Split input into 3 regimes
if (+ (+ (/ 2 (pow x 7)) (/ 2 (pow x 5))) (* (* (/ (cbrt (/ 2 (* x x))) x) (cbrt (/ 2 (* x x)))) (cbrt (/ (/ 2 x) x)))) < -1.7995936082741617e-25
Initial program 0.7
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
- Using strategy
rm Applied frac-sub0.7
\[\leadsto \color{blue}{\frac{1 \cdot x - \left(x + 1\right) \cdot 2}{\left(x + 1\right) \cdot x}} + \frac{1}{x - 1}\]
Applied frac-add0.1
\[\leadsto \color{blue}{\frac{\left(1 \cdot x - \left(x + 1\right) \cdot 2\right) \cdot \left(x - 1\right) + \left(\left(x + 1\right) \cdot x\right) \cdot 1}{\left(\left(x + 1\right) \cdot x\right) \cdot \left(x - 1\right)}}\]
if -1.7995936082741617e-25 < (+ (+ (/ 2 (pow x 7)) (/ 2 (pow x 5))) (* (* (/ (cbrt (/ 2 (* x x))) x) (cbrt (/ 2 (* x x)))) (cbrt (/ (/ 2 x) x)))) < 1.0690408468969486e-70
Initial program 18.0
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
Taylor expanded around inf 0.5
\[\leadsto \color{blue}{2 \cdot \frac{1}{{x}^{3}} + \left(2 \cdot \frac{1}{{x}^{5}} + 2 \cdot \frac{1}{{x}^{7}}\right)}\]
Applied simplify0.1
\[\leadsto \color{blue}{\left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \frac{\frac{2}{x}}{x \cdot x}}\]
if 1.0690408468969486e-70 < (+ (+ (/ 2 (pow x 7)) (/ 2 (pow x 5))) (* (* (/ (cbrt (/ 2 (* x x))) x) (cbrt (/ 2 (* x x)))) (cbrt (/ (/ 2 x) x))))
Initial program 3.9
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
- Using strategy
rm Applied frac-sub3.9
\[\leadsto \color{blue}{\frac{1 \cdot x - \left(x + 1\right) \cdot 2}{\left(x + 1\right) \cdot x}} + \frac{1}{x - 1}\]
Applied simplify3.9
\[\leadsto \frac{\color{blue}{\left(x - 2\right) - x \cdot 2}}{\left(x + 1\right) \cdot x} + \frac{1}{x - 1}\]
- Recombined 3 regimes into one program.
Applied simplify1.1
\[\leadsto \color{blue}{\begin{array}{l}
\mathbf{if}\;\left(\sqrt[3]{\frac{2}{x \cdot x}} \cdot \frac{\sqrt[3]{\frac{2}{x \cdot x}}}{x}\right) \cdot \sqrt[3]{\frac{\frac{2}{x}}{x}} + \left(\frac{2}{{x}^{5}} + \frac{2}{{x}^{7}}\right) \le -1.7995936082741617 \cdot 10^{-25}:\\
\;\;\;\;\frac{\left(x - 1\right) \cdot \left(x - 2 \cdot \left(1 + x\right)\right) + x \cdot \left(1 + x\right)}{\left(x - 1\right) \cdot \left(x \cdot \left(1 + x\right)\right)}\\
\mathbf{if}\;\left(\sqrt[3]{\frac{2}{x \cdot x}} \cdot \frac{\sqrt[3]{\frac{2}{x \cdot x}}}{x}\right) \cdot \sqrt[3]{\frac{\frac{2}{x}}{x}} + \left(\frac{2}{{x}^{5}} + \frac{2}{{x}^{7}}\right) \le 1.0690408468969486 \cdot 10^{-70}:\\
\;\;\;\;\left(\frac{2}{{x}^{5}} + \frac{2}{{x}^{7}}\right) + \frac{\frac{2}{x}}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - 2\right) - x \cdot 2}{x \cdot \left(1 + x\right)} + \frac{1}{x - 1}\\
\end{array}}\]