0% found this document useful (0 votes)
0 views

Numerical Methods

The document discusses numerical methods for solving equations, including fixed point iteration, Newton-Raphson, and secant methods, along with error analysis and interpolation techniques. It provides detailed procedures for each method and examples demonstrating their application. Additionally, it covers significant digits, absolute and relative errors, and the construction of interpolating polynomials using finite difference operators.

Uploaded by

pritisahu5254
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Numerical Methods

The document discusses numerical methods for solving equations, including fixed point iteration, Newton-Raphson, and secant methods, along with error analysis and interpolation techniques. It provides detailed procedures for each method and examples demonstrating their application. Additionally, it covers significant digits, absolute and relative errors, and the construction of interpolating polynomials using finite difference operators.

Uploaded by

pritisahu5254
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Numerical Methods

By S Abinash

NUMERICAL METHOD

We use numerical method to find approximate solution of problems by numerical calculations with aid of
calculator. For better accuracy we have to minimize the error.

Error = Exact value Approximate value

Absolute error = modulus of error

Relative error = Absolute error / (Exact value)

Percentage error = 100 X Relative error

The error obtained due to rounding or chopping is called rounding error.

For example

or 3.142 for rounding up to 3 decimal places.

Significant digit:

It is defined as the digits to the left of the first non-zero digit to fix the position of decimal point.

For example each of following numbers has 5 significant digits.

0.00025610, 25.610, 25601, 25610

Solution of Equations by Iteration:

Intermediate value Theorem: If a function f(x) is continuous in closed interval [a,b] and satisfies f(a)f(b) < 0
then there exists atleast one real root of the equation f(x) = 0 in open interval (a,b).

Algebraic equations are equations containing algebraic terms ( different powers of x). For example x2-7x+6=0

Transcendental equations are equations containing non-algebraic terms like trigonometric, exponential,
logarithmic terms. For example sin x ex = 0

A. Fixed point iteration method for solving equation f(x) = 0


Procedure

Step-I We rewrite the equation f(x) = 0 of the form x = h(x), x=g(x), x = D(x)

We find the interval (a,b) containing the solution (called root).

Step-II We choose that form say x = h(x) which satisfies I h I < 1 in interval (a,b) containing the
solution (called root).

Step-III We take xn+1 = h(xn) as the successive formula to find approximate solution (root) of the
equation f(x) = 0

Step-III Let x=x0 be initial guess or initial approximation to the equation f(x) = 0
Then x1=h(x1) , x2=h(x2) , x3=h(x3) and so on.We will continue this process till we get solution (root) of
the equation f(x) = 0 up to desired accuracy.

Convergence condition for Fixed point iteration method

If x=a is a root of the equation f(x) = 0 and the root is in interval (a, b). The function h
defined by x = h(x) Is continuous in (a,b) .Then the approximations x1=h(x1) , x2=h(x2) , x3=h(x3) .......
converges to the root x=a provided I I < 1 in interval (a,b) containing the root for all values of x.

Problems

1. Solve x3 - sin x -1 =0 correct to two significant figures by fixed point iteration method correct up
to 2 decimal places.

Solution: x3 - sin x -1 =0...................................................... (1)

Let f(x) = x3-sin x -1

f(0) = -1, f(1)= - 0.8415, f(2)=6.0907

As f(1)f(2)< 0 by Intermediate value Theorem the root of real root of the equation f(x) = 0 lies
between 1 and 2

Let us rewrite the equation f(x) = 0 of the form x = h(x)

x= (1 + Sin x)1/3 = h1(x) and x = Sin-1(x3 - 1)= h2(x)

We see that I h1 I < 1 in interval (1,2) containing the root for all values of x.

We use xn+1= (1 + Sin xn)1/3 as the successive formula to find approximate solution (root) of the
equation (1).

Let x0 =1.5 be initial guess to the equation (1).

Then x1= (1 + Sin x0)1/3 = (1 + Sin 1.5)1/3 = 1.963154

x2= (1 + Sin x1)1/3 = (1 + Sin 1.963154)1/3 = 1.460827

x3= (1 + Sin x2)1/3 = (1 + Sin 1.460827)1/3 = 1.440751

x4= (1 + Sin x3)1/3 = (1 + Sin 1.440751)1/3 = 1.441289

which is the root of equation (1) correct to two decimal places.

Newton Raphson Method

Procedure

Step-I We find the interval (a,b) containing the solution (called root) of the equation f(x) = 0 .

Step-II Let x=x0 be initial guess or initial approximation to the equation f(x) = 0
Step-III We use xn+1 =xn - [f(xn) / n)] as the successive formula to find approximate solution (root)
of the equation f(x) = 0

Step-III Then x1 , x2 , x3 ............ and so on are calculated and we will continue this process till we get
root of the equation f(x) = 0 up to desired accuracy.

2. Solve x - 2sin x - 3 = 0 correct to two significant figures by Newton Raphson method correct up
to 5 significant digits.

Solution: x - 2sin x - 3 = 0 ...................................................... (2)

Let f(x) = x-2sin x - 3

f(0) = -3, f(1)= -2 - 2 Sin 1 , f(2)= -1 - 2 Sin 2 ,f(3)= - 2 Sin 3, f(4)= 1- 2 Sin 4

f(-2)= -5 + 2 Sin 2 ,f(-1)= -4 + 2 sin 1

As f(3)f(4)< 0 by Intermediate value Theorem the root of real root of the equation f(x) = 0 lies
between 3 and 4

Let Let x0 =4 be the initial guess to the equation (2).

Then x1= x0 - [f(x0) / 0)] = 2- f(2)/ .09900


=
x2= x1 - [f(x1) / 1)] - 1.099- f(- 1.099)/ - 1.099) = 3.10448

x3= x2 - [f(x2) / 2)] = 3.10450

x4= x3 - [f(x3) / 3)] = 3.10451

which is the root of equation (2) correct to five significant digits.

Secant Method

Procedure

Step-I We find the interval (a,b) containing the solution (called root) of the equation f(x) = 0 .

Step-II Let x=x0 be initial guess or initial approximation to the equation f(x) = 0

Step-III We use xn+1 = xn - [ (xn - xn-1 )f(xn)] / [f(xn) - f(xn-1)] as the successive formula to find
approximate solution (root) of the equation f(x) = 0

Step-III Then x1 , x2 , x3 ............ and so on are calculated and we will continue this process till we get
root of the equation f(x) = 0 up to desired accuracy.

3 . Solve Cos x = x ex correct to two significant figures by Secant method correct up to 2 decimal
places.

Solution: Cos x = x ex ........................................................ (3)

Let f(x) = Cos x x ex


f(0) = 1, f(1)= Cos 1 e = - 2 .178

As f(0)f(1)< 0 by Intermediate value Theorem the root of real root of the equation f(x) = 0 lies
between 0 and 1

Let Let x0 = 0 and x1 = 1 be two initial guesses to the equation (3).

Then

f(x2)= f (0.31465)= Cos (0.31465) - 0.31465 e0.31465 = 0.51987

which is the root of equation (3) correct to two decimal places.

4. Solve x4 - x - 7 = 0 correct to two significant figures by Newton- Raphson method correct up to


6 significant digits.

Solution: x4 - x - 7 = 0 ...................................................... (4)

Let f(x) = x4 - x - 7

f(0) = -7, f(1)= -7 , f(2)= 5

As f(1)f(2)< 0 by Intermediate value Theorem the root of real root of the equation f(x) = 0 lies
between 1 and 2

Let Let x0 = 1.5 be the initial guess to the equation (2).

Then x1= x0 - [f(x0) / 0)] = 1.5 - f(1.5)/ 1.5) = 1.78541


=
x2= x1 - [f(x1) / 1)] 1.7854- f1.7854)/ 1.7854) = 1.85876

x3= x2 - [f(x2) / 2)] = 1.85643

x4= x3 - [f(x3) / 3)] = 1.85632

which is the root of equation (2) correct to 6S.


INTERPOLATION

Interpolation is the method of finding value of the dependent variable y at any point x using the
following given data.

x x0 x1 x2 x3 .. .. .. xn

y y0 y1 y2 y3 .. .. .. yn

This means that for the function y = f(x) the known values at x = x0 , x1 , x2 , ........ , xn are respectively

y = y0 ,y1 , y2 ,.........,yn and we want to find value of y at any point x.

For this purpose we fit a polynomial to these datas called interpolating polynomial. After getting the
polynomial p(x) which is an approximation to f(x), we can find the value of y at any point x.

Finite difference operators

Let us take equispaced points x0 , x1 , x2 , ........ , xn

i.e. x1 = x0 + h, x2 = x1 + h, ......................, xn = xn - 1 + h

Forward difference operator n= yn + 1 - yn

Backward difference operator y n = yn - yn - 1

i = yi + 1/2 - yi ½

Shift Operator E yi = yi+1

difference Interpolation formula

Let us take the equi-spaced points x0 , x1 = x0 + h, x2 = x1 + h, ......................, xn = xn - 1 + h

Then n= yn + 1 - yn is called the first Forward difference

i.e. 0 = y 1 - y0 , 1 = y 2 - y1 and so on.


2 yn = -
n+1 n is called the second Forward difference
2 2
i.e. y0 1 - 0 , y1 2 - 1 and so on.

difference Interpolation formula is


2 3
Pn (x) = y0 + p 0 + [ p(p y0 + [ p(p 1) (p y0
n
+ ...................... + [ p(p 1) (p 2).......(p-n- y0

Where p = (x - x0)/h
Problems

5. interpolating polynomial and also find the value of y at x=5

x 0 10 20 30 40

y 7 18 32 48 85

Solution

Here x0 = 0, x1 = 10, x2 = 20, x3 = 30, x4 = 40,

x1 - x0= 10 = x2 - x1 = x3 - x2 = x4 - x3

The given data is equispaced.

As x= 5 lies between 0 and 10 and at the start of the table and data is equispaced, we have to use
forward difference Interpolation.

Forward difference table

2 3 4
x y y

0 7

11

10 18 03

14 02

20 32 05 10

19 12

30 51 17

36

40 87

Here x0 = 0, y0 = 7, h= x1 - x0 = 10-0 = 10
2
0 y0 =3 ,
4
3
y0 y0 =10

p = (x - x0)/h = (x - 0)/10 = 0.1x


2 3
Pn (x) = y0 + p 0 + [ p(p y0 + [ p(p 1) (p y0
4
+ [ p(p 1) (p 2)(p- y0
= 7 + 0.1x (11) + [0.1x(0.1x - 1)/2! ] (3) + [0.1x(0.1x - 1) (0.1x - 2)/3! ] (2)

+ [0.1x(0.1x - 1) (0.1x - 2) (0.1x - 3)/4! ] (10)

= 7 + 1.1x + (0.01x2 - 0.1x)1.5 + (0.001x3 - 0.03x2 +0. 2x)/3

+ 0.416 ( 0.0001x4 - 0.006x3 +0. 11x2 -0.6x)

Pn (x) = 0.0000416 x4 - 0.0022 x3 +0.05x2 + 1.26 x +7

Is the interpolating polynomial

To find the approximate value of y at x=5 we put x=5 in the interpolating polynomial to get

y(5)=Pn (5) = 0.0000416 (5)4 - 0.0022 (5)3 +0.05(5)2 + 1.26 (5) +7 = 14.301

6. interpolating polynomial and also find the value of y at x=24

x 20 35 50 65 80

y 3 11 24 50 98

Solution

Here x0 = 20, x1 = 35, x2 = 50, x3 = 65, x4 = 80,

x1 - x0= 15 = x2 - x1 = x3 - x2 = x4 - x3

The given data is equispaced.

As x= 24 lies between 20 and 35 and at the start of the table and data is equispaced, we have to use
forward difference Interpolation.

Here x0 = 20, y0 = 3, h= x1 - x0 = 35 - 20 = 15
2
0 y0 = 5 ,
4
3
y0 y0 = 1

p = (x - x0)/h = (x - 20)/15 = 0.0666 x - 1.333333


Forward difference table

2 3 4
x y y

20 3

35 11 05

13 08

50 24 13 01

26 9

65 50 22

48

80 98

2 3
Pn (x) = y0 + p 0 + [ p(p y0 + [ p(p 1) (p y0
4
+ [ p(p 1) (p 2)(p- y0

= 3 + 8 (0.0666 x - 1.333333) + 5[(0.0666 x - 1.333333) (0.0666 x - 2.333333)/2! ]

+ 8[ (0.0666 x - 1.333333) (0.0666 x - 2.333333) (0.0666 x - 3.333333) /3! ]

+ [ (0.0666 x - 1.333333) (0.0666 x - 2.333333) (0.0666 x - 3.333333) (0.0666 x - 4.333333) /4! ]

= 3 + 0.53333333 x - 10.666666 + 0.01111x2 -0.16666666 x + 7.777777

+ [ (0.5333333 x - 10.66666) (0.0666 x - 2.333333) (0.011111 x - 0.5555555) ]

+ [ (0.0666 x - 1.333333) (0.0666 x - 2.333333) (0.011111 x - 0.5555555) (0.01666 x - 1.083333)]

Is the interpolating polynomial

To find the approximate value of y at x = 24 we put x = 24 in the interpolating polynomial to get

y(24) = Pn (24) = 3 + (0.53333333)24 - 10.666666 + 0.01111(242) (0.16666666)24 + 7.777777

+ [ (0.5333333(24) - 10.66666) (0.0666 (24) - 2.333333) (0.011111 (24) - 0.5555555) ]

+ [ (1.59999 - 1.333333)( 1.59999 - 2.333333) (0.266666 - 0.5555555) (0.399999 - 1.083333)]


Backward difference Interpolation formula

Let us take the equi-spaced points x0 , x1 = x0 + h, x2 = x1 + h, ......................, xn = xn - 1 + h

Then yn = yn - yn - 1 is called the first backward difference

i.e. y 1 = y 1 - y0 , y2 = y 2 - y1 and so on.

2y = yn - yn - 1 is called the second backward difference


n

2 2
i.e. y1 = y1 - y0 , y2 = y2 - y 1 and so on.

backward difference Interpolation formula is


2 3
Pn (x) = yn + p yn + [ p(p + 1)/2! ] yn + [ p(p + 1) (p + 2)/3! ] yn
n
+ ...................... + [ p(p + 1) (p+ 2).......(p +n - 1)/n! ] yn

Where p = (x - xn)/h

7. Using following data to find the value of y at x = 35

x 0 10 20 30 40

y 7 18 32 48 85

Solution :

Here x0 = 0, x1 = 10, x2 = 20, x3 = 30, x4 = 40,

x1 - x0= 10 = x2 - x1 = x3 - x2 = x4 - x3

The given data is equispaced.

As x= 35 lies between 3 0 and 40 and at the end of the table and given data is equispaced ,we have
to use difference Interpolation.

Here x = 35, xn = 40, yn = 87, h= x1 - x0 = 10-0 = 10


2
yn= 36 , yn = 17 ,
3y 4
n= 12, yn=10

p = (x - xn)/h = (35 - 40)/10 = -0.5


Backward difference table

2 3 4
x y y

0 7

11

10 18 03

14 02

20 32 05 10

19 12

30 51 17

36

40 87

2 3
Pn (x) = yn + p yn + [ p(p + 1)/2! ] yn + [ p(p + 1) (p + 2)/3! ] yn
4
+ [ p(p + 1) (p+ 2)(p +3)/4! ] yn

= 87 + (-0.5) (36) + (-0.5) (-0.5+1) (17) /2! + (-0.5) (-0.5+1) (-0.5+2) (12) /3!

+ (-0.5) (-0.5+1) (-0.5+2) (-0.5+3) (10) /4!

= 87 18 0.25(8.5) - 0.25(18)/6 0.25(15)(2.5)/24

= 65.734375

This is the approximate value of y at x=35

y(35)=Pn (35) = 65.734375

Inverse Interpolation

The process of finding the independent variable x for given values of f(x) is called Inverse
Interpolation .
8. Solve ln x = 1.3 by inverse Interpolation using x= G(y) with G(1)=2.718 ,G(1.5)= 4.481 , G(2)=
7.387 ,G(2.5)= 12.179 and find value of x

Forward difference table

2 3
y x y

1 2.718

1.763

1.5 4.481 1.143

2.906 0.743

2 7.387 1.886

4.792

2.5 12.179

Here y0 = 1, h=y1 - y0 = 1.5 - 1 = 0.5


2
x0 = 2.718, 0 x0 = 1.143 ,

3 x0 = 0.743

p = (y - y0)/h = (1.3 - 1)/0.5 = 0.6

difference Interpolation formula is


2 3
Pn (y) = x0 + p 0 + [ p(p x0 + [ p(p 1) (p x0

= 2.718 + 0.6 (1.763)+ 0.6(0.6-1)1.143/2 + 0.6(0.6-1) (0.6-2)0.743/6

= 3.680248

Lagrange Interpolation (data may not be equispaced)

Lagrange Interpolation can be applied to arbitrary spaced data.

Linear interpolation is interpolation by the line through points (x1,y1) and (x0,y0)

Linear interpolation is P1(x)= l0 y0 + l1 y1

Where l0 = (x- x1) /( x0- x1) and l1 = (x- x0) /( x1- x0)
Quadratic Lagrange Interpolation is the Interpolation through three given points (x2,y2) , (x1,y1) and
(x0,y0) given by the formula

P2(x)= l0 y0 + l1 y1 + l2 y2

Where

9. Using quadratic Lagrange Interpolation find the Lagrange interpolating polynomial P2(x)

and hence find value of y at x=2 Given y(0) = 15, y(1) = 48, y(5) = 85

Solution :

Here x0 = 0, x1 = 1, x2 = 5 and y0 = 15, y1 = 48, y2 = 85

x1 - x0 = 1 x 2 - x1 = 4

The given data is not equispaced.

Which is the Lagrange interpolating polynomial P2(x)

Hence at x=2 the value is P2(2) = - 4.75(22)+37.75(2)+15 = 71.5

General Lagrange Interpolation is the Interpolation through n given points (x0,y0), (x1,y1) ,
(x2,y2)....................... , (xn,yn) given by the formula

Pn(x)= l0 y0 + l1 y1 + l2 y2 + ................ + ln yn

x xn ............... x x2 x x1
Where l0
x0 xn ............... x0 x2 x0 x1
10. Using Lagrange Interpolation find the value of y at x=8

Given y(0) = 18, y(1) = 42, y(7) = 57 and y(9) = 90

Solution :

Here x0 = 0, x1 = 1, x2 = 7, x3 = 9 and y0 = 26, y1 = 40, y2 = 75, y3 = 90

x1 - x0 = 1 x 2 - x1 = 6

The given data is not equispaced.

Which is the value of y at x=8


Newton divided difference Interpolation (data may not be equispaced)

Newton divided difference Interpolation can be applied to arbitrary spaced data.

The first divided difference is f [x0 , x1 ] = (y1 - y0 )/ (x1 - x0)

f [x1 , x2 ] = (y2 - y1 )/ (x2 - x1)

The second divided difference is

The third divided difference is

The nth divided difference is

Newton divided difference Interpolation formula is

Y = y0 + (x-x0) f [x0 , x1 ] + (x-x0) (x-x1) f [x0 , x1 , x2] + ............

+ (x-x0) (x-x1) .......... (x-xn-1) f [x0 , x1 , x2. , ........... ,x n ]

Problems

11 interpolating polynomial and also


find the value of y at x= 15

x 0 6 20 45

y 30 48 88 238
ivided difference table

x y First divided Second divided Third divided

difference difference difference

0 30

(48-30)/6=3

6 48 (8-3)/11=0.45

(88-48)/5=8 (0.1 -0.45)/26 = -0.0136

11 88 (10-8)/20=0.1

(238-88)/15=10

26 238

Y = y0 + (x-x0) f [x0 , x1 ] + (x-x0) (x-x1) f [x0 , x1 , x2]

+ (x-x0) (x-x1)(x-x2) f [x0 , x1 , x2. ,x 3 ]

= 30 + 3x + x(x-6) (0.45) + x(x-6)(x-11)( -0.0136)


The value of y at x= 15

= 30 +3(15) +15(9)(0.45)+ 15(9)(4)(-0.0136) = 128.406

NUMERICAL DIFFERENTIATION

When a function y = f(x) is unknown but its values are given at some points like (x0 , y0 ), (x1, y1 ),

.......... (x n , yn ) or in form of a table, then we can differentiate using numerical differentiation.

Sometimes it is difficult to differentiate a composite or complicated function which can be done easily
in less time and less number of steps by numerical differentiation.

We use following methods for numerical differentiation.

(i) Method based on finite difference operators

(ii) Method based on Interpolation


(i) Method based on finite difference operators

forward difference Interpolation formula is


2 3
Pn (x) = y0 + p 0 + [ p(p y0 + [ p(p 1) (p y0 + ....................

where p = (x - x0)/h

backward difference Interpolation formula is


2 3
Pn (x) = yn + p yn + [ p(p + 1)/2! ] yn + [ p(p + 1) (p + 2)/3! ] yn
n
+ ...................... + [ p(p + 1) (p+ 2).......(p +n - 1)/n! ] yn

where p = (x - xn)/h

Using forward difference the formula for numerical differentiation is


2 3
y x0 ) 0 - y0 /2 + y0 /3 + ..................... ]

x0) = (1/h2 2
y0 - 3
y0 + (11/12) 4
y0 ............................. ]

Using backward difference the formula for numerical differentiation is


2 3
x n)= (1/h) [ yn + yn /2 + yn /3 + .....................]

x n)= (1/ h2) [ 2


yn + 3
yn + (11/12) 4
yn................................ ]

If we consider the first term only the formula becomes

x0 0 ] = (y1 - y0 )/ h

x0) = (1/h2 2
y 0 ] = ( y1 - y0 )/ h2

= [ (y2 - y1 )-(y1 - y0 ) ]/ h2 = [ y2 - 2y1 + y0 ] / h2

12. Using following data find the first and second derivative of y at x=0

x 0 10 20 30 40

y 7 18 32 48 85

Solution

Here x0 = 0, x1 = 10, x2 = 20, x3 = 30, x4 = 40


Forward difference table

2 3 4
x y y

0 7

11

10 18 03

14 02

20 32 05 10

19 12

30 51 17

36

40 87

Here x0 = 0, y0 = 7, h= x1 - x0 = 10-0 = 10
2
0 y0 =3 ,
4
3
y0 y0 =10

p = (x - x0)/h = (4 - 0)/10 = 0.4


2 3 4
x0 0 - y0 /2 + y0 /3 - y0 /4 + ..................... ]

=0.1 [ 11 3/2 + 2/3 10/4 ] = 0.7666

x0) = (1/h2 2
y0 - 3
y0 + (11/12) 4
y0 ............................. ]

= (1/100) [ 3 - 2 + (11/12) 10 ] = 0.10166

(ii) Method based on Interpolation

Linear Interpolation

Quadratic Interpolation

x0) = ( -3y0 + 4 y1 y2 ) /(2h)

x1) = (y2 - y0 ) /(2h)


x2) = ( y0 - 4 y1 + 3 y2 ) /(2h)

The second derivative is constant i.e. same at all points because of quadratic
interpolation and the interpolating polynomial is of degree two. Hence we must have

(x0) = ( y0 -2 y1 + y2 ) /(2h)

(x1) = ( y0 -2 y1 + y2 ) /(2h)

(x2) = ( y0 -2 y1 + y2 ) /(2h)

Problems

13. Using following data find the value of first and second derivatives of y at x=30

x 10 30 50

y 42 64 88

Solution

Here x0 = 10, x1 = 30, x2 = 50, h= x1 - x0 = 30 - 10 = 20

y0 = 42, y1 = 64, y2 = 88

Linear Interpolation

Quadratic Interpolation

x0) = ( -3y0 + 4 y1 y2 ) /(2h) = [ -3(42) + 4 (64) 88 ] /40 = 1.05

x1) = (y2 - y0 ) /(2h) = (88 - 42 ) / 40 = 1.15

x2) = ( y0 - 4 y1 + 3 y2 ) /(2h) = ( 42 - 256 + 264 ) / 40 = 1.25

x0) = ( y0 -2 y1 + y2 ) /(2h) = ( 42 - 128 + 88 ) / 40 = 0.05

14. Using following data find the value of first and second derivatives of y at x=12

x 0 10 20 30 40

y 7 18 32 48 85
Solution

Here x0 = 0, x1 = 10, x2 = 20, x3 = 30, x4 = 40,

Forward difference table

2 3 4
x y y

0 7

11

10 18 03

14 02

20 32 05 10

19 12

30 51 17

36

40 87

Here x0 = 0, y0 = 7, h= x1 - x0 = 10-0 = 10
2
0 y0 =3 ,
4
3
y0 y0 =10

p = (x - x0)/h = (x - 0)/10 = 0.1x


2 3
Pn (x) = y0 + p 0 + [ p(p y0 + [ p(p 1) (p y0
4
+ [ p(p 1) (p 2)(p- y0

= 7 + 0.1x (11) + [0.1x(0.1x - 1)/2! ] (3) + [0.1x(0.1x - 1) (0.1x - 2)/3! ] (2)

+ [0.1x(0.1x - 1) (0.1x - 2) (0.1x - 3)/4! ] (10)

= 7 + 1.1x + (0.01x2 - 0.1x)1.5 + (0.001x3 - 0.03x2 +0. 2x)/3

+ 0.416 ( 0.0001x4 - 0.006x3 +0. 11x2 -0.6x)

y= Pn (x) = 0.0000416 x4 - 0.0022 x3 +0.05x2 + 1.26 x +7 ............................ (1)

Differentiating (1) w.r. to x we get


3
y - 0.0066 x2 +0.1 x + 1.26 ................................................... (2)

1.7971392 at x =12
Differentiating (2) w.r. to x we get
2
- 0.0132 x +0.1

= 0.0134848 at x =12

NUMERICAL INTEGRATION

Consider the integral I =

Where integrand f(x) is a given function and a, b are known which are end points of the interval [a, b]

Either f(x) is given or a table of values of f(x) are given.

Let us divide the interval [a, b] into n number of equal subintervals so that length of each subinterval

is h = (b a)/n

The end points of subintervals are a=x0, x1, x2, x3, ............... , xn = b

Trapezoidal Rule of integration

Let us approximate integrand f by a line segment in each subinterval. Then coordinate of end points
of subintervals are (x0, y 0), ( x1, y1 ) , (x2, y2), ............. ,( xn , yn ). Then from x=a to x=b the area under
curve of y = f(x) is approximately equal to sum of the areas of n trapezoids of each n subintervals.

So the integral I = = (h/2)[ y 0 + y1 ] +(h/2)[ y 1 + y2 ] +(h/2)[ y 2 + y3 ]

+ .................. +(h/2)[ y n-1 + yn ]

= (h/2)[ y 0 + y1 + y 1 + y2 + y 2 + y3 + .................. + y n-1 + yn ]

= (h/2)[ y 0 + yn + 2(y1 + y2 + y3 + .................. + y n-1 ) ]

Which is called trapezoidal rule.

The error in trapezoidal rule is

Simpsons rule of Numerical integration (Simpsons 1/3rd rule)

Consider the integral I =

Where integrand f(x) is a given function and a, b are known which are end points of the interval [a, b]

Either f(x) is given or a table of values of f(x) are given.


Let us approximate integrand f by a line segment in each subinterval. Then coordinate of end points
of subintervals are (x0, y 0), ( x1, y1 ) , (x2, y2), ............. ,( xn , yn ).

We are taking two strips at a time Instead of taking one strip as in trapezoidal rule. For this reason the
number of intervals in Simpsons rule of Numerical integration must be even.

The length of each subinterval is h = (b a)/(2m)

The formula is

I= = (h/3) [ y 0 + y2m + 4(y1 + y3 + ............ + y 2m-1 ) + 2( y2 + y4 + .......... + y 2m-2) ]

The error in Simpson 1/3rd rule is b a 4 v


()
h f
180

Simpsons rule of Numerical integration (Simpsons 3/8th rule)

Consider the integral I =

Where integrand f(x) is a given function and a, b are known which are end points of the interval [a, b]

Either f(x) is given or a table of values of f(x) are given.

We are taking three strips at a time Instead of taking one strip as in trapezoidal rule. For this reason
the number of intervals in Simpsons 3/8th rule of Numerical integration must be multiple of 3.

The length of each subinterval is h = (b a)/(3m)

The formula is

I= = (3h/8) [ y 0 + y3m + 3(y1 + y2 + y4 + y5 + ....... + y 3m - 1 ) + 2( y3 + y6 + ....... + y 3m 3 ) ]

The error in Simpson 1/3rd rule is

15. Using Trapezoidal and Simpsons rule evaluate the following integral with number of subintervals n =6

Solution:

Here integrand y = f(x) = exp(-x2)

a=0, b=6, h= (b-a)/n= (6-0)/6=1


x 0 1 2 3 4 5 6
Y= 1 e-1 e- 4 e- 9 e- 16 e- 25 e- 36
exp(-x2)

y0 y1 y2 y3 y4 Y5 y6

(i) Using Trapezoidal rule

I = (h/2)[ y 0 + yn + 2(y1 + y2 + y3 + .................. + y n-1 ) ]

= (1/2)[ y 0 + y6 + 2(y1 + y2 + y3 +y4+ y 5 ) ]

= 0.5 [ 1+ e- 36 + 2(e-1 + e- 4+ e- 9+ e- 16 + e- 25) ]

(ii) Using Simpsons rule

I = (h/3) [ y 0 + y2m + 4(y1 + y3 + ............ + y 2m-1 ) + 2( y2 + y4 + ............+


y 2m-2) ]

= (h/3) [ y 0 + y6 + 4(y1 + y3 + y5 ) + 2( y2 + y4 ) ]

= (1/3) [ 1+ e- 36 + 4 (e-1 + e- 9+ e- 25) + 2(e- 4 + e- 16 ) ]

(iii) Using Simpsons 3/8th rule

I = (3h/8) [ y 0 + y3m + 3(y1 + y2 + y4 + y5 + ....... + y 3m - 1 ) + 2( y3 + y6 +


....... + y 3m 3 ) ]

= (3h/8) [ y 0 + y6 + 3(y1 + y2 + y4 + y5 ) + 2( y3 ) ]

= (3/8) [ 1+ e- 36 + 3 (e-1 + e- 4 + e- 16 + e- 25) + 2(e- 9 ) ]

16. Using Trapezoidal and Simpsons rule evaluate the following integral with number of subintervals n =8

and compare the result

Solution:
Here integrand y = f(x) = ( 4 + x2)-1

a=0, b= 0.8 , h= (b-a)/n= (0.8-0)/8= 0.1

x 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8

Y= 1/4 1/4.01 1/4.04 1/4.09 1/4.16 1/4.25 1/4.36 1/4.49 1/4.64

( 4 + x2)-1

y0 y1 y2 y3 y4 Y5 y6 Y7 y8

(i) Using Trapezoidal rule

I = (h/2)[ y 0 + yn + 2(y1 + y2 + y3 + .................. + y n-1 ) ]

= (0.1/2)[ y 0 + y8 + 2(y1 + y2 + y3 +y4+ y 5 + y6+ y 7) ]

= 0.05 [ 0.25+ 1/4.64+ 2(1/4.01+ 1/4.04+ 1/4.09+1/4.16+ 1/4.25+ 1/4.36+1/4.49 ) ]

(ii) Using Simpsons rule

I = (h/3) [ y 0 + y2m + 4(y1 + y3 + ............ + y 2m-1 ) + 2( y2 + y4 + ............+


y 2m-2) ]

= (h/3) [ y 0 + y8 + 4(y1 + y3 + y5 + y7) + 2( y2 + y4 + y6 ) ]

= (0.1/3) [0.25+ 1/4.64+ 4(1/4.01+ 1/4.09+ 1/4.25+ 1/4.49)

+2(1/4.04+1/4.16+ 1/4.36) ]

By direct integration we get

=10.900704743176

Comparing the result we get error in Trapezoidal and Simpsons rule.


17. Using Trapezoidal and Simpsons rule evaluate the following integral with number of subintervals n =6

I=

Solution:

Here integrand y = f(x) =

a=0, b= 0.6 , h= (b-a)/n = (0.6-0)/6 = 0.1

x 0 0.1 0.2 0.3 0.4 0.5 0.6

Y= 1

=0.953462 =0.912871 =0.877058 =0.845154 =0.816496 =0.790569

y0 y1 y2 y3 y4 Y5 y6

(i) Using Trapezoidal rule

I = (h/2)[ y 0 + yn + 2(y1 + y2 + y3 + .................. + y n-1 ) ]

= (0.1/2)[ y 0 + y6 + 2(y1 + y2 + y3 +y4+ y 5 ) ]

= 0.05 [ 1+ 0.790569+ 2(0.953462 + 0.912871 + 0.877058+0.845154+0.816496 ) ]

(ii) Using Simpsons rule

I = (h/3) [ y 0 + y2m + 4(y1 + y3 + ............ + y 2m-1 ) + 2( y2 + y4 + ............+


y 2m-2) ]

= (h/3) [ y 0 + y6 + 4(y1 + y3 + y5 ) + 2( y2 + y4 ) ]

= (0.1/3) [ 1+ 0.790569+ 4(0.953462 + 0.877058+0.816496)+2(0.912871 + 0.845154 )]

You might also like