How do I ensure that my function below is well conditioned as $s$ approaches $\infty$? The problem I get is that for large $s$ the function returns an indeterminate form $\frac{0}{0}$. I would otherwise have expected the function to increase monotonically from 0 to 1 as $s$ approaches $\infty$.
\begin{align} f(s) = \frac{x_s^2+\sqrt{1-x_s^2}-1}{\sqrt{x_s^2(x_s(\sqrt{1-x_s^2}-1))^2+(x_s^2+\sqrt{1-x_s^2}-1)^2}} \end{align}
\begin{align} x_s = e^{-s} \end{align}
import numpy as np
def func(s):
xs = np.exp(-1*s)
num = xs**2+np.sqrt(1-xs**2)-1
den = np.sqrt(xs**2*(xs*(np.sqrt(1-xs**2)-1))**2+(xs**2+np.sqrt(1-xs**2)-1)**2)
return num/den
s = np.linspace(0,20, 1000)
plot(s, func(s))
(xs*(np.sqrt(1-xs**2)-1))**2
, but in the definition you instead have $(x\sqrt{1-x^2}-1)^2$. Which of these is supposed to be correct? $\endgroup$ – Kirill Sep 28 '14 at 23:16