- Split input into 2 regimes
if (+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))) < -0.0005782638164504028 or 0.0 < (+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1)))
Initial program 0.8
\[\left(\frac{1}{x + 1} - \frac{2}{x}\right) + \frac{1}{x - 1}\]
- Using strategy
rm Applied frac-sub0.8
\[\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.5
\[\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 -0.0005782638164504028 < (+ (- (/ 1 (+ x 1)) (/ 2 x)) (/ 1 (- x 1))) < 0.0
Initial program 20.3
\[\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.2
\[\leadsto \color{blue}{\left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \frac{\frac{2}{x}}{x \cdot x}}\]
- Using strategy
rm Applied associate-/r*0.1
\[\leadsto \left(\frac{2}{{x}^{7}} + \frac{2}{{x}^{5}}\right) + \color{blue}{\frac{\frac{\frac{2}{x}}{x}}{x}}\]
- Recombined 2 regimes into one program.
Applied simplify0.3
\[\leadsto \color{blue}{\begin{array}{l}
\mathbf{if}\;\frac{1}{x - 1} + \left(\frac{1}{x + 1} - \frac{2}{x}\right) \le -0.0005782638164504028:\\
\;\;\;\;\frac{\left(x - 1\right) \cdot \left(x - \left(x + 1\right) \cdot 2\right) + \left(x + 1\right) \cdot x}{\left(\left(x + 1\right) \cdot x\right) \cdot \left(x - 1\right)}\\
\mathbf{if}\;\frac{1}{x - 1} + \left(\frac{1}{x + 1} - \frac{2}{x}\right) \le 0.0:\\
\;\;\;\;\left(\frac{2}{{x}^{5}} + \frac{2}{{x}^{7}}\right) + \frac{\frac{\frac{2}{x}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - 1\right) \cdot \left(x - \left(x + 1\right) \cdot 2\right) + \left(x + 1\right) \cdot x}{\left(\left(x + 1\right) \cdot x\right) \cdot \left(x - 1\right)}\\
\end{array}}\]