V NUMERICAL METHODS
NEWTON--RAPHSON METHOD
NEWTON
Introduction
Equation of the type f(x)= 0 can be solved graphically by
plotting the curve y = f(x) and find its x-intercepts.
Numerical Methods Page 1
y
y = 0 at x = a, b or c
y = f(x)
i.e. x = a, b or c are
solutions for f(x) = 0
c
a b x
The accuracy of the solutions is limited by the scale of the
graph.
graph
A method which enables the roots to be calculated to any
desired accuracy is Newton-Raphson method or simply
Newton’s method.
Numerical Methods Page 2
If x1 is an approximate value for a real root x = a of the
equations
ti f( ) = 0,
f(x) 0 then
th a closer
l approximation
i ti x2 may be
b
obtained for this root using the formula.
y
f x1
x2 x1 y = f(x)
f x1
x
a x2 x1
Numerical Methods Page 3
The formula can be used repeatedly to find successively
closer
l approximations,
i ti x3, x4, etc.,
t to t the
th roott x = a.
f x2
x3 x2 y
f x2 y = f(x)
f x3
x4 x3
f x3
a x
x3 x2 x1
The formula can be applied repeatedly until the desired
accuracyy has been met.
Numerical Methods Page 4
In g
general the Newton’s method can be summarized as the
following equation
f xn
xn 1 xn
f xn
Newton s formula can generally be used for any
Newton’s
polynomial or non-polynomial function.
First approximations can be obtained by drawing the graph
or examining the function.
IIn general,
l the
th closer
l th first
the fi t approximations
i ti i to
is t the
th reall
root the sooner the terms x1, x2, x3, etc will converge to the
root
root.
Numerical Methods Page 5
Example 1
Show that the equation x3 - 3x - 3 = 0 has a root between x
= 2 and x = 3. Use Newton’s method to determine the root
correct to 4 significant figures.
( ) = x3 - 3x - 3
f(x)
f(2) = 23 - 3(2) - 3 =
f(3) = 33 - 3(3) - 3 =
It can be seen that f(2)
( ) and f(3)
( ) have opposite
pp changes
g
signs. In other words, f(x) = 0 for a certain value between x
= 2 and 3 and a root exists between x = 2 and x = 3.
Numerical Methods Page 6
( ) = x3 - 3x - 3
f(x)
f’(x) = 3x2 - 3
x 3 x1 3
3
f ( x1 )
x2 x1 x1 1
f ( x1 ) 3 x1 3
2
Choose x1 = 2.5,, then
x2 =
x3 =
x4 =
Numerical Methods Page 7
Example 2
Show that the equation x5 - 2x - 3 = 0 has a root between x =
1.4 and x = 1.6. Use Newton’s method to determine the root
correct to 4 significant figures.
f(x) = x5 - 2x - 3
f(1.4) 1 45 - 2(1.4)
f(1 4) = 1.4 2(1 4) - 3 =
f(1.6) = 1.65 - 2(1.6) - 3 =
It can be seen that f(1.4) and f(1.6) have opposite changes
signs. In other words, f(x) = 0 for a certain value between x =
1.4 and 1.6 and a root exists between x = 1.4 and x = 1.6.
Numerical Methods Page 8
( ) = x5 - 2x - 3
f(x)
f’(x) = 5x4 - 2
x 2 x1 3
5
f ( x1 )
x2 x1 x1 1
f ( x1 ) 5 x1 2
4
Choose x1 = 1.5,, then
x2 =
x3 =
x4 =
Numerical Methods Page 9
Example 3
Use Newton’s method to determine the root of the equation
cos x = 1.5 tan x correct to 4 decimal places using x1 = /4.
(Note: radian should be used for the argument of the
trigonometric function but not in degree)
Numerical Methods Page 10
Evaluation of Nk
The value of Nk can be found using the Newton’s method by
rearranging
i the
th number
b ini the
th form
f f( ) = 0.
f(x) 0
Let x = Nk
Then 1
x N
k
1
x N 0
k
Finally solve f(x) = 0 by Netwon’s method for
1
f ( x) x N
k
Numerical Methods Page 11
Example 4
3
Use Newton’s method to evaluate 19 correct to 5 decimal
places.
Numerical Methods Page 12
Example 5
1
Use Newton’s method to evaluate 2.8 correct to 5 decimal
places.
Numerical Methods Page 13
NUMERICAL INTEGRATION
Introduction
The area under a curve between limits x = a and x = b
can be given by the integral
y
b
Area ydx
a
a b x
Numerical Methods Page 14
In some cases, it is not possible to evaluate the integral by
direct mathematical integration.
Under such circumstances, we can estimate the numerical
value of the integral by
1.Dividing
g the required
q area in a number of strips.
p
2.Find the area of each strip.
3.Add the areas up.
Numerical Methods
There are several methods for doingg this numerical integration.
g In
our course, we are going to discuss the following two
Trapezium (or Trapezoidal) Rule
The Simpson’s
p Rule
Numerical Methods
Trapezoidal Rule
In this method, the area is divided into n vertical strips
of equal width w.
ba
w
n
xo= a x1 x2 x3 xn-1 xn = b
w w w w
Numerical Methods Page 17
Each vertical strip is treated as a trapezium to find the
approximate area.
For the third strip
A y2 y3
w
2
yn
yn-1
y3
yo y1 y2
xo= a x1 x2 x3 xn-1 xn = b
w w w w
Numerical Methods Page 18
The integral can be approximated by the sum of areas
of the strips.
ydx yo y1 y1 y2 y2 y3
b w w w
a 2 2 2
... yn 1 yn
w
2
yn
yn-1
y3
yo y1 y2
xo = a x1 x2 x3 xn-1 xn = b
w w w w
Numerical Methods Page 19
Hence
d yo 2 y1 2 y2 ... 2 yn1 yn
b w
a
ydx
2
The trapezoidal rule is hence
ba
yo 2 y1 2 y2 ... 2 yn 1 yn
b
a
ydx
2n
Numerical Methods Page 20
Example 6
3
Find 0
e x dx using trapezoidal rule by dividing the area
into 6 strips. Give your answer correct to 3 decimal places.
number of strips =
a= b=
w=
n xn yn m my n
0 1
1 2
2 2
3 2
4 2
5 2
6 1
total
Numerical Methods Page 21
Example 7
3
Find ln xdx
2
by dividing the area into 8 strips using
Trapezoidal rule.
Give your answer correct to 4 decimal places.
Numerical Methods Page 22
Example 8
5 x
Find 1 x3
dx by dividing the area into 8 strips using
Trapezoidal rule.
rule
Give your answer correct to 4 decimal places.
Numerical Methods Page 23
Example 9
2 l x
ln
Find 1
9 x2
dx by dividing the area into 8 strips using
Trapezoidal rule
rule.
Give your answer correct to 4 decimal places.
Numerical Methods Page 24
Example 10
4
Find 0
x 2 e x dx using Trapezoidal rule by dividing
the area into (a) 8 strips
(b) 10 strips
Give your answer correct to 4 decimal places.
Numerical Methods Page 25
Simpson
Simpson’s
s Rule
There is another method,
method called Simpson
Simpson’s s Rule,
Rule that can be
applied to find the numerical value of a definite integral by the
area
b
Area ydx
a
a b x
Numerical Methods Page 26
In this method, the area is divided into n vertical strips of
equal width w.
Note that : n must be an even number.
ba
w
n
xo = a x1 x2 x3 xn-1 xn = b
w w w w
Numerical Methods Page 27
Each two vertical strips are combined and treated under a
parabola to find the approximate area.
area
Parabola
A y2 4 y3 y4
w
3
yn-1 yn
y3 y4
yo y1 y2
xo = a x1 x2 x3 x4 xn-1 xn = b
w w w w w
Numerical Methods Page 28
The integral can be approximated by the sum of areas of the
strips.
strips
a ydx 3 yo 4 y1 y2 3 y2 4 y3 y4
b w w
... yn 2 4 yn 1 yn
w
3
yn-1 yn
y3 y
yo y1 y2 4
xo = a x1 x2 x3 x4 xn-1 xn = b
w w w w w
Numerical Methods Page 29
Hence
y yo 4 y1 2 y2 4 y3 ... 4 yn 1 yn
b w
a
ydx
3
The Simpson’s rule is hence
ba
yo 4 y1 2 y2 4 y3 ... 4 yn1 yn
b
a
ydx
3n
3n
Numerical Methods Page 30
Example 11
3
Find 0
e x dx using Simpson’s rule by dividing the area into 6
strips. Give your answer correct to 3 decimal places.
number of strips =
a= b=
w=
n xn yn m my n
0 1
1 4
2 2
3 4
4 2
5 4
6 1
total
Numerical Methods Page 31
Example 12
3
Find ln xdx
2
by dividing the area into 8 strips using
Simpson’s
Simpson s rule.
Give your answer correct to 4 decimal places.
Numerical Methods Page 32
Example 13
4
Fi d
Find 2
x ln
l x dx
d by
b dividing
di idi the
th area into
i t 8 strips
ti
using (a) Trapezoidal rule;
(b) Simpson’s rule.
Give your answer correct to 4 decimal places.
Numerical Methods Page 33
Comparison between Trapezoidal rule and Simpson’s
R l
Rule
IIn general,
l the
th result
lt obtained
bt i d by
b using
i the
th Simpson’s
Si ’ rule
l is
i
more accurate than that obtained by using the Trapezoidal
rule.
rule
Hence the Simpson
Simpson’ss rule is preferable if
accuracy is concerned.
Numerical Methods Page 34
Example
p 14
2
Find 0
e x dx using Simpson’s rule by dividing the area
into
(a) 6 strips
(b) 8 strips
(c) 10 strips.
Give your answer correct to 4 decimal places.
places
Numerical Methods Page 35
Accuracy of Answers Using Simpson’s Rule
It can be seen that the result obtained by using the
Simpson’s
Simpson s rule is more accurate if more strips are used.
used
A simple criteria for determining the accuracy of the result
is :
If an increase in the number of strips does not
involve a change in the answer to a degree of
y then we may
accuracy, y rely
y on the result to
that degree of accuracy.
Numerical Methods Page 36
For example, for the integral
2
0
e x dx
the following results are obtained when Simpson
Simpson’s
s rule is
used in previous example:
Number of strips Result
6 6 389
6.389
8 6.389
10 6.389
We can say that the result is 6.389 correct to 3
decimal places or 4 significant figures.
Numerical Methods Page 37