159 views

save

- Matrix and Determinants(2012)
- Mathematics
- Syllabus 2
- Fully Discrete Finite Element Approximation for the Stabilized Gauge-Uzawa Method to Solve the Boussinesq Equations
- BCA(Rev Syll-I-Sem) Assignment for July 2012 and Jan 2013 Sessionn
- Linear Algebra
- Workout ITER
- Syllabus IT II Year[1]
- 02JCP.ps
- CSE Final Upto 4h Year Syllabus 27.07.13 (WBUT)
- Course Compact Gec320
- Chapter 3
- 01. Linear-simplex and Gaussian Elimination
- w2
- Homework 6 Solutions
- mtechvlsi230209
- Reaction Diffusion 10 x Faster
- Finite Element Method for Eigenvalue Problems in Electromagnetics
- Lorenz2
- Case of Study v Python
- MELJUN CORTES ALGORITHM Transform-And-Conquer Algorithm Design Technique II
- Chap 01
- Stochastic DP Problems
- NoorSyazanaNgarisanMFS2014
- Ch06.pdf
- GRE - Basic Algebra Refresher
- 35 Index I to Z
- Numerical Methods and statics
- week11c1
- mtechvlsi230209
- Assign - I
- 4th Year Paper C of Maths - 2013
- Numerical Analysis(B.sc.)
- ullahAMS49-52-2013
- 3rd Year Syll
- Whole Chapters
- Review of Numerical Analysis
- 1.2.docx
- 9709_w11_ms_42
- Inayat Ullah Lecturer in Mathematics
- A 01
- Asdflkjds
- 489217
- Guess for XII
- 9709_y03_sw_3

Chapter # 2

Solution of Algebraic and Transcendental Equations

Notes:

(1)

**Linear Equations: An equation in which the highest power of variable is “One”
**

is called linear equation. e.g.

x+2=0

2x + 10 = 0 etc

(2)

**Non-Linear Equation: Equation involving higher powers of a variable is called
**

Non-Linear Equation.e.g.

x3 + 4x2 + 10x + 3 = 0

x4 + 9x2 + 20 = 0

**(3) Transcendental Equation: Equation involving functions of variable
**

(e.g. Trigonometric, Exponential and logarithmic functions etc) is called

Transcendental Equation.e.g.

Sinx = 6x + 2

ex – lnx = 20

e-x – Sinx = 0

(4) There are two methods of solving Non-Linear and Transcendental Equations.

Numerical Method.

Analytical Method

Types of Numerical Method

(i) Newton Raphson Method

(ii) Secant Method

(iii) False Position Method

(iv) Bisection Method

(v) Iterative Process

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

1

Numerical Analysis

2

**The process of finding Successive approximation to a quantity is called an iterative
**

process.

Type No # 1

Newton Raphson method

KEY

.f(x) =

(Given)

d

f ( x) and put x = xn in f(x) and f ′(x ) .

Find f ′(x) i.e.

dx

** Interval or initial point x0 will be given if not, put x = 0, 1, 2, 3, 4, ………….in f(x).
**

If f(x) changes its sign for any two close values of x, the interval will be that one

and the small value of the interval will be x0.

Finally put n = 0, 1, 2, 3, 4, …………… in the formula:

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 =

3

3

**Squaring both sides
**

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

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

Using Newton Raphson Method

x n +1 = x n −

f ( xn )

f ′( x n )

2

x n +1 = x n −

2

2

2

xn − 3 2xn − 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

For n = 0, equation (1) ⇒ x1 =

2 x0

2

2

2

For n = 1, equation (1) ⇒ x 2 =

x1 + 3 2 2 + 3 4 + 3 7

=

=

= = 1.75

2 x1

2(2)

4

4

2

x 2 + 3 (1.75) 2 + 3 6.0625

=

=

= 1.732149

For n = 2, equation (1) ⇒ x 3 =

2 x2

2(1.75)

3.5

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

3

Numerical Analysis

2

x 3 + 3 (1.732149) 2 + 3

=

= 1.7320508

For n = 3, equation (1) ⇒ x 4 =

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)

Using Newton Raphson Method

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)

2

2

x n e xn + x/ n e xn − x/ n e xn + 1

x n e xn + 1

⇒ x n +1 =

⇒ x n +1 = xn

---------> (1)

e xn ( x n + 1)

e ( x n + 1)

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

4

Numerical Analysis

5

For n = 0, equation (1) =>

2

x0 e x0 + 1

x1 = x0

e ( x0 + 1)

x1 =

⇒

**12.e1 +1 2.7183 +1 3.7183
**

=

=

= 0.6839

e1 (1 +1) 2.7183 × 2 5.4365

x1 = 0.6839

For n = 1, equation (1) =>

**x1 e x1 + 1 ( 0.6839) e 0.6839 + 1 0.4677× 1.9816+ 1 1.9267
**

x2 = x1

=

=

=

= 0.5776

1.9816× 1.6839 3.3368

e ( x1 + 1) e 0.6839(0.6839+ 1)

2

2

For n = 2, equation (1) =>

**x2 e x2 + 1 ( 0.5776) e 0.5776 + 1 0.3336× 1.7816+ 1 1.5944
**

x3 = x2

=

=

=

= 0.5672

1.7816× 1.5776 2.8109

e ( x2 + 1) e 0.5776(0.5776+ 1)

2

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:

x n +1 =

x n −1 f ( x n ) − x n f ( x n −1 )

f ( x n ) − f ( x n −1 )

f(x) will be given.

For f(xn) and f(xn-1) put x = xn and x = xn-1 in the given function f(x).

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

6

** Interval (x0, x1) will be given or individually the values of x0 and x1 will be given,
**

if not then 1st we find the values of x0 and x1 by putting x = 0, 1, 2, 3, 4,

………….. to get the change in sign for f(x).

Finally put n = 1, 2, 3, 4, …………….. in the formula. The root will be that for

which two values of x coincide.

(ii) To solve xx = 10 by Secant Method.

Let f(x) = xx – 10 ⇒ f(xn) = x n

xn

− 10 ⇒ f(xn-1) = xn−1

xn −1

− 10

**Using Secant Method
**

x n +1 =

x n −1 f ( x n ) − x n f ( x n −1 )

--------> (1)

f ( x n ) − f ( x n −1 )

**as root lies in the interval (2, 3) ⇒ x0 = 2 and x1 = 3
**

equation (1) ⇒

x

x n +1 =

x n −1 ( x n n − 10) − x n ( x n −1

xn

( x n − 10) − ( x n −1

xn −1

x

=

x n −1 ( x n n − 10) − x n ( x n −1

x

x n n − x n −1

xn −1

− 10)

− 10)

xn − 1

=

xn

x n − 10 − x n −1

xn −1

xn − 1

− 10)

+ 10

− 10)

xn −1

x

⇒ x n +1 =

x

x n −1 ( x n n − 10) − x n ( x n −1

x n −1 .x n n − 10x n −1 − x n .x n −1

x

x n n − x n −1

xn − 1

xn −1

+ 10x n

− −− > (1)

For n = 1, equation (1) ⇒

x

x2 =

x

x 0 .x1 1 − 10x 0 − x1 .x 0 0 + 10x1

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

For n = 2, equation (1) ⇒

x3 =

x3 =

x1 .x 2

x2

x

− 10 x1 − x 2 .x1 1 + 10 x 2

x2

x2

− x1

x1

=

**3( 2.2609 ) 2.2609 − 10( 3 ) − 2.2609( 3 )3 + 10( 2.2609 )
**

( 2.2609 ) 2.2609 − 3 3

**18.9721 − 30 − 61.0443 + 22.6090 − 49.4632
**

=

= 2.3923

6.3240 − 27

− 20.6760

For n = 3, equation (1) ⇒

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

x 2 .x 3

x4 =

x4 =

x3

− 10 x 2 − x 3 .x 2

x3

x3

− x2

x2

+ 10 x 3

x2

=

7

**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

**182189 − 22.6090 − 15.1290 + 23.9230 4.4039
**

=

= 2.4546

8.0582 − 6.3240

1.7342

For n = 4, equation (1) ⇒

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

**21.6802 − 19.7798 − 23.9230 + 24.5460 2.5234
**

=

= 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)

Formula for False position is

xi = x L +

f ( xL )[ xR − xL ]

f ( xL ) − f ( xR )

Where

**xL = Lower value of the interval
**

xR = Upper value of the interval

(2)

The function f(x) will be given.

(3)

**The interval will be given, if not then put x = 0, 1, 2, 3,………….in f(x).
**

If f(x) changes its sign for any two consecutive values of x, the interval will be

that one.

(4)

We put all these values in the formula (1) to get xi.

(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:

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

(6)

8

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

**now f(xi) = f(1.79) = sin(1.79) -0.5(1.79) = 0.9760-0.895=0.081
**

(Not nearly equal to zero. So we proceed)

We have the following situation

.f(xL)

= 0.3414

(+ve)

.f(xR) = - 0.0907 (-ve)

.f(xi)

= 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

**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

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

9

BISECTION METHOD

OR

BOLZANO METHOD

KEY

•

The value of f(x) will be given.

•

**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

f(x1) = f(π /2) = sinπ /2 -π /2/2 = 1 – π /4 = 1 – 0.785 = 0.215 (+ve)

And

f(x2) = f(π ) = sinπ - π /2 = 0 – 1.571 = -1.571(-ve)

**As f(x) changes its sign for x1 = π /2 and x2 = π
**

⇒ the interval is (π /2, π ) or (1.571, 3.142)

Now we find the mid point of x1 and x2

Mid point = x =

**x1 + x 2 1.571 + 3.142
**

=

= 2.356

2

2

**Put this value of x in (1)
**

.f(x) = f(2.356) = sin(2.356) – 2.356/2 = -0.471

(not nearly equal to zero, so we proceed)

For the next step we have:

.f(x1) is +ve

f(x2) is – ve

f(x) is – ve

**⇒ x1 = 1.571 and x2= x = 2.356
**

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

[we choose x as x2 because f(x2) and f(x) have same sign]

And f(x1) = 0.215 (+ve), f(x2) = f(x) = - 0.471 (-ve)

Now mid point = x =

**x1 + x 2 1.571 + 2.356
**

=

= 1.963

2

2

**Put this value of x in equation (1)
**

.f(x) = f(1.963) = sin(1.963) – 1.963/2 = -0.058

(not nearly equal to zero, so we proceed)

For the next step, we have:

.f(x1) = 0.215 (+ve), f(x2) = - 0.471 (-ve), f(x) = -0.058 (-ve)

⇒ x1 is the same and x2 = x = 1.963

So, mid point = x =

**x1 + x 2 1.571 + 1.963
**

=

= 1.767

2

2

Put in equation (1)

.f(x) = f(1.767) = sin(1.767) – 1.767/2 = 0.097

(Not nearly equal to zero, so we proceed)

For the next step, we have:

.f(x1) = 0.215 (+ve), f(x2) = - 0.058 (-ve), f(x) = 0.097 (+ve)

⇒ x1 = x = 1.767 and x2 = 1.963 (which is the same)

So, Mid point = x =

**x1 + x2 1.767 + 1.963
**

=

= 1.865

2

2

Put in equation (1)

.f(x) = f(1.865) = sin(1.865) – 1.865/2 = 0.024

(Not nearly equal to zero, so we proceed)

For the next step, we have:

.f(x1) = 0.097 (+ve), f(x2) = - 0.058 (-ve), f(x) = 0.024 (+ve)

⇒ x1 = x = 1.865 (Changed)

So , Mid point = x =

and

x2 = 1.963 (Not changed)

**x1 + x2 1.867 + 1.963
**

=

= 1.889

2

2

**Put this value of x in equation (1)
**

.f(1.889) = sin(1.889) – 1.889/2 = 0.004

This value of f(x) is nearly equal to Zero. Hence the root is x = 1.889(ANSWER)

CHAPTER # 3

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

10

Numerical Analysis

11

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

4

−3

2

−3

i.e.

7 x1 10

5

x 2 = 12

−9

x 3

16

Ax = c

2

Where A = 8

4

−3

2

−3

7

5

and is called coefficient matrix

−9

10

c = 12 which is called column matrix or column vector.

16

Augmented Matrix is:

2

Ac = 8

4

−3

2

−3

10

5 12

−9 16

7

**The system of linear equations can be solved by two methods.
**

•

•

Direct Method.

Iterative Method.

Types of Direct Method

•

•

•

•

•

Crammer’s Rule

Gauss Elimination Method.

Gauss Jordan Method.

Method of Inversion.

Choleski’s Factorization Method.

TYPE NO. 1

CRAMMER’S RULE

KEY

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

12

•

•

•

**Write the system of equations in Matrix form i.e. Ax = c
**

Find |A|. If |A| ≠0, solution exists and if |A| = 0, then solution does not exit.

Find |A1|, |A2|, |A3|, where |A1|, |A2| and |A3| are the determinants obtained by

replacing the 1st , 2nd and 3rd column of A by c respectively.

•

The solution is: x1 =

•

**The solution set will be written as: a = (x1, x2, x3) T
**

Where T stands for Transpose

A1

A

, x2 =

A2

A

, x3 =

A3

A

.

Q.3/Page # 84

Solve the system of equations by using Crammer’s 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

2

3.14 4.02 2.16 x 3 9.16

i.e.

Ax = c

1st we find |A|

|A| =

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

2.16[ (1.67)(2.16) – (4.02)(7.21)]

- 3.75[(4.21)(2.16) – (7.21)(3.14)]

+ 0.98[(4.12)(4.02) – (3.14)(1.67)]

2.16(3.60 – 28.98) – 3.75(8.90 – 22.64) + 0.98(16.56 – 5.24)

- 54.82 + 51.52 + 11.09 = 7.79 ≠0

⇒ Solution exists.

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

8.68

| A 1 |= 0.25

9.16

Now

3.75

1.67

4.02

Expanding

= 8.68

0.98

7.21

2.16

by R 1

1.67

4.02

7.21

2.16

−3.75

0.25

9.16

=8.68(3.60

- 28.98) - 3.75(0.54

= −220 .298 +245 .62 −13 .999

2.16

| A 2 |= 4.12

3.14

Also

Expanding

13

8.68

0.25

9.16

7.21

0.25

+0.98

2.16

9.16

- 66.04) +0.98(1.005

= 11 .32

1.67

4.02

- 15.29)

0.98

7.21

2.16

by R 1

=2.16(0.54

- 66.04) - 8.68(8.89

- 22.64)

=- 141.48 +119.35 +36.21 =14.08

2.16

And | A 3 |= 4.12

3.14

Expanding

3.75

1.67

4.02

+0.98(37.74

- 0.785)

8.68

0.25

9.16

by R 1

= 2.16(15.29 - 1.005) - 3.75(37.74 - 0.785) +8.68(16.56

=30.85 - 138.58 +98.257 = - 9.4724

- 5.24)

| A1 | 11.32

=

=1.44

|A|

7.79

| A 2 | 14 .08

=

=

=1.798

|A|

7.79

| A | −9.4724

= 3 =

= −1.209

| A|

7.79

So x 1 =

x

2

x

3

Hence the solution

is : x = ( x1 , x 2 , x3 ) T = (1.44 ,1.798 ,−1.209 ) T

**Some important Hints
**

(i) Elementary Row Operation (ERO)

The operations over a matrix A are called elementary row operations if:

• Any two rows of A are interchanged i.e. Ri j

• Any row of A is multiplied by a non-zero element. i.e. KRi

• Any row of A is added to a scalar multiple of another row of A. i.e. Ri ± KRj

(ii) Echelon Form of a Matrix

A matrix is said to be echelon matrix if:

• The first non-zero element of each row is non – zero [as a special case 1]

• The number of zeros on L.H.S of “1” (one) increases row by row.

• Zero row is the last one

Example

1

0

A=

0

0

2

1

0

0

3

5

1

0

4

6

−3

1

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

(iii) Reduced Echelon form

A matrix is called in reduced Echelon form if:

• It is in Echelon form.

• If “1” lies in any column, the remaining Entries in that column will be Zero.

Example:

1

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 x1 7

1 − 1 4 − 2 x 5

2 =

3 2 1 4 x3 3 1

4 − 3 3 − 3 x4 − 5

Ax = c

Using Gauss Elimination Method, We write the system in tabular form as:

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

14

Numerical Analysis

R20

15

Rows

X1

X2

X3

X4

C

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 ⇒ x2 − 5 x3 + 3x 4 = −3 ⇒ x 2 − 5(4) + 3(5) = −3 ⇒ x2 − 20 + 15 = −3 ⇒ x 2 = −3 + 5 ⇒ x 2 = 2

R19 ⇒ x3 −

1

3

1

7

1

3

1

7

5 7

x2 + 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

T

T

x

=

(

x

,

x

,

x

,

x

)

=

(

1

,

2

,

4

,

5

)

Hence

1

2

3

4

R17 ⇒ x1 −

Q.1(ii)/Page # 83

X1 + x2 + x3 + x4 = 4

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

16

**2x1 + 3x2 + 7x3 – x4 = 11
**

3x1 – 2x2 + 5x3 – 3x4 = 3

4x1 – 5x2 – 2x3 – 3x4 = -6

Ans:

Matrix form is

1

2

3

4

1

3

−2

−5

1 x1 4

−1

x 2 = 11

− 3 x3 3

− 3x 4 − 6

1

7

5

−2

Ax = c

Using Gauss Jordon Method in tabular form:

Row

Explanation

Eq(1)

Eq(2)

Eq(3)

Eq(4)

Rows

X1

X2

X3

X4

C

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

R15–8/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

R24 ⇒ x4 = 1

R23 ⇒ x3 = 1

R22 ⇒ x2 = 1

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

17

R21 ⇒ x1 = 1

T

T

Hence the solution is: x = ( x1 , x 2 , x3 , x 4 ) = (1,1,1,1) Answer

Type No. 4

Method of Inversion

Key

•

•

•

•

**Write the system of equation in matrix form.
**

Re-write it as x = A-1c

Find A-1 by Gauss Jordan Method.

Tabular form of this method contains co-efficient Matrix and the identity matrix.

Change the co-efficient Matrix to identity Matrix by ERO and get the values of

unknowns.

Identity Matrix is:

1

I = 0

0

0

1

0

0

0

etc.

1

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

2.93

x3

−6.90

Ax = c

x = A-1c -(1)

We 1st find A-1 by Gauss Jordan Method

Rows

X1

X2

X3

C1

C2

C3

Row

Explanation

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

18

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

Equation (1) ⇒

x1 −0.24

x 2 = 0.36

x3

0.34

−0.34

−0.04

0.36

−0.34

−0.04

0.36

0.14

−0.08

0.11

0.14 11 .25

−0.08

4.91

0.11

−6.90

x1 − 2.74 −1.70 −0.99 −5.40

x 2 = 4.01 −0.24 + 0.61 = 4.38

x3

3.90 +1.78 + 0.74

6.43

T

T

Hence the solution is: x = ( x1 , x2 , 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

If in a Matrix, aij =0 for i ≠ j and atleast one aii ≠ 0

For example

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

2

A= 0

0

(iv)

6

0

**Upper Triangular Matrix
**

If aij = o, for i > j and there exists at least one non-zero entry for i < j .

For example

3

U = 0

0

(v)

0

0

where 2, 6, 3 are called diagonal elements.

3

0

2

7

0

5

9

6

**Lower Triangular Matrix
**

If aij = 0, for i < j and there exists at least one non-zero entry for i > j

For example

4

L = −9

1

0

2

6

0

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

If A = a21 a22 a23 , then

a31 a32 a33

a11 a12 a13 1 0 0 u11 u12 u13

a

a22 a23 = l21 1 0 . 0 u 22 u 23

21

a31 a32 a33 l31 l32 1 0

0 u33

TYPE NO. 5

CHOLESKI’S METHOD

KEY

• Given a system of equation: Ax = c

• Find L and U such that: LU = A

• Where L is the lower triangular matrix with diagonal elements “1” and U is upper

triangular Matrix.

• Let y = (y1, y2, y3,…………., yn)T

• Find y by using:

Ly = c

• Find x = (x1, x2, x3, ……..xn)T by using Ux = y which is the solution

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

19

Numerical Analysis

20

Q.17/Page # 88

1

Decompose the Matrix A = 2

2

3

7

in to the product of LU. Where L is the unit

12

2

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

2

8

16

3 1

7

= l 21

l

12

0

1

l 32

31

⇒ u11 = 1

l21.u11 + 0 + 0 = 2

l21(1) = 2

⇒ l21= 2

l31.u11 + 0 = 2

l31(1) = 2

⇒ l31 = 2

1

hence L = 2

2

0

1

3

0 u11

0. 0

1 0

u12

u 22

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

0

1

0 and U =

0

1

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

**Now we find the solution set of the system
**

To find y such that:

L

y = c

1 0 0 y1 2

2 1 0 y = 7

2

2 3 1 y 10

3

y +0+0 2

1

2 y1 + y 2 + 0 = 7

2 y + 3 y + y 10

1

2

3

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

21

⇒ 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

1

0

0

2

4

0

3 x1 2

1

x 2 = 3

−3

3

x3

x1 +2 x 2 +3 x3 2

0 + 4 x 2 + x3 = 3

0 +0 +3 x

−3

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

**Diagonally Dominant Matrix
**

A square Matrix A whose elements are aij is said to be diagonally dominant if:

n

aii ≥ ∑ aij

, i = 1,2, ……………n

i=1

i≠ j

Example

a

11

Let A = a 21

a

31

a12

a 22

a32

a13 5

1

a 23 = 3 − 12

a33 1 − 4

−2

3

− 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

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

There are two types of Iterative Methods

• Jacobi Method

• Gauss Seidel Method.

Type # 1

Jacobi’s Method

KEY

• Write down the system in Diagonally Dominant form

• Write down the Diagonally Dominant form in Iterative form.

• Find 1st Iteration by Putting x0 = (0, 0, 0, 0,………)T

• We continue this process until we get the required accuracy.

Q.16/ Page # 87

Solve the system of equations

x1 + 0.1x2 = 1.0

0.1x1 + x2 + 0.1x3 = 2

0.1x2 + x3 = 3

Using (i) Jacobi’s Method.

(ii) Gauss Seidel Method.

Ans:

(i) 1st we will use the Jacobi’s Method

x1 + 0.1x2 = 1.0

0.1x1 + x2 + 0.1x3 = 2

0.1x2 + x3 = 3

The system is already in diagonally dominant form. So it can be written as:

. x1 = 1 – 0.1x2

. x2 = 2 – 0.1x2 – 0.1x3 -----------------> (A)

. x3 = 3 – 0.1x2

1st Iteration

Put x1 = x2 = x3 = 0 in (A)

⇒

x1 = 1 , x2 = 2 and x3 = 3

2nd Iteration

Put x1 = 1, x2 = 2 and x3 = 3 in (A)

⇒

x1 = 1 – (0.1)2 = 1 – 0.2 = 0.80

x2 = 2 – (0.1) 1 – (0.1) 3 = 2 – 0.1 – 0.3 = 1.6

x3 = 3 – (0.1)2 = 3 – 0.2 = 2.8

3rd Iteration

Put x1 = 0.80, x2 = 1.6 and x3 = 2.8 in (A)

⇒

x1 = 1 – (0.1) (1.60) = 0.84

.

x2 = 2 – (0.1)(0.80) – (0.1)(2.8) = 1.64

x3 = 3 – (0.1)(1.6) = 2.836

th

4 Iteration

Put x1 = 0.84, x2 = 1.64 and x3 = 2.836 in (A)

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

22

Numerical Analysis

⇒

x1 = 1 – (0.1) (1.64) = 0.836

x2 = 2 – (0.1)(0.84) – (0.1)(2.846) = 1.6324

x3 = 3 – (0.1)(1.64) = 2.836

This converges to the exact solution. Hence the solution is:

x1 = 0.836, x2 = 1.6324 and x3 = 2.836

(ii) Now we will use Gauss Seidel Method to solve the system.

Since

. x1 = 1 – 0.1x2-----------------------> (1)

. x2 = 2 – 0.1x2 – 0.1x3-------------> (2)

. x3 = 3 – 0.1x2 ----------------------> (3)

1st Iteration

Put x2 = 0 in (1) ⇒ x1 = 1

Put x1 = 1 and x3 = 0 in (2)

⇒

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)

⇒

x2 = 2 – (0.1)(0.801) – (0.1)(2.801) = 1.640

Put x2 = 1.640 in (3)

⇒

x3 = 3 – (0.1)(1.640) = 2.836

rd

3 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)

⇒

x2 = 2 – (0.1)(0.836) – (0.1)(2.836) = 1.632

Put x2 = 1.632 in (3)

⇒

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

2x1 + x2 – 8x3 = -15

x1 – 7x2 + x3 = 10

Using Gauss Seidel method with initial vector x0 = (0, 0, 0)T

Ans:

1st we will write the system in Diagonally Dominant form by interchanging 2nd and 3rd equations.i.e.

6x1 – 3x2 + x3 = 11

x1 – 7x2 + x3 = 10

-----------> (A)

2x1 + x2 – 8x3 = -15

Writing the system (A) as:

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

23

Numerical Analysis

24

x1 = 1/6(11 + 3x2 – x3)----------> (1)

x2 = 1/7(-10 + x1 + x3)----------> (2)

x3 = 1/8(15 + 2x1 + x2)---------> (3)

1st Iteration

Put x2 = x3 = 0 in (1)

⇒

x1 = 1/6(11+0 – 0) = 1.833

Put x1 = 1.833 and x3 = 0 in (2)

⇒

x2 = 1/7(- 10 + 1.833 + 0) = - 1.166

Put x1 = 1.833 and x2 = - 1.166 in (3)

⇒

x3 = 1/8(15 + 2(1.833) – 1.166) = 2.125

nd

2 Iteration

Equation (1) ⇒ x1 = 1/6[11 + 3(- 1.166) – 2.125] = 0.885

Equation (2) ⇒ x2 = 1/7[- 10 + 0.885 + 2.125] = - 0.989

Equation (3) ⇒ x3 = 1/8[15 + 2(0.885) – 0.989] = 1.972

3rd Iteration

Equation (1) ⇒ x1 = 1/6[11 + 3(- 0.989) – 1.972] = 1.001

Equation (2) ⇒ x2 = 1/7[- 10 + 1.001 + 1.972] = - 1.003

Equation (3) ⇒ x3 = 1/8[15 + 2(1.001) – 1.003] = 2.000

Which converges to the real solution. i.e x1 = 1, x2 = - 1 and x3 = 2

hence the solution is x = (x1, x2, x3)T = (1, -1, 2)T

Q.9/Page # 86

The pair of equations

.x1 + 2x2 = 3.0

.3x1 + x2 = 4.0

Can be re-arranged to give:

x1 = 3 – 2x2

x2 = 4 – 3x1

Apply Jacobi’s Method to this arrangement, beginning with x = (1.01, 1.01)T and notice the system diverges.

Now apply Gauss Seidel method to system and comment which method diverges more rapidly.

Ans: Given that:

x1 = 3 – 2x2

.x2 = 4 – 3x1

1st we use Jacobi’s Method

1st Iteration

put x1 = 1.01 and x2 = 1.01 in the above equations.

.x1 = 3 – 2(1.01) = 0.98

.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

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

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)

⇒

x1 = 3 – 2(1.01) = 0.98 put in (2) ⇒ x2 = 4 – 3(0.98) = 1.06

2nd Iteration

equation (1) ⇒ x1 = 3 – 2(1.06) = 0.88

equation (2) ⇒x2 = 4 – 3(0.88) = 1.36

3rd Iteration

equation (1) ⇒ x1 = 3 – 2(1.36) = 0.28

equation (2) ⇒ x2 = 4 – 3(0.28) = 3.16

4th Iteration

equation (1) ⇒ x1 = 3 – 2(3.16) = - 3.32

equation (2) ⇒ x2 = 4 – 3(- 3.32) = 13.96

5th Iteration

equation (1) ⇒ x1 = 3 – 2(13.96) = - 24.92

equation (2) ⇒ x2 = 4 – 3(- 24.92) = 78.76

6th Iteration

equation (1) ⇒ x1 = 3 – 2(78.76) = - 154.52

equation (2) ⇒ x2 = 4 – 3(- 154.52) = 467.56

After 6th Iteration x1 = - 154.52 and x2 = 467.56. i.e. x = (- 154.52, 467.56)T. which is diverging.

Comment: After six iterations we see that Gauss Seidel Method diverges rapidly than the Jacobi’s Method.

CHAPTER#4

Numerical Integration

1. Trapezoidal Rule or Trapezium Rule.

b

∫

a

1

1

f ( x ) dx = h f ( x 0 ) + f ( x1 ) + f ( x 2 ) + .......... .... + f ( x n )

2

2

Where

h=

b −a

n

2. Simpson’s Rule

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

25

Numerical Analysis

b

∫

a

f ( x) dx =

26

h

[ f ( x0 ) + 4 f ( x1 ) + 2 f ( x 2 ) + 4 f ( x3 ) + 2 f ( x 4 ) + 4 f ( x5 ) + .......... ....... + f ( x n )]

3

h=

Where

b −a

n

**Error = Approximate value – True value
**

EXERCISE ON PAGE 112

Q #1

:∫

P − 112

b

a

3

1

f ( x ) dx = ∫ ( x + ) dx

2

x

f ( x) = x +

Here

h=

1

, a = 2, b = 3, n = 4

x

b−a 3−2 1

=

=

n

4

4

x

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

Apply Trapezoidal Rule

b

∫

a

3

1

1

f ( x ) dx = h f ( x 0 ) + f ( x1 ) + f ( x 2 ) + f ( x3 ) + f ( x 4 )

2

2

1

1 2.5

3.333

+ 2.694 + 2.9 + 3.114 +

2

2

∫ ( x + x )dx = 4

2

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

Numerical Analysis

=

1

(1.25 + 8.708 +1.667 )

4

=

1

×11 .625 = 2.9063

4

**For true value
**

1

3

3

∫ ( x + x )dx = ∫

2

2

=

x2

2

3

xdx + ∫

2

1

dx

x

3

+ ln x

3

2

2

=

1 2

(3 − 2 2 ) + (ln 3 − ln 2)

2

=

1

(9 − 4) + (1.099 − 0.693 )

2

= 2.5 + 0.406 = 2.906

Error = Approximate value – True value = 2.9063 − 2.906 = 0.0003

(ii)

b

∫

a

2

f ( x )dx = ∫

0

1

dx

e4x

f ( x) =

Here

h=

1

= e − 4 x , a = 0, b = 2, n = 4

e4x

b−a 2−0 2 1

=

= =

n

4

4 2

x

f ( x ) = e −4 x

x0 = 0

f ( x 0 ) = f (0) = e 0 = 1

x1 = 0 +

1

= 0.5

2

f ( x1 ) = f (0.5) = e −4( 0.5) = 0.135

x2 = 0 +

2

=1

2

f ( x 2 ) = f (1) = e −4 = 0.018

x3 = 0 +

3

= 1.5

2

f ( x3 ) f (1.5) = e −4 (1.5) = 0.002

x4 = 0 +

4

=2

2

f ( x 4 ) = f (2) = e −8 = 0.0003

Trapezoidal rule

b

∫

a

1

1

f ( x )dx = h f ( x 0 ) + f ( x1 ) + f ( x 2 ) + f ( x3 ) + f ( x 4 )

2

2

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

27

Numerical Analysis

=

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

=

)

**For true value
**

2

∫

0

e −4 x dx =

e −4 x

−4

2

=−

0

1 −4 x

e

4

2

0

1

= − (e −8 − e 0 )

4

1

= − (0.0003 −1)

4

1

= − (−0.9997 ) = 0.2499

4

**Error = Approximate value – True value
**

=0.3275-0.2499=0.0776

Q #2

:

P − 112

Here

b

∫

a

2

f ( x)dx = ∫ ( x 4 − x 2 +1) dx

1

f ( x) = x 4 − x 2 + 1, a = 1, b = 2, n = 2

h=

x

b − a 2 −1 1

=

=

n

2

2

f ( x ) = x 4 − x 2 +1

x0 =1

f ( x 0 ) = f (1) = 1 −1 +1 = 1

x1 = 1 +

x2 = 1 +

1

= 1.5

2

2

=2

2

f ( x1 ) = f (1.5) = (1.5) 4 − (1.5) 2 + 1 = 3.8125

f ( x 2 ) = f ( 2) = ( 2) 4 − ( 2) 2 + 1 = 13

Simpson’s 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 ]

b

∫

f ( x ) dx =

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

28

Numerical Analysis

1

(1 +15 .2500 +13 )

6

1

= × 29 .2500 = 4.8760

6

=

(ii)

b

∫

a

2

f ( x ) dx =∫ e x sin xdx

0

Here

f ( x) = e x sin x, a = 0, b = 2, n = 2

h=

b −a 2−0 2

=

= =1

n

2

2

x

f ( x) = e x sin x

x0 = 0

f ( x 0 ) = 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

Simpson’s 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 ]

b

∫

a

f ( x )dx =

1

×15 .8668

3

= 5.2886

=

Q #3

: ∫

P − 112

b

a

Here

1

f ( x ) dx = ∫ ydx

0

a = 0, b =1, h = 0.1

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

29

Numerical Analysis

x

f ( x) = y

f ( x 0 ) =1

x 0 = 0. 2

x1 = 0.1

f ( x1 ) = 0.99

x 2 = 0.2

f ( x 2 ) = 0.961

x3 = 0.3

f ( x3 ) = 0.9141

x 4 = 0.4

f ( x 4 ) = 0.852

x 5 = 0. 5

f ( x5 ) = 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

x 9 = 0. 9

f ( x9 ) = 0.445

x10 = 1

f ( x10 ) = 0.369

Trapezoidal Rule

1

f (x0 ) + f (x1 ) + f (x2 ) + f (x3 ) + f (x4 ) + f (x5 ) + f (x6 ) + f (x7 ) + f (x8 ) + f (x9 )

b

2

f

(

x

)

d

=

x

h

∫ a 1

+ f (x1 )0

2

1

0.3 5 9

1

∫ 0 y d= 0x.1 2 + 0.9 +90.9 +60.9 1+ 04.8 5+ 02.7 7+ 09.6 9+ 07.6 1+ 03.5 2+ 07.4 4+ 5 2

0.1 × 6.7780 = 0.6678

Q #4

:

P − 112

Here

b

∫

a

1

f ( x) =

h=

x

2

f ( x ) dx = ∫

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

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

30

Numerical Analysis

x0 =1

f ( x 0 ) = 0.5

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 ( x )dx = h f ( x 0 ) + f ( x1 ) + f ( x 2 ) + f ( x3 ) + f ( x 4 ) + f ( x5 ) + f ( x 6 )

a

2

2

2

1

1 0.5

0.059

∫1 1 + x 4 dx = 6 2 + 0.325 + 0.259 + 0.165 + 0.107 + 0.087 + 2

b

∫

=

1

×1.223 + 0.205

6

= 0.4088

Answer

Prepared by: Inayat Ullah Lecturer in Mathematics Edwardes College Peshawar

31

- Matrix and Determinants(2012)Uploaded byAngel Chavez
- MathematicsUploaded byasifjhung1312
- Syllabus 2Uploaded byH_AbdelMeguid
- Fully Discrete Finite Element Approximation for the Stabilized Gauge-Uzawa Method to Solve the Boussinesq EquationsUploaded bygustavo5150
- BCA(Rev Syll-I-Sem) Assignment for July 2012 and Jan 2013 SessionnUploaded byborntowin08
- Linear AlgebraUploaded byrkhoo_7
- Workout ITERUploaded bydaxov
- Syllabus IT II Year[1]Uploaded byGita Kumari
- 02JCP.psUploaded byManda Ramesh Babu
- CSE Final Upto 4h Year Syllabus 27.07.13 (WBUT)Uploaded byNirmalya123
- Course Compact Gec320Uploaded byNelson
- Chapter 3Uploaded byst6575d
- 01. Linear-simplex and Gaussian EliminationUploaded bySmis Misl
- w2Uploaded byJitesh Tahiliani
- Homework 6 SolutionsUploaded byBridget Williams
- mtechvlsi230209Uploaded byJinu Madhavan
- Reaction Diffusion 10 x FasterUploaded byTom
- Finite Element Method for Eigenvalue Problems in ElectromagneticsUploaded byBhargav Bikkani
- Lorenz2Uploaded byRodrigue Tchamna
- Case of Study v PythonUploaded byEric Zarate Zarlink
- MELJUN CORTES ALGORITHM Transform-And-Conquer Algorithm Design Technique IIUploaded byMELJUN CORTES, MBA,MPA
- Chap 01Uploaded byjigi_here
- Stochastic DP ProblemsUploaded byMehdi Rabbani
- NoorSyazanaNgarisanMFS2014Uploaded byMushahid Yasin Kiyani
- Ch06.pdfUploaded byPatrick Sibanda
- GRE - Basic Algebra RefresherUploaded byRakesh_Ranjan_3304
- 35 Index I to ZUploaded byHector Villanueva Ortega
- Numerical Methods and staticsUploaded byDch Narrasimhan
- week11c1Uploaded byKsblue
- mtechvlsi230209Uploaded byPadmasree Sappa

- Assign - IUploaded byInayat Ullah
- 4th Year Paper C of Maths - 2013Uploaded byInayat Ullah
- Numerical Analysis(B.sc.)Uploaded byInayat Ullah
- ullahAMS49-52-2013Uploaded byInayat Ullah
- 3rd Year SyllUploaded byInayat Ullah
- Whole ChaptersUploaded byInayat Ullah
- Review of Numerical AnalysisUploaded byInayat Ullah
- 1.2.docxUploaded byInayat Ullah
- 9709_w11_ms_42Uploaded byInayat Ullah
- Inayat Ullah Lecturer in MathematicsUploaded byInayat Ullah
- A 01Uploaded byInayat Ullah
- AsdflkjdsUploaded byInayat Ullah
- 489217Uploaded byInayat Ullah
- Guess for XIIUploaded byInayat Ullah
- 9709_y03_sw_3Uploaded byInayat Ullah