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

Some Important Methods With Example

The document discusses numerical methods for solving equations. It introduces the fixed point iteration method, Newton-Raphson method, and secant method for finding approximate solutions of equations. Examples are provided to illustrate each method. Interpolation is also discussed, along with Newton's forward difference interpolation formula. Problems are given to apply these numerical methods and find interpolated values.

Uploaded by

Mayur Charadva
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
197 views

Some Important Methods With Example

The document discusses numerical methods for solving equations. It introduces the fixed point iteration method, Newton-Raphson method, and secant method for finding approximate solutions of equations. Examples are provided to illustrate each method. Interpolation is also discussed, along with Newton's forward difference interpolation formula. Problems are given to apply these numerical methods and find interpolated values.

Uploaded by

Mayur Charadva
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

B.

Tech 4th Semester MATHEMATICS-IV

UNIT-1

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 π = 3.14159 is approximated as 3.141 for chopping (deleting all decimal)

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΄(x) 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΄(x) and h(x)
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 h΄(x) 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΄(x) 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) / f΄(xn)] 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) / f΄(x0)] = 2- f(2)/ f΄(2) = 3.09900


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

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

x4= x3 - [f(x3) / f΄(x3)] = 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

x1  x0  f ( x1 ) 1  0 f (1) 2.178


x2  x1  1  1  0.31465
f ( x1 )  f ( x0 ) f (1)  f (0)  3.178

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

x3  x 2 
x2  x1  f ( x2 )  0.31465 0.31465 1 f (0.31465)  0.44672
f ( x2 )  f ( x1 ) f (0.31465)  f (1)

 x3  x 2  f ( x 3 )
x 4  x3   0.64748
f ( x3 )  f ( x 2 )

 x 4  x3  f ( x 4 )
x5  x 4   0.44545
f ( x 4 )  f ( x3 )

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) / f΄(x0)] = 1.5 - f(1.5)/ f΄(1.5) = 1.78541


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

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

x4= x3 - [f(x3) / f΄(x3)] = 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 Δ yn = yn + 1 - yn

Backward difference operator  yn = yn - yn - 1

Central difference operator δyi = yi + 1/2 - yi – ½

Shift Operator E yi = yi+1

Newton’s Forward difference Interpolation formula

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

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

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

Δ2 yn = Δ yn + 1 - Δ yn is called the second Forward difference

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

Newton’s Forward difference Interpolation formula is

Pn (x) = y0 + p Δ y0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0

+ ...................... + [ p(p – 1) (p – 2).......(p-n-1)/n! ] Δ ny0

Where p = (x - x0)/h
Problems

5. Using following data find the Newton’s 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
Newton’s forward difference Interpolation.

Forward difference table

x y Δy Δ2 y Δ3 y Δ4 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

Δ y0 = 11 , Δ2 y0 =3 ,

Δ3 y0 = 2, Δ4 y0 =10

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

Pn (x) = y0 + p Δ y0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0

+ [ p(p – 1) (p – 2)(p-3)/4! ] Δ 4y0


= 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 Newton’s 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. Using following data find the Newton’s 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
Newton’s forward difference Interpolation.

Here x0 = 20, y0 = 3, h= x1 - x0 = 35 - 20 = 15

Δ y0 = 8 , Δ2 y0 = 5 ,

Δ3 y0 = 8, Δ4 y0 = 1

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


Forward difference table

x y Δy Δ2 y Δ3 y Δ4 y

20 3

35 11 05

13 08

50 24 13 01

26 9

65 50 22

48

80 98

Pn (x) = y0 + p Δ y0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0

+ [ p(p – 1) (p – 2)(p-3)/4! ] Δ 4y0

= 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 Newton’s 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)]


Newton’s 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.  y1 = y 1 - y0 ,  y2 = y 2 - y1 and so on.

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

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

Newton’s backward difference Interpolation formula is

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

+ ...................... + [ p(p + 1) (p+ 2).......(p +n - 1)/n! ]  nyn

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 Newton’s Backward difference Interpolation.

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

 yn= 36 ,  2yn = 17 ,

 3yn= 12,  4yn=10

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


Backward difference table

x y Δy Δ2 y Δ3 y Δ4 y

0 7

11

10 18 03

14 02

20 32 05 10

19 12

30 51 17

36

40 87

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

+ [ p(p + 1) (p+ 2)(p +3)/4! ]  4yn

= 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

y x Δy Δ2 y Δ3 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

x0 = 2.718, Δ x0 = 1.763 , Δ2 x0 = 1.143 ,

Δ3 x0 = 0.743

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

Newton’s Forward difference Interpolation formula is

Pn (y) = x0 + p Δx0 + [ p(p – 1)/2! ] Δ 2x0 + [ p(p – 1) (p – 2)/3! ] Δ 3x0

= 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 l0 
x  x2 x  x1  , x  x2 x  x0  x  x1 x  x0 
l1  and l 2 
x0  x2 x0  x1  x1  x2 x1  x0  x2  x1 x2  x0 

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 - x 0 = 1 ≠ x2 - x1 = 4

The given data is not equispaced.

x  x2 x  x1  x  5x  1 x 2  6 x  5
l0   
x0  x2 x0  x1  0  50  1 5

l1 
x  x2 x  x0 

x  5x  0  x 2  5 x 
x1  x2 x1  x0  1  51  0  4
x  x1 x  x0  x  1x  0 x 2  x 
and l 2   
x2  x1 x2  x0  5  15  0 20

y  l0 y0  l1 y1  l 2 y 2 
x 2
 6x  5 
15 

x 2  5x 
48 

x2  x
85

5  4 20
  4.75x 2  37.75x  15

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 
x  xn ................x  x2 x  x0 
l1 
x1  xn ................x1  x2 x1  x0 
x  xn ...................x  x1 x  x0 
l2 
x2  xn .................x2  x1 x2  x0 
.........
...........
x  xn1 ...................x  x1 x  x0 
and l n 
xn  xn1 .................x2  x1 x2  x0 

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 - x 0 = 1 ≠ x2 - x1 = 6

The given data is not equispaced.

x  x3 x  x2 x  x1  8  98  7 8  1   7  1


l0  
x0  x3 x0  x2 x0  x1  0  90  7 0  1  63 9
x  x3 x  x2 x  x0  8  98  7 8  0   8  1
l1  
x1  x3 x1  x2 x1  x0  1  91  7 1  0 48 6
x  x3 x  x1 x  x0  8  98  18  0   56  2
l2  
x2  x3 x2  x1 x2  x0  7  97  17  0  84 3
x  x2 x  x1 x  x0  8  7 8  18  0  56  7
and l3  
x3  x2 x3  x1 x3  x0  9  7 9  19  0 144 18

y  l 0 y 0  l1 y1  l 2 y 2  l3 y3 
1
18  1 42  2 57  7 90
9 6 3 18
 2  7  38  35  82

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

f [ x 1 , x 2 ] - f [ x 0 , x1 ]
f [ x 0 , x1 , x 2 ] 
x 2  x0
f [ x 2 , x3 ] - f [ x1 , x 2 ]
f [ x1 , x 2 , x 3 ] 
x 3  x1

The third divided difference is

f [ x 1 , x 2 , x 3 ] - f [ x 0 , x1 , x 2 ]
f [ x 0 , x1 , x 2 , x 3 ] 
x 3  x0

The nth divided difference is

f [ x 1 , x 2 , x 3 ,......., x n ] - f [ x 0 , x1 , x 2 ,......., x n -1 ]
f [ x 0 , x1 , x 2 , x 3 ,......., x n ] 
x n  x0

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. Using following data find the Newton’s divided difference interpolating polynomial and also
find the value of y at x= 15

x 0 6 20 45

y 30 48 88 238
Newton’s divided 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

Newton’s forward difference Interpolation formula is

Pn (x) = y0 + p Δy0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0 + ....................

where p = (x - x0)/h

Newton’s backward difference Interpolation formula is

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

+ ...................... + [ p(p + 1) (p+ 2).......(p +n - 1)/n! ]  nyn

where p = (x - xn)/h

Using forward difference the formula for numerical differentiation is

y΄ (x0) = (1/h) [ Δy0 - Δ 2y0 /2 + Δ 3y0 /3 + .................... ]

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

Using backward difference the formula for numerical differentiation is

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

y΄΄ (x n)= (1/ h2) [  2yn +  3yn + (11/12)  4yn ................ ]

If we consider the first term only the formula becomes

y΄ (x0) = (1/h) [ Δy0 ] = (y1 - y0 )/ h

y΄΄ (x0) = (1/h2) [ Δ 2y0 ] = (Δ 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

x y Δy Δ2 y Δ3 y Δ4 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

Δ y0 = 11 , Δ2 y0 =3 ,

Δ3 y0 = 2, Δ4 y0 =10

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

y΄ (x0) = (1/h) [ Δy0 - Δ 2y0 /2 + Δ 3y0 /3 - Δ 4y0 /4 + .................... ]

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

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

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

(ii) Method based on Interpolation

Linear Interpolation

y( x 1 ) - y ( x 0 ) y  y0
y ( x 0 )   1
x 1  x0 x 1  x0

Quadratic Interpolation

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

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


y΄ (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

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

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

y΄΄ (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

y( x 1 ) - y( x 0 ) y  y0 64  42
y ( x 0 )   1   1.1
x 1  x0 x 1  x0 30  10

Quadratic Interpolation

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

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

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

y΄΄(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

x y Δy Δ2 y Δ3 y Δ4 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

Δ y0 = 11 , Δ2 y0 =3 ,

Δ3 y0 = 2, Δ4 y0 =10

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

Pn (x) = y0 + p Δ y0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0

+ [ p(p – 1) (p – 2)(p-3)/4! ] Δ 4y0

= 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

y΄= 0.0001664 x3 - 0.0066 x2 +0.1 x + 1.26 .................................... (2)

y΄(12) = 1.7971392 at x =12


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

y΄΄= 0.0004992 x2 - 0.0132 x +0.1

y΄΄(12) = 0.0134848 at x =12

NUMERICAL INTEGRATION

Consider the integral I =  f ( x) dx


a

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 =  f ( x) dx = (h/2)[ y


a
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.

ba 2
The error in trapezoidal rule is  h f ( ) where a < θ <b
12

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

Consider the integral I =  f ( x) dx


a

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=  f ( x) dx = (h/3) [ y
a
0 + y2m + 4(y1 + y3 + ............ + y 2m-1 ) + 2( y2 + y4 + .......... + y 2m-2) ]

ba 4 v
The error in Simpson 1/3rd rule is  h f  ( ) where a < θ <b
180

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

Consider the integral I =  f ( x) dx


a

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=  f ( x) dx = (3h/8) [ y
a
0 + y3m + 3(y1 + y2 + y4 + y5 + ....... + y 3m - 1 ) + 2( y3 + y6 + ....... + y 3m – 3 ) ]

ba 4 v
The error in Simpson 1/3rd rule is  h f  ( ) where a < θ <b
80

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

e
( x2 )
dx
0

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

0 .8
dx
4 x
0
2

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

 
0.8
1 x
0.8
dx
0 4  x 2   2 tan
1
 0.5 tan 1 0.4  tan 1 0  0.5 tan 1 0.4
2  0

=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

0 .6
dx
I= 0 1 x

Solution:

1
Here integrand y = f(x) =
1 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 1 1 1 1 1 1
1 .1 1 .2 1 .3 1 .4 1 .5 1 .6
1
1 x =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 )]


(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 ) ]

= (0.3/8) [ 1+ 0.790569+

3(0.953462 + 0.912871 + 0.845154 +0.816496)+2(0.877058 )]

UNIT-II

Linear System: Solution by iteration

Gauss-Seidal iteration method

This is an iterative method used to find approximate solution of a system of linear equations.

Some times in iterative method convergence is faster where matrices have large diagonal
elements. In this case Gauss elimination method require more number of steps and more row
operations. Also sometimes a system has many zero coefficients which require more space to
store zeros for example 30 zeros after or before decimal point. In such cases Gauss-Seidal
iteration method is very useful to overcome these difficulties and find approximate solution of
a system of linear equations.

Procedure:

We shall find a solution x of the system of equations Ax=b with given initial guess x0.

A is an n x n matrix with non-zero diagonal elements

Step-I Rewrite the given equations in such a way that in first equation coefficient of x1 is
maximum, in second equation coefficient of x2 is maximum, in third equation coefficient of
x3 is maximum and so on.

Step-II From first equation write x1 in terms of other variables x2 , x3 , x4 etc.

From the second equation write x2 in terms of other variables x1 , x3 , x4 etc.

From third equation write x3 in terms of other variables x1 , x2 , x4 etc.

And so on write all equations in this form.

Step-III

If initial guess is given we take that value otherwise we assume X = (1, 1, 1) as initial guess.

Put x2 = 1, x3 = 1 in first equation to get x1 ........................................(1)


Put x3 = 1 and put value of x1 obtained in (1) in the second equation to get value of x2. ...........(2)

Put values of x1 , x2 obtained in (1) and (2) in the third equation to get value of x3.

Step-IV

We repeat this procedure up to desired accuracy and up to desired number of steps.

18. Solve following linear equations using Gauss-Seidal iteration method starting from 1, 1, 1

x1 + x2 + 2 x3 = 8

2x1 + 3 x2 + x3 = 12

5x1 + x2 + x3 = 15

Solution Rewrite the given equations so that each equation for the variable that has coefficient largest we get

5x1 + x2 + x3 = 15 ..........................................................(1)

2x1 + 3 x2 + x3 = 12 ..........................................................(2)

x1 + x2 + 2 x3 = 10 ..........................................................(3)

From equation (1) we get x1 in terms of other variables x2 and x3 as

5x1 = 1 5 - x2 - x3

x1 = (1 5 - x2 - x3 )/5 = 3 – 0.2 x2 – 0.2 x3 ..........................................................(4)

From equation (2) we get x2 in terms of other variables x1 and x3 as

2x1 + 3 x2 + x3 = 12

x2 = 4 - (2x1 + x3 )/3 ..........................................................(5)

From equation (3) we get x3 in terms of other variables x1 and x2 as

x1 + x 2 + 2 x3 =10

x3 = 5 - 0.5 x1 - 0.5 x2 ..........................................................(6)

Step-1

Putting x2 = 1, x3 = 1 in equation (4) we get

x1 = 3 – 0.2 x2 – 0.2 x3 = 3 – 0.2 – 0.2 = 2.6

Putting x1 = 2.6, x3 = 1 in equation (5) we get

x2 = 4 - (2x1 + x3 )/3 = 4 – (5.2+1)/3 = 1.93333


Putting x2 = 1.93333, x1 = 2.6 in equation (6) we get

x3 = 5 - 0.5 x1 - 0.5 x2 = 5 - 0.5 (2.6) - 0.5 (1.93333) = 2.73333

Step-2

Putting x2 = 1.93333, x3 = 2.73333 in equation (4) we get

x1 = 3 – 0.2 x2 – 0.2 x3 = 3 – 0.2(1.93333) – 0.2 (2.73333 )= 2.066666

Putting x1 = 2.06666, x3 = 2.73333 in equation (5) we get

x2 = 4 - (2x1 + x3 )/3 = 4 – (4.13333 + 2.73333 )/3 = 1.71111

Putting x2 = 1.71111, x1 = 2.066666 in equation (6) we get

x3 = 5 - 0.5 x1 - 0.5 x2 = 5 - 0.5 ( 2.066666 ) - 0.5 (1.71111) = 3 .11111

Step-3

Putting x2 = 1.71111, x3 = 3 .11111 in equation (4) we get

x1 = 3 – 0.2 x2 – 0.2 x3 = 3 – 0.2(1.71111) – 0.2 (3 .11111 )= 2.035555

Putting x1 = 2.035555 , x3 = 3 .11111in equation (5) we get

x2 = 4 - (2x1 + x3 )/3 = 4 – ( 4.07111 + 3 .11111)/3 = 1.605925

Putting x2 = 1.605925, x1 = 2.035555 in equation (6) we get

x3 = 5 - 0.5 x1 - 0.5 x2 = 5 - 0.5 (2.035555) - 0.5 (1.605925) = 3 .17926

Step-4

Putting x2 = 1.605925, x3 = 3 .17926 in equation (4) we get

x1 = 3 – 0.2 x2 – 0.2 x3 = 3 – 0.2(1.605925) – 0.2 (3 .17926)= 2.042962

Putting x1 = 2.042962, x3 = 3 .17926 in equation (5) we get

x2 = 4 - (2x1 + x3 )/3 = 4 – ( 4.08592 + 3 .17926)/3 = 1.57827

Putting x2 = 1.57827, x1 = 2.042962 in equation (6) we get

x3 = 5 - 0.5 x1 - 0.5 x2 = 5 - 0.5 (2.042962) - 0.5 (1.57827) = 3 .18938


Eigen values and Eigen vectors by Power method

This is an iterative method used to find approximate value of Eigen values and Eigen vectors
of an n x n non-singular matrix A.

Procedure:

We start with any non-zero vector x0 of n components and compute followings.

x1 = Ax0

x2 = A x1

x3 = A x2

..........................

..........................

..........................

xn = A xn-1

For any n x n non-singular matrix A we can apply this method and we get a dominant

eigen value λ such that absolute value of this eigen value λ is greater than that of other
eigen values.

Theorem: Let A be an n x n real symmetric matrix. Let x ≠ 0 be any real vector with n
components. Let y=Ax, m0 = xT x, m 1=xTy, m2=yTy

Then the ratio r = m1 / m0 called Rayleigh quotient is an approximate eigen value λ of A.

m2
Assuming r = λ - ϵ we have I ϵ I   r2
m0

where ϵ is the error of ratio r = m1 / m0

6 3 
19 . Find the eigen values and eigen vectors of the matrix   by Power method
3 2
taking x0= [ 1 1 ]T

6 3  T
Solution Let A =   . Given x0= [ 1 1 ]
 3 2 

x1 = Ax0

6 3 1 9   1 
=     =  = 9 
3 2 1 5  5 / 9
 1 
Dominated eigen value is 9 and and eigen vector is  
5 / 9

x2 = A x1

6 3  1  7.666  1 
= 3 2 5 / 9 =  4.111 = 7.666 0.536
      

 1 
Dominated eigen value is 7.666 and and eigen vector is  
0.536

x3 = A x2

6 3  1  7.608  1 
= 3 2 0.536 = 4.072 = 7.608 0.535
      

 1 
Dominated eigen value is 7.608 and and eigen vector is  
0.535

6 3 1 
 
20 . Find the eigen values and eigen vectors of the matrix 3 2 0 by Power method
 
1 4 5 
taking x0= [ 1 1 1 ]T

6 3 1 
 
Solution Let A = 3 2 0 . Given x0= [ 1 1 1]T
 
1 4 5 

x1 = Ax0

6 3 1  1 10 1


 
= 3 2 0  1 =
 5   100.5
   
1 4 5  1 10  1 

 1 
 
Dominated eigen value is 10 and and eigen vector is  0 .5 
 1 

x2 = A x1

6 3 1   1  8.5  1 
    4   8.50.4705
=  3 2 0   0 .5  =    
1 4 5   1   8   0.9411
 1 

Dominated eigen value is 8.5 and and eigen vector is 0.4705

 
 0.9411

x3 = A x2

6 3 1   1  8.3526  1 
 
= 3 2 0 0.4705 =
  3.941   8.35260.4718
      
1 4 5   0.9411 7.5875 0.9084

 1 

Dominated eigen value is 8.3526 and and eigen vector is 0.4718

 
0.9084
Unit III: Solution of IVP by Euler’s method, Heun’s method and Runge-Kutta fourth order
method. Basic concept of optimization, Linear programming, simplex method, degeneracy,
and Big-M method.

Numerical Solution of Differential Equation:


Introduction:
We consider the first order differential equation

y   f ( x, y )

With the initial condition

y (xo) = y0

The sufficient conditions for the existence of unique solution on the interval [x0 , b] are the
well-known Lipschitz conditions. However in ‘Numerical Analysis’, one finds values of y at
successive steps, x = x1 , x2 , … , xn with spacing h. There are many numerical methods
available to find solution of IVP, such as : Picards method, Euler’s method, Taylor’ series
method, Runge-Kutta method etc.

In the present section we will solve the ode

y   f ( x, y ), y ( x 0 )  y 0 in the interval I  ( x0 , x n ) (1)

using a numerical scheme applied to discrete node xn = x0 + nh, where h is the step-size by
Euler’s method, Heun’s method and Runge-Kutta method.

 In Euler’s method we use the slope evaluated at the current level ( x n , y n ) and use
that value as an approximation of the slope throughout the interval ( x n , x n 1 ) .
 Hune’ method samples the slope at beginning and at the end and uses the average
as the final approximation of the slope. It is also known as Runge-kutta method of
order-2.
 Runge-kutta method of order-4 improve on Euler’ s method looking at the slope at
multiple points.

The necessary formula for solution of (1) by Euler’ s method is:

y j 1  y j  hf ( x j , y j ) , j = 0, 1, 2, … n - 1.

The necessary formula for solution of (1) by Hune’ s method is:

1
y j 1  y j  (k1  k 2 ) , j = 0, 1, 2, … n - 1.
2

Where k1  hf ( x j , y j ), k 2  hf ( x j  h, y j  k1 )

The necessary formula for solution of (1) by Runge – Kutta method of order-4 is:

1
y j 1  y j  (k1  2k 2  2k 3  k 4 ) , j = 0, 1, 2, …, n – 1.
6

Where k1  hf ( x j , y j )

1 1
k 2  hf ( x j  h , y j  k1 )
2 2
1 1
k 3  hf ( x j  h, y j  k 2 )
2 2
k 4  hf ( x j  h, y j  k 3 )

Example : Use the Euler method to solve numerically the initial value problem

u   2tu 2 , u (0)  1

With h = 0.2 on the interval [0, 1]. Compute u (1.0)

We have
2
u j 1  u j  2 ht j u j , j  0,1,2,3,4. [Here x and y are replaced by t and u

respectively]

With h=0.2. The initial condition gives u0=1

For j = 0: t0 = 0, u0 = 1

u (0.2) = u1 = u0 – 2ht0u02 = 1.0.

For j = 1: t1 = 0.2, u1 = 1

u (0.4) = u2= u1 – 2ht1u12 = 0.92.

For j = 2: t2 = 0.4, u2 = 0.92

u (0.6) = u3 = u2-2ht2u22 = 0.78458.

For j = 3: t3 = 0.6, u3 = 0.78458

u(0.8) = u4 = 0.63684.

Similarly, we get

u(1.0) = u5 = 0.50706.

Note: In the similar way IVP can be solved by Heun’s method and Runge-Kutta fourth order
method.

Optimization
Optimization is the means by which scarce resources can be utilized in an efficient manner
so as to maximize the profit or minimize the loss.

Basic components of an optimization problem:


An objective function expresses the main aim of the model which is either to be minimized
or maximized. For example, in a manufacturing process, the aim may be to maximize the
profit or minimize the cost. In comparing the data prescribed by a user-defined model with
the observed data, the aim is minimizing the total deviation of the predictions based on the
model from the observed data. In designing a bridge, the goal is to maximize the strength and
minimize size.

You might also like