When are graphs deceiving?

Solution 1:

Try the function $$ f(x) = x^2e^{2x}\left(\log(e^x+1/x)-\sqrt{x^2+2e^{-x}}\right). $$ Playing with Taylor series shows that $\lim_{x\to\infty}f(x)=-\frac12$, but plotting the function for $x\in[1,50]$ is hopeless. See how Wolfram|Alpha plots it. The reason is that you need to numerically calculate the difference of two very large but nearly equal numbers and then multiply the difference by a huge number. Plotting on a suitable interval (depending on software) makes convergence to $-\frac12$ plausible, but I could not convince myself that a limit should exist by looking at the good part of the plot.

To derive the limit, you need the second order Taylor polynomial of $\log(1+t)$ and the first order one of $\sqrt{1+s}$ (with $t=e^{-x}/x$ and $s=2e^{-x}/x^2$) and estimates for the errors. The "first order expansions" of $\log(e^x+1/x)$ and $\sqrt{x^2+2e^{-x}}$ agree for large $x$, which correctly suggests that calculating the difference numerically is very unstable.

If you want to study functions near zero, try plotting $f(1/x)$ or $f(1/x^2)$ instead.

Solution 2:

Almost any example of catastrophic cancellation plus enough zoom will do the trick. Two cases:

A simplification of your example (simpler function, bigger zoom):

$$\frac{(1-\cos(x^2))}{x^4},\qquad x\in[-0.001,0.001]$$ enter image description here

A rational function with a removable discontinuity: $$\frac{x^{50}-1}{x-1},\qquad x\in[0.999999999,1.000000001]$$ enter image description here

Solution 3:

A classical example is $$\lim_{x \to 0} x^2 \sin\left(\frac{1}{x}\right)$$