The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.

Ch3 Lecture Note _ Tutorial_Numerical Method 2021_2022

Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by bm-2219, 2022-02-06 21:09:02

Chapter 3: Numerical Method

Ch3 Lecture Note _ Tutorial_Numerical Method 2021_2022

Lecture Note: 1 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

Topic: 3. NUMERICAL METHOD

Sub-Topic: 3.1 Solutions of Non-Linear Equations
3.2 Newton-Raphson Method.

Learning Outcomes: At the end of the lesson, students should be able to
(a) locate approximately a root of an equation, by graphical considerations or searching for a

sign change.

*Find initial value of x0.
(a) find the root by the Newton-Raphson method.

*Use the formula xn1  xn  f xn  , n  1, 2, 3,
f  xn 

Introduction

 Many equations cannot be solved exactly, but various methods of finding approximate
numerical solutions exist.

For example: x3  ex  0.
 Two main parts:

Finding an initial approximate Improve the value by an
initial value, x0 iterative process, x1,x2, x3,

Initial Value

 The initial value of the roots of f x  0 can be located approximately by

(a) Graphical Consideration (Graphical method)
(b) Intermediate Value Theorem (Algebraic method)

*Searching for a sign change.

1 of 24

Lecture Note: 1 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

Graphical Method

 Sketch the graph of y  f x.

 The real root is the point, say x  , where the graph cuts the x-axis.

or

 Rewrite f x  0 in the form F x  Gx.
 Sketch the graphs of y  F x and y  Gx.

 The real root is the x-coordinate of the points where the graphs intersect, say x  .

2 of 24

Lecture Note: 1 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

EXAMPLE 1
Show, by drawing graphs, that the equation ex  5  0 has only one real root. Find the unit
interval where the root lies.

Let f x  ex  5,

The graph cut x-axis at a single point, therefore the equation has only one root.

From the graph, the root lies in the interval 1,2.

EXAMPLE 2
Draw the graphs of y  2 ln x and y  x on the same axes. Hence, find the unit interval where

2
the root of the equation 4 ln x  x  0 lies.

2 ln x  x  0
2

4ln x x  0

 the root of the equation 4 ln x  x  0 lies in the unit interval 1,2

3 of 24

Lecture Note: 1 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

Algebraic Method

 By trial and error, find two values a and b such that f a and f b have different signs, i.e.,

f a  0 and f b  0 or f a  0 and f b  0

 Then the root of f x  0 lies in the interval a,b.

EXAMPLE 3
Find algebraically, the unit interval where the root of the equation with function

f x  x3  4x  5 lies.
f 1  13  41  5  8 < 0
f 2  23  42  5  5 < 0
f 3  33  43  5  10 > 0
 Change of signs the root lies in the unit interval 2,3.

EXAMPLE 4

Show that the equation cos x  x  0.5  0 has a root lying in the interval 0,1.
Let f x  cos x  x  0.5,
f 0  cos0  0  0.5  0.5 > 0
f 1  cos1  1  0.5  0.960 < 0
 Change of signs the root lies in the unit interval 0,1.

4 of 24

Lecture Note: 1 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

EXAMPLE 5

Show algebraically, that the root of the equation 2x  x3 lies in the interval 1.3,1.4.

2x  x3  0

Let f x  2x  x3,

f 1.3  21.3  1.33  0.265  0
f 1.4  21.4  1.43  0.105  0

 Change of signs the root of the equation lies on 1.3,1.4.

Newton-Raphson Method

 The Newton-Raphson method is to obtain a better approximation to the root of f x  0.

 If x1 is an approximation to the root  of the equation f x  0, then the better

approximation x2 is given by

x2  x1  f x1 
f  x1 

 Repeat this process as required by using

xn1  xn  f xn  , n  1, 2, 3,
f  xn 

x

EXAMPLE 6
Use Newton-Raphson method to solve the equation x  ex  0 correct to three decimal places
with initial value x0  0.5.

Let f x  x  ex, then f x  1  ex,

x0  0.5

x1  0.5  0.5  e0.5  0.5663
1  e0.5

x2  0.5663  0.5663  e0.5663  0.5671
1  e0.5663

x3  0.5671  0.5671  e0.5671  0.5671
1  e0.5671

 x  0.567

5 of 24

Lecture Note: 1 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

EXAMPLE 7
Show that the equations 2 sin x  x  0 has a root between x  1 rad and x  2 rad. Find the
root of the equation by using Newton-Raphson method, correct to two decimal places.

Let f x  2 sin x  x, then f x  2 cos x  1,

f 1  2 sin1  1  0.683  0

 Change of signs

f 2  2 sin2  2  0.181  0

 the equation 2 sin x  x  0 has a root between x  1 rad and x  2 rad.

x1  1.5

x2  1.5  2 sin1.5  1.5  2.077
2 cos1.5  1

x3  2.077  2 sin2.077  2.077  1.911
2 cos2.077  1

x4  1.911  2 sin1.911  1.911  1.896
2 cos1.911  1

x5  1.895

 x  1.90

EXAMPLE 8
Show that the equation 2x ln x  5  0 has a root that lies between 2 and 3. Use the Newton-
Raphson method to find the root of 2x ln x  5  0 correct to three decimal places by using 2.5
as the first approximation.

Let f x  2x ln x  5,

f 2  22ln2  5  2.227  0  Change of signs

f 3  23ln3  5  1.592  0

 the equation 2x ln x  5  0 has a root between 2 and 3. u  2x v  ln x

f x  2  2 ln x,

x0  2.5 u  2 v  1
x
22.5ln2.5  5
x1  2.5  2  2 ln2.5  2.6092 2x 1 
f  x  2 ln x  x

22.6092ln2.6092  5  2ln x  2
x2  2.6092  2  2 ln2.6092  2.6080

x3  2.6080  22.6080ln2.6080  5  2.6080
2  2 ln2.6080

 x  2.608

6 of 24

Lecture Note: 1 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

EXAMPLE 9
Sketch the graph of y  ex and y  2  x, where x  2 on the same axes. Get the first
approximation, x0 for the equation ex  2  x, where 0  x0  1. Hence, by using Newton-
Raphson method, solve the equation of ex  1 for x  2 correct to three decimal places.

2x

ex  1
2x

2 x  1
ex

2  x  ex

ex  x  2  0

Let f x  ex  x  2, then f x  ex  1,

x0  0.4

x1  0.4  e0.4  0.4  2  0.4434
e0.4  1

x2  0.4434  e0.4434  0.4434  2  0.4429
e0.4434  1

x3  0.4429

 x  0.443

7 of 24

Lecture Note: 2 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

Topic: 3. NUMERICAL METHOD

Subtopic: 3.3 Trapezoidal Rule

Learning Outcomes: At the end of the lesson, students should be able to
(a) use the trapezoidal rule to approximate definite integral.

Trapezoidal Rule

 The area under the curve y  f x, is divided into n strips.

 The width of each strip is h  b  a .
n

 Note: For n  1 ordinates, there are n strips.

 Let y0, y1, y2,,yn1, yn be the values of the function f x.

 These correspond to the n  1 ordinates are x0,x1, x2,,xn respectively.

 The area under the curve  sum of the areas of n trapezium.

 Note that:  If 6 ordinates, then n  5

 If 6 subintervals, then n  6.

 If 6 strips, then n  6.

b

a f xdx  sum of the areas of n trapeziums

 h y0  y1   h y1  y2   h y2  y3    h  yn1  yn 
2 2 2 2

 h  12 y0  y1  y2  yn1  1 yn 
2

 h y0  yn   2 y1  y2  yn1 
2

where h  b  a , n  number of strips (sub-interval) and yr  f(xr ).
n

8 of 24

Lecture Note: 2 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

EXAMPLE 10
Use the trapezoidal rule, with five ordinates, to evaluate 0.8 ex2 dx. Give your answer correct to

0

three decimal places.
h  0.8  0  0.2
4

xn yn

0 1.0000

0.2 1.0408

0.4 1.1735

0.6 1.4333

0.8 1.8965

2.8965 3.6476

 0.8 ex2 dx  0.2 2.8965  23.6476
0 2

 1.019

EXAMPLE 11

5

Approximate 3 1  xdx by using trapezoidal rule with 4 strips. Give your answer correct to

4 decimal places.

h  5  3  0.5
4

xn yn
3 2.00000

3.5 2.12132

4 2.23607

4.5 2.34521

5 2.44949

Total 4.44949 6.70260

5 1  xdx  0.5 4.44949  2 6.70260
3 2

 4.4637

9 of 24

Lecture Note: 2 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

EXAMPLE 12

Using the trapezium rule with 4 sub-intervals, calculate an approximate value for the area under

the curve f x  lnx  1 between x  2 and x  4. Give your answer to four decimal places.

h  4  2  0.5 yn
4
xn 1.09861
2
2.5 1.25276
3
3.5 1.38629
4
Total 1.50408

1.60944

2.70805 4.14313

4  1dx  0.5 2.70805  24.14313
2
2 lnx

 2.7486

EXAMPLE 13

Given that f x is a continuous function. The table below shows the values of f x for a few

values of x.

x f x

00
0.1 0.1105
0.2 0.2443
0.3 0.4050
0.4 0.5967
0.5 0.8244

0.5

Use the table and the trapezoidal rule to find an approximation value for the integral 0 f xdx

correct to two decimal places.

n  5, h  0.5  0  0.1
5

 0.5 x dx  0.1 0  0.8244  20.1105  0.2443  0.4050  0.5967
f 2
0

 0.18

10 of 24

Lecture Note: 2 of 2 Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

EXAMPLE 14



Using the trapezium rule to estimate the value of 3 tan xdx with 4 strips correct to four decimal
0

places.

h  0  
3

4 12

xn yn

0 0.00000 0.26795
0.57735
 1.73205 1.00000
12 1.73205
 1.84530
6

4

3

Total

 

3 tan xdx  12 1.73205  21.84530
0 2

 0.7098

11 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

1. (a) Show that the equation ln 4x  2  x has a root in the interval 0.5  x  1.

Let f x  ln 4x  x  2,

f 0  ln 40.5  0.5  2  0.807  0
f 1  ln 41  1  2  0.3863  0

Since f 0  0 and f 1  0, then the equation has a root in the interval 0.5  x  1.

(b) Hence, by taking 0.6 as the first approximation, use the Newton-Raphson method to
solve the equation. Give your answer correct to 3 significant figures.

f x  1  1

x

x0  0.6

x1  0.6  ln 4 0.6  0.6  2  0.7967
1
1

0.6

x2  0.7967  ln 40.7967  0.7967 2  0.8163

1 1
0.7967

x3  0.8163  ln 40.8163  0.8163 2  0.8165

1 1
0.8163

x4  0.8165

 x  0.817

2. Use the Newton-Raphson method to estimate one root of the equation x  cos x  0 accurate
to 3 decimal places by choosing x0  0.8.

Let f x  x  cos x,

f x  1  sin x

x0  0.8

x1  0.8  0.8  cos 0.8  0.7399
1  sin 0.8

x2  0.7399  0.7399  cos 0.7399  0.7391
1  sin 0.7399

x3  0.7391  0.7391  cos 0.7391  0.7391
1  sin 0.7391

 the root is x  0.739.

12 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

3. Use the Newton-Raphson method with initial approximation x1  0.8 to find 3 4 1 on
0,1.5 correct to 3 decimal places.

Let f x  x  13  4,

f  x  3x  12

x1  0.8

x2  0.8  0.8  13  4  0.6115
30.8  12

x3  0.6115  0.6115  13  4  0.5878
30.6115  12

x4  0.5878  0.5878  13  4  0.5874
30.5878  12

x5  0.5874

 3 4  1  0.587

4. Estimate the cube root of 21 correct to four decimal places.

Let x  3 21,

x3  21
x3  21  0

Let f x  x3  21,

f x  3x2

x1  2.5

x2  2.5  2.53  21  2.78667
3 2.52

2.786673  21
x3  2.78667  32.786672  2.75920

2.759203  21
x4  2.75920  32.759202  2.75892

2.758923  21
x5  2.75892  32.758922  2.75892

 3 21  2.7589

13 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

1

5. Show that the equation 5  3x3  x has a root  in the interval 1,2. By using the

Newton Raphson method, with first approximation   1, find the approximate root of the
equation correct to three decimal places.

1

Let f x  5  3x3  x,

1

f 1  5  313  1  0.260  0

1

f 2  5  32 3  2  3  0

there is a root in the interval 1,2.

f x  5  3x32  1

x0  1,

1
5  31 3  1
x1  1 2  1.1595
3
 5  3 1 1

1
5  31.1595 3  1.1595
x2  1.1595  2  1.1542
3
 5  3 1.1595 1

1
5  31.1542 3  1.1542
x3  1.1542  2  1.1542
3
 5  3 1.1542 1

 the root is x  1.154

14 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

6. The graphs of y  x1 intersects the graph of y  5 cosx    at the point A in the first
3

quadrant. By using Newton-Raphson method, find the coordinates of A correct to four
decimal places.

x  1  5 cos x   
3

Let f x  x  1  5 cos x   ,
3

f 0  0  1  5 cos 0     1.5  0
3

f 1  1  1  5 cos 1     2.99  0
3

f 2  2  1  5 cos 2     0.103  0
3

 the x-coordinate of A lies between 1 and 2.

f  x  1  5 sin x   
3

x0  1.5,

1.5  1  5 cos1.5   
3
x1  1.5   2.12625
1.5  
1  5 sin  3

x2  2.12625  2.12625  1  5 cos2.12625     1.98470
3

1  5 sin 2.12625   
3

x3  1.98470  1.98470  1  5 cos1.98470     1.97959
3

1  5 sin 1.98470   
3

x4  1.97959  1.97959  1  5 cos1.97959     1.97959
3

1  5 sin 1.97959   
3

 x  1.9796

y  1.9796  1
 2.9796

 A1.9796,2.9796

15 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

7. 1.5  3 x4  dx
Use the trapezium rule to estimate the value of 0.5 x  with 5 ordinates correct to

two decimal places.

n  4, h  1.5  0.5  0.25
4

xn yn
0.5 6.063

0.75 4.316

1.0 4.000

1.25 4.841

1.5 7.063

Total 13.126 13.157

 1.5  3  x4 dx  0.25 13.126  2 13.157
0.5 x 2

 4.93

8. Use the trapezium rule to estimate the value of

(a) 5 1 dx with 4 sub-intervals correct to three significant figures.
1 1  ln x

n  4, h  5  1  1
4

xn yn
1 1.0000

2 0.5906

3 0.4765

4 0.4191

5 0.3832

Total 1.3832 1.4862

5 1 1 dx  1 1.3832  2 1.4862
1  ln x 2

 2.18

16 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022



(b) 4 sec xdx with 4 strips correct to five decimal places.
0

n  4, h   0  
4

4 16

xn yn

0 1.000000 1.019591
1.082392
 1.414214 1.202690
16 2.414214
 3.304673
8
3
16

4

Total

 

4 sec xdx  16 2.414214  2 3.304673
0 2

 0.88589

0
(c)  x cos xdx with 4 strips correct to four decimal places.


n  4, h  0    0.25

4

xn yn

0.75 3.14159
0.5
1.66608

0

0.25 -0.55536
0
0.00000

Total 3.14159 1.11072



0 4 3.14159  21.11072
2
x cos xdx 



 2.1061

17 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

9. The curve with equation y  ex  1 is bounded by the curve, the y-axis, the x-axis and the

line with equation x  2.

(a) Complete the table with values of y corresponding to x  3 and x  2.
2

x x0 x 1 x1 x 3 x2
2 2

y 2.0000 2.6487 3.7183

x x0 x 1 x1 x 3 x2
2 3.7183 2 8.3891

y 2.0000 2.6487 5.4817

x

(b) Use the trapezium rule

(i) with the value of y at x  0, x  1 and x  2 to estimate the area of R. Give your

answer to three decimal places.

h  20 1
2

xn yn
0 2.0000

1 3.7183

2 8.3891

Total 10.3891 3.7183

 2 ex  1 dx  1 1 10.3891  2 3.7183
0 2

 8.913

18 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

(ii) with the value of y at x  0, x  1 , x  1, x  3 and x  2 to find a further
22

estimate of the area of R. Give your answer to three decimal places.

h  20  1
42

xn yn

0 2.0000
1 2.6487
2
1 3.7183
3 5.4817
2
2 8.3891

Total 10.3891 11.8487

1

 2 ex  1dx  2 10.3891  211.8487
0 2

 8.522

(iii) Find the percentage error between answers from (i) and (ii). Hence, give a conclusion
for the difference of the values.

percentage error  8.522  8.913 100%
8.522

 4.59%
The bigger number of strips, n will give more accurate approximate value.

19 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

10. The region A in the first quadrant of the xy-plane is bounded by the y-axis, the x-axis from

 0 to  and the curve y  2 1  cos x sin x. Find the area of A with integral method. By
2
using the trapezoidal rule with 3 intervals each of width  , to estimate the area of A, giving

6
your answer correct to 3 decimal places. Hence, calculate the percentage error in your answer.

 u  1  cos x
du  sin x
 Area of A  2 2 1  cos x sin xdx dx
0 du  sin xdx

1 When x  0, u  1  cos 0
0
 20 udu
When x   , u  1  cos 
 2  2 3 1 22
3  1
u2  0

4
3

h 
6

xn yn

0 0.0000

 0.3660
6
 1.2247
3
 2.0000
2

2.0000 1.5907

 

 22 1  cos x sin xdx  6 2.0000  2 1.5907
0 2

 1.356

4  1.356
percentage error  3 4
100%

3

 1.70% (3sf)

20 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

11. Use the trapezium rule with ordinates at x  0,  ,  ,  ,  to estimate the value of
12 6 4 3



3 ln2  cos xdx, correct to 3 significant figures. Hence, find 3 ln2  cos x8 dx, correct

 0 0

to 3 significant figures.

Let y  ln2  cos x,

h  0  
3

4 12

xn yn

0 1.099

 1.087
12
 1.053
6
 0.9959
4
 0.9163
3

2.0153 3.1359

 ln 2  cos xdx   2.0153  23.1359
3 24
0

= 1.08



 3 ln2  cos x8 dx  8 3 ln2  cos xdx
00

 81.08

 8.64

21 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

0

12. Show that  tan y sec ydy  1  2. Calculate the error of the result using trapezoidal rule
4
for n  5.

0 tan y sec ydy  sec y 0

4 
4

  1 0
cos 
y 
4

=  1 0  1 4 
cos cos 

=1  2

Let f y  tan y sec y  tan y ,

cos y

0     
4
h  
5 20

yn fn

 1.4142
4
0.8981

5 0.5719

 3 0.3416
20
0.1604

10 0.0000


20

0

Total 1.4142 1.9720

0 tan y sec ydy   1.4142  21.972
 40
4

 0.4208

error  1  2  0.4208

 0.00659

22 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

2

13. Given that by using trapezoidal rule, 0 f xdx  1.4373, where y0  0, yn  1.6094 and

n1

 yi  4.9446. Find the number of strips, n to the nearest integer.

i1

h  20  2
nn

2 h  n1 
2 y0 yi 
 f 2
0
xdx   yn  i1

2

1.4373  n 1.6094  2 4.9446
2

n  8.00014

n8

14. The diagram shows a sketch of the curve with equation y  27  3x.

(a) The curve y  27  3x intersects the y-axis at the point A and the x-axis at the point
B. Find the y-coordinate of point A and the x-coordinate of point B.

When x  0, y  27  30
 26

When y  0, 0  27  3x
3x  33
x3

23 of 24

Tutorial 3: 4 Hours Mathematics 2 SM025
Ch. 3 Numerical Method Session 2021/2022

(b) The region, R, is bounded by the curve y  27  3x and the coordinate axes. Use the
trapezoidal rule with four ordinates to find an approximate value for the area of R.

h  30 1  3 27  3x dx
3 0

xn yn
0 26

1 24

2 18

30

Total 26 42

Area of R  1 26  2 42
2

 55

Answers (iii) 4.59%, DIY
1. (a) DIY (b) 0.817
2. 0.739
3. 0.587
4. 2.7589
5. DIY, 1.154

6. A 1.9796, 2.9796

7. 4.93
8. (a) 2.18 (b) 0.88589 (c) 2.1061
9. (a) 5.4817, 8.3891 (b) (i) 8.913 (ii) 8.522

4
10. , 1.356, 1.70%

3
11. 1.08, 8.64
12. DIY, 0.00659
13. n  8

14. (a) y  26, x  3 (b) 55

24 of 24


Click to View FlipBook Version