Floating point approximations to two trigonometric functions

Question Q9.1.4

The functions $f(x) = (1-\cos^2x)/x^2$ and $g(x) = \sin^2x / x^2$ are mathematically indistinguishable, but plotted in the region $-0.001 \le x \le 0.001$ show a significant difference. Explain the origin of this difference.


To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to scipython.com providing this code.