Lecture 4
Controlling Error and Conditional
Statements
Measuring error
If we are trying to Fnd a numerical solution of an equation
f
(
x
) = 0, then there are a few di±erent
ways we can measure the error of our approximation. The most direct way to measure the error
would be as:
{
Error at step
n
}
=
e
n
=
x
n

x
*
where
x
n
is the
n
th approximation and
x
*
is the true value. However, we usually do not know the
value of
x
*
, or we wouldn’t be trying to approximate it. This makes it impossible to know the error
directly, and so we must be more clever.
²or Newton’s method we have the following principle:
At each step the number of signiFcant
digits roughly doubles.
While this is an important statement about the error (since it means
Newton’s method converges really quickly), it is somewhat hard to use in a program.
Rather than measure how close
x
n
is to
x
*
, in this and many other situations it is much more
practical to measure how close the equation is to being satisFed, in other words, how close
f
(
x
n
)
is to 0. We will use the quantity
r
n
=
f
(
x
n
)

0, called the
residual
, in many di±erent situations.
Most of the time we only care about the size of
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Young,T
 Numerical Analysis, Approximation, Control flow, Tol

Click to edit the document details