#%config InlineBackend.figure_format = 'svg'
from pylab import *
Given a continuous function , find an such that . Such an is called a root of or a zero of . There could be many roots for a given function.
At a root, the positive and negative parts of cancel one another. So we have to be careful about roundoff errors and care must be taken to evaluate the function so as to avoid loss of significance errors.
Since we work with finite precision on the computer, we cannot expect to find an that makes the function exactly zero. At best, we hope to keep relative error under control. In this sense, zeros far from the origin cannot be computed with great absolute accuracy. Since the purpose is to solve some problem that anyway involves approximations, it is not necessary to exactly locate the root, and an approximation is sufficient.
3.1Examples¶
Root finding problems arise in many problems as an intermediate step.
3.2Bracketing the root in 1-D¶
There are no general methods to find the roots of an arbitrary function. The user must have some knowledge of where the root might possibly lie. It is hence useful to first find some small interval in which we expect the root to lie.
Around a root, the function takes both positive and negative values. The IVT can be used to find an interval containing the root.