- Split input into 2 regimes
if (- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1)))) < 1.26868933652928e-15
Initial program 40.3
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
- Using strategy
rm Applied add-sqr-sqrt50.0
\[\leadsto \frac{1}{\sqrt{x}} - \color{blue}{\sqrt{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1}}}}\]
Applied add-sqr-sqrt40.4
\[\leadsto \color{blue}{\sqrt{\frac{1}{\sqrt{x}}} \cdot \sqrt{\frac{1}{\sqrt{x}}}} - \sqrt{\frac{1}{\sqrt{x + 1}}} \cdot \sqrt{\frac{1}{\sqrt{x + 1}}}\]
Applied difference-of-squares40.4
\[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\sqrt{x}}} + \sqrt{\frac{1}{\sqrt{x + 1}}}\right) \cdot \left(\sqrt{\frac{1}{\sqrt{x}}} - \sqrt{\frac{1}{\sqrt{x + 1}}}\right)}\]
Taylor expanded around inf 22.0
\[\leadsto \color{blue}{\left(\frac{5}{16} \cdot \sqrt{\frac{1}{{x}^{7}}} + \frac{1}{2} \cdot \sqrt{\frac{1}{{x}^{3}}}\right) - \frac{3}{8} \cdot \sqrt{\frac{1}{{x}^{5}}}}\]
if 1.26868933652928e-15 < (- (/ 1 (sqrt x)) (/ 1 (sqrt (+ x 1))))
Initial program 0.7
\[\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}\]
- Using strategy
rm Applied pow1/20.7
\[\leadsto \frac{1}{\color{blue}{{x}^{\frac{1}{2}}}} - \frac{1}{\sqrt{x + 1}}\]
Applied pow-flip0.5
\[\leadsto \color{blue}{{x}^{\left(-\frac{1}{2}\right)}} - \frac{1}{\sqrt{x + 1}}\]
Simplified0.5
\[\leadsto {x}^{\color{blue}{\frac{-1}{2}}} - \frac{1}{\sqrt{x + 1}}\]
- Recombined 2 regimes into one program.
Final simplification10.9
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}} \le 1.26868933652928 \cdot 10^{-15}:\\
\;\;\;\;\left(\frac{1}{2} \cdot \sqrt{\frac{1}{{x}^{3}}} + \sqrt{\frac{1}{{x}^{7}}} \cdot \frac{5}{16}\right) - \sqrt{\frac{1}{{x}^{5}}} \cdot \frac{3}{8}\\
\mathbf{else}:\\
\;\;\;\;{x}^{\frac{-1}{2}} - \frac{1}{\sqrt{x + 1}}\\
\end{array}\]