Beruflich Dokumente
Kultur Dokumente
Lecture 1
Definition: Errors
One of the most important aspects
of numerical analysis is the error analysis.
Errors may occur at any stage of the
process of solving a problem.
By the error we mean the
difference between the true value and the
Types of Errors
Usually we come across the following types of errors in numerical
analysis:
i. Inherent Errors.
These are the errors involved in the statement of a problem. When the
problem is first presented to the numerical analysis it may contain
certain data or parameters.
ii.
Analytic Error.
These are the errors introduced due to transforming a physical or
mathematical problem into a computational problem.
where 1/3=0.333333.
where e=2.7182818.
where 0.99995
Ex+y=Ex+Ey
b. Subtraction Operations:
Ex-y=Ex-Ey
c. Multiplication Operations:
d. Deviation Operations:
where
and we must start with an initial interval [a, b],
where f (a) and f (b) have opposite signs, then
there exists c [a, b] which f (c) 0 .
Bisection Method
x
xu
Figure 1 At least one root exists between the two points if the
function is real, continuous, and changes sign.
xu
f(x)
xu
xu
x
xu
f x
Figure 4 If the function
changes sign between two points,
more than one root for the equation
may exist between
f x 0
the two points.
14
Step 1
Choose xl and xu as two guesses for the root such
that f(xl) f(xu) < 0, or in other words, f(x) changes
sign between xl and xu. This was demonstrated in
f(x)
Figure 1.
x
xu
Figure 1
Step 2
Estimate the root, xm of the equation f (x) = 0 as the
mid point between xl and xu as
f(x)
x xu
xm =
2
x
xm
xu
Figure 5 Estimate of xm
Step 3
Now check the following
a) If f xl f xm ,0then the root lies between x l and
xm; then xl = xl ; xu = xm.
f xl f xm 0
b) If
, then the root lies between x m and
xu; then xl = xm; xu = xu.
f xl f xm 0
c) If
; then the root is x m. Stop the
algorithm if this is true.
Step 4
old
x new
x
m
m
new
m
100
where
xmold previous estimate of root
xmnew current estimate of root
Step 5
Go to Step 2 using
new upper and lower
guesses.
No
Is a s ?
Example 1
You are working for DOWN THE TOILET COMPANY
that makes floats for ABC commodes. The floating
ball has a specific gravity of 0.6 and has a radius of
5.5 cm. You are asked to find the depth to which the
ball is submerged when floating in water.
Example 1 Cont.
The equation that gives the depth x to which the ball
is submerged under water is given by
x 3 0.165 x 2 3.993 10 4 0
Example 1 Cont.
0 x 2 0.055
0 x 0.11
Example 1 Cont.
Solution
To aid in the
understanding of how
this method works to find
the root of an equation,
the graph of f(x) is shown
to the right,
Example 1 Cont.
Let us assume
x 0.00
xu 0.11
Check if the function changes sign between xl
and xu .
3
2
4
Hence
Example 1 Cont.
Example 1 Cont.
Iteration 1
The estimate of the root isxm
x xu 0 0.11
0.055
2
2
Example 1 Cont.
Example 1 Cont.
Iteration 2
xm
The estimate of the root is
x xu 0.055 0.11
0.0825
2
2
Example 1 Cont.
Example 1 Cont.
at the end of
xmnew xmold
a
100
new
xm
0.0825 0.055
100
0.0825
33.333%
Example 1 Cont.
x xu 0.055 0.0825
0.06875
2
2
Iteration 3
The estimate of the root xism
Example 1 Cont.
Example 1 Cont.
The absolute relative approximate error
a
Iteration 3 is
at the end of
xmnew xmold
a
100
new
xm
0.06875 0.0825
100
0.06875
20%
Still none of the significant digits are at least correct in the
estimated root of the equation as the absolute relative
approximate error is greater than 5%.
Seven more iterations were conducted and these iterations are
shown in Table 1.
Table 1 Cont.
Table 1 Root of f(x)=0 as function of number of iterations for
bisection method.
Table 1 Cont.
Hence the number of significant digits at least correct is given
by the largest value or m for which
a 0.5 10 2 m
0.1721 0.5 10 2 m
0.3442 10 2 m
log 0.3442 2 m
So
m2
Advantages
Always convergent
The root bracket gets halved with each
iteration - guaranteed.
Drawbacks
Slow convergence
If one of the initial guesses is close to
the root, the convergence is slower
Drawbacks (continued)
f x x
x
Drawbacks (continued)
1
f x
x
x
Regula-Falsi Method
Regula-Falsi Method
Type of Algorithm (Equation Solver)
The Regula-Falsi Method (sometimes called the False Position Method) is a
method used to find a numerical estimate of an equation.
This method attempts to solve an equation of the form f(x)=0. (This is very
common in most numerical analysis applications.) Any equation can be written in
this form.
Algorithm Requirements
This algorithm requires a function f(x) and two points a and b for which f(x) is
positive for one of the values and negative for the other. We can write this
condition as f(a)f(b)<0.
If the function f(x) is continuous on the interval [a,b] with f(a)f(b)<0, the algorithm
will eventually converge to a solution.
This algorithm can not be implemented to find a tangential root. That is a root
that is tangent to the x-axis and either positive or negative on both side of the root.
For example f(x)=(x-3)2, has a tangential root at x=3.
Regula-Falsi Algorithm
The idea for the Regula-Falsi method is to connect the points (a,f(a)) and (b,f(b))
with a straight line.
Since linear equations are the simplest equations to solve for find the regulafalsi point (xrfp) which is the solution to the linear equation connecting the
endpoints.
Look at the sign of f(xrfp):
If sign(f(xrfp)) = 0
equation of line:
y f (a)
f (b) f (a )
x a
ba
f (b) f (a )
xrfp a
ba
f ( a ) b a
xrfp a
f (b) f (a )
f ( a ) b a
xrfp a
f (b) f (a )
0 f (a)
x-axis
actual root
Example
Lets look for a solution to the equation x3-2x-3=0.
We consider the function f(x)=x3-2x-3
On the interval [0,2] the function is negative at 0 and positive at 2. This means
that a=0 and b=2 (i.e. f(0)f(2)=(-3)(1)=-3<0, this means we can apply the
algorithm).
xrfp
f ( 0) 2 0
3(2)
6 3
0
f ( 2) f ( 0)
1 3
4
2
3 21
f ( xrfp ) f
8
2
xrfp
3 f 32 2 32 3 821 12 3 21 54
3
21
2 f ( 2) f 2 2 1 8
2 58 29
54
f ( xrfp ) f
0.267785
29
Stopping Conditions
Aside from lucking out and actually hitting the root, the stopping condition is
usually fixed to be a certain number of iterations or for the Standard Cauchy Error
in computing the Regula-Falsi Point (xrfp) to not change more than a prescribed
amount (usually denoted ).
1
2
3
4
5
x3 4x 1 0
where 0.001
e x 3x 0
x cos( x) 0
x tan( x) 1
f ( x) log( x) x 5