Professional Documents
Culture Documents
Chapter # 2
Solution of Algebraic and Transcendental Equations
Notes:
(1)
(2)
Numerical Analysis
(Given)
d
f (x ) and put x = xn in f(x) and f (x) .
dx
x n 1 x n
f ( xn )
to get x1, x2, x3,
f ( x n )
If the two values of x are approximately equal then we stop the iteration, and the
last value of x will be a positive root of f(x).
Q.21/Page # 47
Apply any numerical method to calculate the square root of 3 up to six decimal places.
Ans:
Square root of 3 =
Let x =
Numerical Analysis
Squaring both sides
X2 = 3 x2 3 = 0
Let f(x) = x2 3 f(xn) = xn2 - 3
d
d
f (x ) =
( x2 3) f (x ) = 2x f ( x n ) = 2 xn
dx
dx
f ( xn )
f ( x n )
x n 1 x n
x n 1 x n
xn 3 2 xn xn 3 xn 3
----------> (1)
2 xn
2 xn
2xn
To find x0
As f(x) = x2 3
For x = 0, f(0) = 0 3 = -3 (-ve)
For x = 1, f(1) = 1 3 = -2 (-ve)
For x = 2, f(2) = 22 3 = 4 3 = 1 (+ve)
Since f(x) changes its sign at x = 1 and x = 2
The root lies in the interval (1, 2) x0 = 1
2
x0 3 1 3 4
2
2 x0
2
2
2
x 3 22 3 4 3 7
1.75
For n = 1, equation (1) x 2 1
2 x1
2( 2)
4
4
Numerical Analysis
2
x 3 (1.75) 2 3 6.0625
1.732149
For n = 2, equation (1) x3 2
2x2
2(1.75)
3 .5
2
x 3 3 (1.732149) 2 3
1.7320508
2 x3
2 x3
We stop the iteration because the value of x3 and x4 are approximately equal. Hence
the root is x = 1.7320508.
(ANSWER)
Q.16/page # 47
Find the +ve real root of xex = 1, using Newton Raphson method.
Use x0=1.
Ans:
Given that: xex = 1 ==> xex 1 = 0
Let f(x) = xex 1 ==> f(xn) = xnexn 1
d
( xe x 1) = xex + ex.1 0
dx
f (x) =
f (x) = xex + ex
f ( x n ) =exn ( xn + 1)
x n 1
f ( xn )
x n e xn 1
xn
=> x n 1 x n xn
f ( x n )
e ( x n 1)
x n 1
x n e xn ( x n 1) ( x n e xn 1)
e xn ( x n 1)
Numerical Analysis
2
x n 1
x n e xn x n e xn x n e xn 1
e xn ( x n 1)
x n 1
x n e xn 1
e xn ( x n 1)
---------> (1)
x0 e x0 1
x1 x0
e ( x0 1)
x1
0.6839
e1 (1 1) 2.7183 2 5.4365
x1 = 0.6839
0.5776
1.9816 1.6839
3.3368
e ( x1 1) e 0.6839 (0.6839 1)
2
0.5672
1.7816 1.5776
2.8109
e ( x2 1) e 0.5776 (0.5776 1)
2
After 3 iterations the values of x2 and x3 coincide. Hence the root is x = 0.5672.
(ANSWER)
TYPE NUMBER 2
SECANT METHOD
Key
The formula for Secant Method is:
Numerical Analysis
x n 1 f ( x n ) x n f ( x n 1 )
f ( x n ) f ( x n 1 )
x n 1
xn
10 f(xn-1) = xn1
xn 1
10
x n 1 f ( x n ) x n f ( x n 1 )
--------> (1)
f ( x n ) f ( x n 1 )
x n 1
x n 1 ( x n n 10) x n ( x n 1
x
( x n n 10) ( x n 1
x n 1
x n 1 ( x n n 10) x n ( x n 1
xn
x n x n 1
x n 1
10)
10)
x n 1
x n n 10 x n 1
x n 1
x n 1
10)
10
10)
x n 1
x n 1
x n 1 ( x n n 10) x n ( x n 1
x n 1 .x n n 10 x n 1 x n .x n 1
x
x n n x n 1
x n 1
x n 1
10 x n
(1)
x2
x 0 .x1 1 10 x 0 x1 .x0 0 10 x1
x
x1 1 x 0
x0
2( 3 )3 10( 2 ) 3( 2 ) 2 10( 3 ) 54 20 12 30 52
2.2609
27 4
23
33 2 2
x3
x3
x1 .x 2
x2
10 x1 x 2 .x1 1 10 x 2
x2
x2
x1
x1
2.3923
6.3240 27
20.6760
Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar
Numerical Analysis
x4
x4
x3
10 x 2 x 3 .x 2
x3
x3
x2
x2
10 x 3
x2
2.2609( 2.3923 ) 2.3923 10( 2.2609 ) 2.3923( 2.2609 ) 2.2609 10( 2.3923 )
( 2.3923 ) 2.3923 ( 2.2609 ) 2.2609
2.4546
8.0582 6.3240
1.7342
x5
x5
x 3 .x 4
x4
10 x 3 x 4 .x 3
x4
x4
x3
x3
10 x 4
x3
2.3923( 2.4546 ) 2.4546 2.4546( 2.3923 ) 2.3923 10( 2.3923 ) 10( 2.4546 )
( 2.4546 ) 2.4546 ( 2.3923 ) 2.3923
2.5126
9.0625 8.0582
1.0043
We stop the iteration because the values of x4 and x5 are approximately equal. Hence
the root is x = 2.5126
(ANSWER)
TYPE NO. 3
METHOD OF FALSE POSITION
OR
REGULA FALSI METHOD
KEY
(1)
xi x L
f ( x L )[ x R x L ]
f ( xL ) f ( xR )
Where
(2)
(3)
(4)
(5)
Find f(xi), if f(xi) is nearly equal to ZERO stop the iteration process otherwise
proceed by reducing the interval in the following ways:
Numerical Analysis
(6)
F(xL)
F(xR)
F(xi)
Replace xL or xR by xi
Positive
Negative
Positive
Replace xL by xi
Negative
Positive
Positive
Replace xR by xi
Positive
Negative
Negative
Replace xR by xi
Negative
Positive
Negative
Replace xL by xi
We stop the iteration process when the value of f(xi) is nearly equal to zero and
the root will be xi.
Q.14/Page # 46
To solve the question f(x) = sinx 0.5x by using the False position Method.
From the previous question the root lies in the interval (1,2) xL = 1, xR= 2
Now f(xL) = f(1) = sin1 0.5(1) = 0.8414 0.5 = 0.3414
And f(xR) = f(2) = sin2 0.5(2) = 0.9093 1 = -0.0907
Using the formula for Regula Falsi Method
f ( x L )[ x R x L ]
xi x L
f ( x L ) f ( x R ) --------->(1)
xi 1
0.3414[ 2 1]
0.3414
1
1 0.7900 1.79
0.3414 0.0907
0.4321
= 0.3414
(+ve)
= 0.081
(+ve)
xi = xL = 1.79, xR = 2
f(xi) = 0.081 = f(xL) [i.e. we replace xL by xi and f(xL) by f(xi) in (1)]
equation (1)
xi 1.79
0.081[ 2 1.79]
0.0170
1.79
1.79 0.0990 1.8890
0.081 0.0907
0.1717
Numerical Analysis
Now f(xi) = f(1.8890) = sin(1.8890) 0.5(1.8890) = 0.0053
Since the value of f(xi) is nearly equal to Zero the root is x = 1.8890 Answer
TYPE NO. 4
BISECTION METHOD
OR
BOLZANO METHOD
KEY
Find those values of x for which f(x) changes its sign. The root will lie in that
interval.
Find the mid point of the interval and find f(x) for that value of x.
Reduce the interval for which f(x) changes its sign [Already discussed in Type #3]
and go on till the value of f(x) nearly equal to zero. This will be your root.
Q.11/Page # 46
Find a positive real root of f(x) = sinx x/2, with x1 = /2 and x2 = using Bisection
Method. Do six iterations.
Ans: Given function is: f(x) = sinx x/2 -------->(1)
1st we find the interval for which f(x) changes its sign.
Since x1 = /2 and x2 =
Therefore
And
x1 x 2 1.571 3.142
2.356
2
2
Numerical Analysis
For the next step we have:
.f(x1) is +ve
f(x2) is ve
f(x) is ve
x1 x 2 1.571 2.356
1.963
2
2
x1 x 2 1.571 1.963
1.767
2
2
x1 x2 1.767 1.963
1.865
2
2
and
x1 x2 1.867 1.963
1.889
2
2
10
Numerical Analysis
11
CHAPTER # 3
LINEAR EQUATIONS
Consider the system of equations.
2x1 3 x2 + 7x3 = 10
8x1 + 2 x2 + 5x3 = 12
4x1 3x2 9 x3 = 16
All the above equations involve three unknowns i.e. x1, x2, x3 with maximum power
ONE. So this system of equations is called system of linear equations. We can write
it in matrix form as:
2
8
3
2
3
i.e.
7
5
9
x1
10
x 2 12
x3
16
Ax = c
Where A = 8
4
10
c = 12
16
3
2
3
7
5
9
Ac = 8
4
3
2
3
10
5 12
9 16
Direct Method.
Iterative Method.
Types of Direct Method
Crammers Rule
Gauss Elimination Method.
Gauss Jordan Method.
Method of Inversion.
Choleskis Factorization Method.
Numerical Analysis
12
TYPE NO. 1
CRAMMERS RULE
KEY
A1
A
, x2 =
A2
A
, x3 =
A3
A
Q.3/Page # 84
Solve the system of equations by using Crammers Rule
2.16x1 + 3.75x2 + 0.98x3 = 8.68
4.12x1 + 1.67x2 + 7.21x3 = 0.25
3.14x1 + 4.02x2 + 2.16x3 = 9.16
Ans:
The system can be written in matrix form as:
2.16 3.75 0.98 x1
8.68
4.12 1.67 7.21 x 0.25
Ax = c
2.16
4.12
3.14
3.75
1.67
4.02
0.98
7.21
2.16
Expanding by R1
|A| =
|A| =
|A| =
|A| =
2.16
1.67
7.21
4.02
2.16
3.75
4.12
7.21
3.14
2.16
0.98
4.12
1.67
3.14
4.02
Solution exists.
Numerical Analysis
Now | A 1 |
8.68
0.25
9.16
3.75
1.67
4.02
13
0.98
7.21
2.16
Expanding by R 1
8.68
1.67
7.21
4.02
2.16
3.75
0.25
7.21
9.16
2.16
0.98
0.25
1.67
9.16
4.02
2.16
8.68
0.98
4.12
3.14
0.25
9.16
7.21
2.16
Expanding by R 1
2.16(0.54 - 66.04) - 8.68(8.89 - 22.64) 0.98(37.74 - 0.785)
- 141.48 119.35 36.21 14.08
2.16
And | A 3 | 4.12
3.75
1.67
8.68
0.25
3.14
4.02
9.16
Expanding by R 1
1.44
|A|
7.79
| A 2 | 14.08
x2
1.798
|A|
7.79
| A3 | 9.4724
x3
1.209
| A|
7.79
Hence the solution is : x ( x1 , x 2 , x3 ) T (1.44,1.798,1.209) T
Numerical Analysis
1
0
A = 0
1
0
0
5
1
0
4
6
3
A= 0
0
0
1
0
0 1
0 2
1 3
Type No. 2
Gauss Elimination Method
KEY
Write the system of equations in matrix form.
Write the matrix form in tabular form.
Change the co-efficient matrix to Echelon form.
Find the values of unknowns. i.e. x1, x2, x3,..
T
Solution is: x ( x1 , x2 , x3 )
Q.2/Page # 83
Solve by Gauss Elimination Method
2x1 x2 + 3x3 x4 = 7
x1 x2 + 4x3 2x4 = 5
3x1 + 2x2 + x3 + 4x4 = 31
4x1 3x2 + 3x3 3x4 = -5
Ans:
Writing the system of equations in matrix form
2 1 3
1 1 4
1 x1 7
2 x2 5
3 2 1 4 x3 31
4 3 3 3 x4 5
Ax = c
Using Gauss Elimination Method, We write the system in tabular form as:
14
Numerical Analysis
R20
15
Rows
X1
X2
X3
X4
Row
Explanation
R1
R2
R3
R4
2
1
3
4
-1
-1
2
-3
3
4
1
3
-1
-2
4
-3
7
5
31
-5
Eq(1)
Eq(2)
Eq(3)
Eq(4)
R5
R6
R7
R8
1
0
0
0
-1/2
-1/2
7/2
-1
3/2
5/2
-7/2
-3
-1/2
-3/2
11/2
-1
7/2
3/2
41/2
-19
R1
R2 R5
R3 3R5
R4 4R5
R9
R10
R11
R12
1
0
0
0
-1/2
1
0
0
3/2
-5
-14
-8
-1/2
3
5
2
7/2
-3
-31
-22
-2R6
R7 7/2R10
R8 + R10
R13
R14
R15
R16
1
0
0
0
-1/2
1
0
0
3/2
-5
1
0
-1/2
3
-5/14
-12/14
7/2
-3
31/14
-60/14
-1/14 R11
R12 + 8R15
R17
R18
R19
R20
1
0
0
0
-1/2
1
0
0
3/2
-5
1
0
-1/2
3
-5/14
1
7/2
-3
31/14
60/12
-14/12 R16
x4 = 60/12 = 5
x4 = 5
5
31
5
31
x4
x 3 (5)
14
14
14
14
31 25 31 25 56
x3
4
14 14
14
14
R18 x 2 5 x3 3 x 4 3 x 2 5(4) 3(5) 3 x 2 20 15 3 x 2 3 5 x 2 2
R19 x3
1
3
1
7
1
3
1
7
5 7
x 2 x3 x 4 x1 ( 2) ( 4) (5) x1 1 6
2
2
2
2
2
2
2
2
2 2
7 5
7 5 2 12 2
x1 1 6 x1
1
2 2
2
2
R17 x1
Numerical Analysis
16
T
T
Hence x ( x1 , x 2 , x3 , x 4 ) (1,2,4,5)
Q.1(ii)/Page # 83
X1 + x2 + x3 + x4 = 4
2x1 + 3x2 + 7x3 x4 = 11
3x1 2x2 + 5x3 3x4 = 3
4x1 5x2 2x3 3x4 = -6
Ans:
Matrix form is
1
2
1
3
2
5
1
1
3
1
7
5
2
x1
x 2
x3
x 4
4
11
3
Ax = c
Using Gauss Jordon Method in tabular form:
Row
Explanation
Eq(1)
Eq(2)
Eq(3)
Eq(4)
Rows
X1
X2
X3
X4
R1
R2
R3
R4
1
2
3
4
1
3
-2
-5
1
7
5
-2
1
-1
-3
-3
4
11
3
-6
R5
R6
R7
R8
1
0
0
0
1
1
-5
-9
1
5
2
-6
1
-3
-6
-7
4
3
-9
-22
R9
R10
R11
R12
0
1
0
0
1
0
0
0
5
-4
27
39
-3
4
-21
-34
3
1
6
5
R6
R5 R9
R7 + 5R9
R8 + 9R9
R13
R14
R15
R16
0
0
1
0
0
1
0
0
1
0
0
0
-7/9
8/9
8/9
-11/3
2/9
17/9
17/9
-11/3
1/27 R11
R9 5R13
R10 + 4R13
R12 39R13
R17
R18
R19
R20
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
1
1
1
1
1
-3/11 R16
R13+7/9R17
R14 8/9R17
R158/9 R17
R21
R22
R23
R24
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
1
1
1
1
R20
R19
R18
R17
R1
R2 2R5
R3 3R5
R4 4R5
Numerical Analysis
R24
R23
R22
R21
Hence
17
x4 = 1
x3 = 1
x2 = 1
x1 = 1
T
T
the solution is: x ( x1 , x2 , x3 , x4 ) (1,1,1,1) Answer
Type No. 4
Method of Inversion
Key
I= 0
0
0
1
0
0
1
etc.
Q.4/Page # 84
Solve the system of equation by Inversion of the matrix.
4.65x1 + 1.98x2 4.62x3 = 11.25
0.79x1 2.54x2 + 3.16x3 = -4.91
4.02x1 8.17x2 + 2.93x3 = -6.90
Ans:
Matrix form of the system is
4.65
0.79
4.02
1.98
2.54
8.17
4.62 x1
11.25
3.16 x 2 4.91
6.90
2.93 x3
Ax = c
x = A-1c -(1)
We 1st find A-1 by Gauss Jordan Method
Numerical Analysis
18
Rows
X1
X2
X3
C1
C2
C3
Row
Explanation
R1
R2
R3
4.65
0.79
4.02
1.98
-2.54
-8.17
-4.62
3.16
2.93
1
0
0
0
1
0
0
0
1
Eq(1)
Eq(2)
Eq(3)
R4
R5
R6
1
0
0
0.42
-2.88
-9.87
0.99
2.38
-1.04
0.25
-0.11
-1
0
1
0
0
0
1
1/4.65 R1
R2 0.79R4
R3 4.02R4
R7
R8
R9
0
1
0
1
0
0
-0.82
1.34
-9.20
0.07
0.22
-0.32
-0.34
0.14
-3.43
0
0
1
-1/2.88 R5
R4 0.42R7
R6 + 9.87R7
R10
R11
R12
0
0
1
0
1
0
1
0
0
0.34
0.36
-0.24
0.36
-0.04
-0.34
-0.11
-0.08
0.14
-1/9.20 R9
R7 + 0.82R10
R8 1.34R10
R13
R14
R15
1
0
0
0
1
0
0
0
1
-0.24
0.36
0.34
-0.34
-0.04
0.36
0.14
-0.08
-0.11
R12
R11
R10
Hence A
-1
0.24
= 0.36
0.34
0.34
0.04
0.36
0.14
0.08
0.11
Equation (1)
x1
x 2
x3
x1
x 2
x3
0.24
0.36
0.34
0.34
0.04
0.36
0.14
0.08
0.11
11.25
4.91
6.90
T
T
Hence the solution is: x ( x1 , x 2 , x3 ) ( 5.40,4.38,6.43)
NOTES
(i)
Square Matrix
Number of Rows = Number of Columns
(ii)
(iii)
Rectangular Matrix
Number of Rows Number of Columns
Diagonal Matrix
Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar
Numerical Analysis
If in a Matrix, aij =0 for i j and atleast one aii 0
For example
2
A= 0
0
(iv)
0
3
6
0
U= 0
0
(v)
2
7
0
5
9
6
L = 9
1
0
2
6
0
7
(vi)
Singular Matrix
If |A| = 0 A is singular.
(vii) Non-singular Matrix
If |A| 0 A is non-singular.
(viii) How to express a Matrix A in the product of L and U.
i.e.
A = LU
where L is the unit lower triangular and U is the upper triangular. i.e.
a11 a12 a13
TYPE NO. 5
CHOLESKIS METHOD
KEY
Where L is the lower triangular matrix with diagonal elements 1 and U is upper
triangular Matrix.
Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar
19
Numerical Analysis
20
Q.17/Page # 88
1
7
12
8
16
lower triangular and U is upper triangular. Hence solve the system of equations.
.x1 + 2x2 + 3x3 = 2
2x1 + 8x2 + 7x3 = 7
2x1 + 16x2 + 12x3 = 10
Ans:
1st we express the matrix in the LU form. i.e. A = LU
1
2
2
8
16
1
3
7 = l
21
l
12
31
0
1
l32
u11 = 1
l21.u11 + 0 + 0 = 2
l21(1) = 2
l21= 2
l31.u11 + 0 = 2
l31(1) = 2
l31 = 2
hence L = 2
2
0
1
3
0
0
1
u
u
11 12
. 0 u 22
1 0
0
u13
u 23
u 33
u12 + 0 + 0 = 2
u12 = 2
l21.u12 + u22 = 8
(2)(2) + u22 = 8
u22 = 8 4 = 4
u22 = 4
l31.u12 + l32.u22 + 0 = 16
2.2 + l32 (4) = 16
4l32 = 16 4 = 12
l32 = 3
1
and U = 0
0
2
4
0
u13 + 0 + 0 = 3
u13 = 3
l21.u13 + u23 = 7
(2)(3) + u23 = 7
u23 = 7 6 = 1
l31.u13 + l32.u23 + u33 = 12
2.3 + 3.1 + u33 = 12
u33 = 12 6 3 = 3
u33 = 3
3
1
3
Numerical Analysis
1 0 0 y1
2
2 1 0 y 7
2
2 3 1 y
10
3
y 00
2
1
2 y1 y 2 0 7
2 y 3y y
10
1
2
3
y1 = 2
2y1 + y2 = 7
(2)(2) + y2 = 7
y2 = 7 4 = 3
y2 = 3
R3
2y1 + 3y2 + y3 = 10
(2)(2) + (3)(3) + y3 = 10
y3 = 10 4 9 = - 3
y3 = -3
Therefore y = (y1, y2, y3)T = (2, 3, -3)T
Now we find x= (x1, x2, x3)T such that:
U x = y
R1
R2
x1
2
3
x
x
3
0 0
3
x1 2 x 2 3x3
2
0 4 x 2 x3 3
0 0 3x3
3
1
0
2
4
3
1
3
3x3 = -3
x3 = -1
R2
4x2 + x3 = 3
4x2 + (-1) = 3
4x2 = 3 + 1 = 4
x2 = 1
R3
x1 + 2x2 + 3x3 = 2
x1 + 2.1 + 3. -1 = 2
x1 + 2 3 = 3
x1 = 4
Hence the solution is: x = (x1, x2, x3)T = (4, 1, -1)T
R3
21
Numerical Analysis
a
11
Let A = a 21
a
31
a12
a 22
a 32
22
a13 5
1
2
a 23 3 12
3
a33 1 4 20
In the above matrix the Diagonal elements are 5, -12, -20. the absolute of these value are 5, 12, 20. These
values are greater than the absolute sum of the remaining elements two elements in that row. For example 5
is greater than |1| + |-2| = 1 + 2 = 3. Similar case for the other two rows.
TYPE NO. 2
ITERATIVE METHODS
There are two types of Iterative Methods
Jacobi Method
Gauss Seidel Method.
Type # 1
Jacobis Method
KEY
x1 = 1 , x2 = 2 and x3 = 3
2nd Iteration
Put x1 = 1, x2 = 2 and x3 = 3 in (A)
Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar
Numerical Analysis
x2 = 2 (0.1)(1) 0 = 1.99
Put x2 = 1.99 in (3)
x3 = 3 (0.1)(1.99) = 2.801
nd
2 Iteration
Put x2 = 1.99 in (1)
x1 = 1 (0.1)(1.99) = 0.801
Put x1 = 0.801 and x3 = 2.801 in (2)
x3 = 3 (0.1)(1.640) = 2.836
3rd Iteration
Put x2 = 1.640 in (1)
x1 = 1 (0.1)(1.640) = 0.836
Put x1 = 0.836 and x3 = 2.836 in (2)
x3 = 3 (0.1)(1.632) = 2.836
This converges to the real solution. So the solution is:
x1 = 0.836, x2 = 1.632 and x3 = 2.836
Q.10/Page # 86
Solve the system of equations.
6x1 3x2 + x3 = 11
Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar
23
Numerical Analysis
24
x1 = 1/6(11+0 0) = 1.833
Put x1 = 1.833 and x3 = 0 in (2)
Numerical Analysis
.x2 = 4 3(1.01) = 0.97
2nd Iteration
x1 = 3 2(0.97) = 1.06
x2 = 4 3(0.98) = 1.06
3rd Iteration
x1 = 3 2(1.06) = 0.88
x2 = 4 3(1.06) = 0.82
4th Iteration
x1 = 3 2(0.82) = 1.36
x2 = 4 3(0.88) = 1.36
5th Iteration
x1 = 3 2(1.36) = 0.28
x2 = 4 3(1.36) = - 0.08
6th Iteration
x1 = 3 2(- 0.08) = 3.16
x2 = 4 3(0.28) = 3.16
after 6th Iteration x1 = 3.16 and x2 = 3.16. i.e. x = (3.16, 3.16)T, which is diverging.
Now using Gauss Seidel Method
x1 = 3 2x2---------->(1)
x2 = 4 3x1---------->(2)
1st Iteration
put x2 = 1.01 in (1)
25
Numerical Analysis
26
1
1
f ( x0 ) f ( x1 ) f ( x 2 ) .............. f ( x n )
f ( x ) dx h
2
2
Where
ba
n
2. Simpsons Rule
f ( x) dx
h
f ( x0 ) 4 f ( x1 ) 2 f ( x 2 ) 4 f ( x3 ) 2 f ( x4 ) 4 f ( x5 ) ................. f ( xn )
3
ba
n
Where
Q #1
:
P 112
f ( x ) dx
Here
(x
f ( x) x
h
1
) dx
x
1
, a 2, b 3, n 4
x
b a 32 1
n
4
4
f ( x) x
x0 2
1
x
1
2.5
2
f ( x0 ) f (2) 2
f ( x1 ) f ( 2.25) 2.25
x1 2
1
2.25
4
x2 2
2
2.5
4
f ( x 2 ) f (2.5) 2.5
x3 2
3
2.75
4
f ( x3 ) f ( 2.75) 2.75
x4 2
4
3
4
f ( x 4 ) f (3) 3
1
2.694
2.25
1
2.9
2.5
1
3.114
2.75
1
3.333
3
Numerical Analysis
1
1
f ( x0 ) f ( x1 ) f ( x 2 ) f ( x3 ) f ( x 4 )
2
2
f ( x) dx h
1
1 2 .5
3.333
)dx
2.694 2.9 3.114
x
4 2
2
(x
1
1.25 8.708 1.667
4
1
11.625 2.9063
4
(x
1
) dx
x
x2
2
xdx
1
dx
x
ln x
3
2
1 2
(3 2 2 ) (ln 3 ln 2)
2
1
(9 4) (1.099 0.693)
2
(ii)
f ( x )dx
1
dx
e4x
f ( x)
Here
1
e 4 x , a 0, b 2, n 4
4x
e
ba 20 2 1
n
4
4 2
f ( x ) e 4 x
x0 0
f ( x0 ) f (0) e 0 1
x1 0
1
0 .5
2
27
Numerical Analysis
x2 0
2
1
2
f ( x 2 ) f (1) e 4 0.018
x3 0
3
1.5
2
x4 0
4
2
2
f ( x 4 ) f (2) e 8 0.0003
Trapezoidal rule
1
1
f ( x 0 ) f ( x1 ) f ( x 2 ) f ( x3 ) f ( x 4 )
2
2
f ( x)dx h
1 1
0.0003
0.135 0.018 0.002
2 2
2
1
0.5 0.1550 0.0002
2
1
0.6550 0.3275
2
e 4 x dx
e 4 x
4
1 4 x
e
4
2
0
1 8
(e e 0 )
4
1
(0.0003 1)
4
1
(0.9997) 0.2499
4
Q #2
:
P 112
Here
f ( x ) dx
( x 4 x 2 1)dx
f ( x) x 4 x 2 1, a 1, b 2, n 2
b a 2 1 1
n
2
2
f ( x) x 4 x 2 1
f ( x 0 ) f (1) 1 1 1 1
x0 1
x1 1
1
1.5
2
28
Numerical Analysis
x2 1
2
2
2
Simpsons Rule
h
f ( x0 ) 4 f ( x1 ) f ( x 2 )
a
3
3
1
4
2
1 ( x x 1)dx 2 3 1 4(3.8125) 13
f ( x) dx
1
(1 15.2500 13)
6
1
29.2500 4.8760
6
(ii)
f ( x ) dx e x sin xdx
0
Here
f ( x) e x sin x, a 0, b 2, n 2
ba 20 2
1
n
2
2
f ( x) e x sin x
x0 0
f ( x0 ) f (0) e 0 sin 0 0
x1 0 1 1
f ( x1 ) f (1) 2.2874
x 2 0 1(2) 2
f ( x 2 ) f (2) 6.7188
Simpsons Rule
h
f ( x0 ) 4 f ( x1 ) f ( x 2 )
3
2
1
x
0 e sin xdx 3 0 4 2.2874 6.7188
f ( x) dx
1
15.8668
3
5.2886
Q #3
:
P 112
Here
f ( x ) dx
ydx
a 0, b 1, h 0.1
29
Numerical Analysis
x
f ( x) y
x 0 0.2
f ( x0 ) 1
x1 0.1
f ( x1 ) 0.99
x 2 0.2
f ( x 2 ) 0.961
x3 0.3
f ( x 3 ) 0.9141
x 4 0.4
f ( x 4 ) 0.852
x5 0.5
f ( x 5 ) 0.779
x 6 0.6
f ( x 6 ) 0.697
x 7 0.7
f ( x 7 ) 0.613
x8 0.8
f ( x8 ) 0.527
x9 0.9
f ( x 9 ) 0.445
x10 1
f ( x10 ) 0.369
Trapezoidal Rule
f
(
x
)
f
(
x
)
f
(
x
)
f
(
x
)
f
(
x
)
f
(
x
)
f
(
x
)
f
(
x
)
f
(
x
)
f
(
x
)
2 0 1 2 3 4 5 6 7 8 9
b
a f (x)dx h 1
f ( x10 )
2
1
0.359
1
ydx
0
.
1
0
.
99
0
.
96
0
.
914
0
.
852
0
.
779
0
.
697
0
.
613
0
.
527
0
.
445
0 2
2
0.1 6.7780 0.6678
Q #4
:
P 112
Here
f ( x)dx
f ( x)
h
x
x0 1
dx
1 x4
1
, a 1, b 2, n 6
1 x4
b a 2 1 1
n
6
6
f ( x)
1
1 x4
f ( x0 ) 0.5
30
Numerical Analysis
x1 1
1
1.2
6
f ( x1 ) 0.325
x2 1
2
1.3
6
f ( x 2 ) 0.259
x3 1
3
1.5
6
f ( x3 ) 0.165
x4 1
4
1.7
6
f ( x 4 ) 0.107
x5 1
5
1.8
6
f ( x5 ) 0.087
x6 1
6
2
6
f ( x 6 ) 0.059
Trapezoidal Rule
1
1
f ( x0 ) f ( x1 ) f ( x 2 ) f ( x3 ) f ( x 4 ) f ( x5 ) f ( x 6 )
2
2
f ( x)dx h
1
1 0. 5
0.059
dx
0.325 0.259 0.165 0.107 0.087
4
6
2
2
1 x
1
1.223 0.205
6
= 0.4088
Answer
31