+ All Categories
Home > Documents > 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In -Dimension) Numerical...

1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In -Dimension) Numerical...

Date post: 13-Dec-2015
Category:
Upload: violet-nelson
View: 222 times
Download: 1 times
Share this document with a friend
Popular Tags:
120
1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In -Dimension) Numerical Integration Numerical Solution of Differential Equations
Transcript
Page 1: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

1

CHAPTER 3 NUMERICAL METHODS

Roots of Nonlinear equations

Interpolation (In -Dimension)

Numerical Integration

Numerical Solution of Differential Equations

Page 2: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

2

3.1 Roots of Nonlinear Equations

Let say we want to find the solution of f (x) 0. For example:

These equations can not be solved directly.

0sin2)

,01)

xxb

xea x

We need numerical methods to compute the approximate solutions.

Page 3: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

3

3.1.1 Iteration Methods Let x0 be an initial value that is close to the

solution of f (x) 0. From f (x) 0, another equation is produced such that we can use x0 to compute x.

This step is repeated to obtain values of x2, x3,...This method is called Iteration Method.

We hope that every new xi converges to the solution of f (x) 0.

Page 4: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

4

3.1.2 Fixed Point Iteration First we write f (x) 0 in the form x F (x). Note that F (x) is not unique. For instance,

see the following.

3

1

13

013 )

013)(

3

3

3

3

xx

xx

xxi

xxxfExample 3.1

Page 5: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

5

more.many and

13

13

013 )

3

1

1)3(

13

013 )

2

3

3

2

2

3

3

x

xx

xx

xxiii

xx

xx

xx

xxii

Page 6: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

6

We shall use these forms (x F (x)) in our next example, denoted by

)(13

)

)(3

1 )

)(3

1 )

32

22

1

3

xFx

xxiii

xFx

xii

xFx

xi

Page 7: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

7

We can say that the solution of x F (x) is the intersection of two graphs y x and y F (x).

For example, see the following figure:

Figure 3.1 Fixed Point Iteration

y

xx0 x1 x2 x3

y0 = x1

y1 = x2

y2 = x3

)(xFy xy

Page 8: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

8

1. Start the computation with initial value x0.

2. From y F (x), we have y0 F (x0).

3. Then, from graph y x, we may assume x1 y0.

From here, we have y1 F(x1) and x2 y1.

4. Similarly, we will obtain x3, x4, … and so on.

Solution steps

Page 9: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

9

Conclusion

Fixed point iteration is of the form

)(

),(

),(

),(

1

23

12

01

ii xFx

xFx

xFx

xFx

We hope that the neighborhood denoted by the dashed line converges to the intersection point of the two graphs y x and y F(x).

Page 10: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

10

Example 3.2

Approximation by Fixed Point Iteration

(Based on Example 3.1)

In Example 3.1, we have obtained various forms of x F(x). Now referring to xi1 F(xi), we put subscripts as follows.

Page 11: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

11

The distance between xi1 and xi increases, i.e. xi1 – xi xi – xi1 This iteration fails (since it diverges).

1.185138

1.367163

1.458333

:computecan we(1) From

value.initial thebe 1.5Let

(1) 3

1

3

1)

3

2

1

0

3

1

3

x

x

x

x

xx

xxi i

i

Page 12: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

12

The distance between xi+1 and xi decreases, i.e. xi+1 – xi xi – xi1 This iteration converges (succeeds).

0.347296

0.347296

0.347294

0.347271

0.346992

0.343643

: computecan we(2) From 0.3.Put

(2) 3

1

3

1)

6

5

4

3

2

1

0

212

x

x

x

x

x

x

x

xx

xxii

i

i

Page 13: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

13

We have |xi+1 – xi | | xi – xi-1 |. This shows that this iteration diverges (Iteration fails).

1.915679

1.848431

1.906730

1.855956

: computecan we(3) From

1.9. Take

(3) 1313

)

4

3

2

1

0

212

x

x

x

x

x

x

xx

x

xxii

i

ii

Page 14: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

14

1 1i i i ix x x x

.347296.0x

0

000001.0

1)347296.0(3)347296.0( 3

is 0133 xx

REMARK

An iteration converges if it satisfies

From the convergent iteration, we conclude that one of the solutions of

CHECK :

Page 15: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

15

How to make sure that initial value x0 can give a convergent iteration?

Answer:

We differentiate F(x) to get F ′(x).The iteration converges if

.0)( ofsolution the toclose is )

and ,1)(1or 1)()

0

0'

0'

xfxb

xFxFa

Page 16: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

16

Example 3.3

divergent. is valueinitial with thisiteration theand

satisfiednot is 1)('1 Condition

.125.2)(' have we,5.1For

)('3

1)( i)

: that3.1 Examplein determined have we

,013For

0

010

21

3

1

3

xF

xFx

xxFx

xF

xx

Page 17: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

17

converge.possibly couldit since examined, becan

valueinitial with thisiteration theTherefore,

.1)('1 condition satisfies

that 07.0)(' have we,3.0For

)3(

2)('

3

1)( ii)

0

020

22222

xF

xFx

x

xxF

xxF

Page 18: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

18

diverges. valueinitial with thisiteration theThus,

satisfied.not is 1)('1 Condition

.11.1)(' have we,9.1At

23)('

13)( iii)

0

030

3323

xF

xFxx

xxF

x

xxF

converge.possibly coulditeration thesuch that

1)('1condition thesatisfiesthat

valueinitial thechoosemust We

0

0

xF

x

Conclusion

Page 19: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

19

3.1.3 Newton-Raphson Method Tangent line of f (x) is f ′(x). This is the basic of

Newton-Raphson Method described below.

f (x)

xx0 x1 x2O

f (x0)

f (x1)

f (x2)

Figure 3.2 Newton-Raphson Method

Page 20: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

20

Gradient of the tangent line of f (x) at (x0, f (x0)) is given by f ′(x0). If we continue the tangent line at (x0, f (x0)) to (x1,0), then the gradient of this tangent line can be determined by

Equalizing these two values, we have

.)(0

01

0

xx

xf

(4) .)(

)(or

)(0)(

0'

001

01

00

'

xf

xfxx

xx

xfxf

Page 21: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

21

This means that from the initial value x0, using formula (4), we can compute x1 which is close to the solution of f (x) 0.

Using the same formula, we can compute x2

which is a better approximation to the solution compare to x1.

We can also compute x3 , x4 , … and so on. We hope that our iteration converges to the

solution of f (x) 0.

Page 22: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

22

In general, Newton-Raphson method can be formulated as

.)(

)('1

i

iii xf

xfxx

Page 23: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

23

Example 3.4

i xi f (xi) f ′ (xi)

0 0 -1 -3

1 -0.333333 -0.037037 -2.666667

2 -0.347222 -0.000196 -2.638310

3 -0.347296 -0.000000 -

:formula sRaphson'-Newtonon based tablea Make )

.point starting a as 0 Choose )

.33)(obtain to)( ateDifferenti )

0

2'

iii

xii

xxfxfi

.013)( 3 xxxfSolve

Solution

Page 24: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

24

From the table we conclude that:

* xi converges to the solution of f (x) 0, that is

x - 0.347296.

* Values in column f (xi) go to zero.

(Remark: this shows that we have done a

good approximation)

Page 25: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

25

i xi f (xi) f ′(xi)

0 0.99 -2.999701 -0.0597

1 -49.256248 -119 358.65 -

table.following at theLook

?99.0 choose weifWhat 0 x

fails. methodRaphson -Newton that means This

. )( than zero fromfarer is )(that

table thefrom seecan We

01 xfxf

Page 26: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

26

IMPORTANT!!! Newton-Raphson method fails if the

approximate root of equation, for instance x = x0, close to roots of f ′(x) = 0.

Therefore, we have to make sure that the starting point x0 does not give f ′(x0) close to zero.

The reason is that dividing a number by a value close to zero will give a number with large absolute value.

Page 27: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

27

3.1.4 Secant Method This method is a revision of Newton-Raphson

method as described in the following figure. f (x)

x x0 x1 x2 x3O

f (x0)

f (x1)

f (x2)

f (x3)

Figure 3.3 Secant Method

Page 28: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

28

In this method, we begin with two initial values x0

and x1. The straight line from (x0, f (x0)) to (x1,f (x1)) is continued to the x-axis.

Let x2 be the value where this straight line intersects the x-axis.

By equalizing gradient from (x0, f (x0)) to (x1, f (x1)) and gradient from (x1, f (x1)) to (x2,0), we obtain

Page 29: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

29

Using the same formula, we compute x3, x4, ... and so on.

We hope that xi converges to the solution of f (x) 0.

.)()(

)(or

)()()(0

01

01112

01

01

12

1

xfxf

xxxfxx

xx

xfxf

xx

xf

Page 30: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

30

In general, Secant method can be formulated as

)()(

)(1

11

ii

iiiii xfxf

xxxfxx

Page 31: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

31

i xi f (xi)

0 0 -1

1 1 -3

2 -0.5 0.375

3 -0.333333 -0.037037

4 -0.348315 0.002685

5 -0.347302 0.000016

6 -0.347296 -0.000000

7 -0.347296 -0.000000

.013)( 3 xxxfSolve

Example 3.5

methodSecant of formula on the based tablea Make )

.1 and 0 valuesinitial Choose ) 10

ii

xxi Solution

Page 32: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

32

From the table, notice that:

* Iteration xi converges to x - 0.347296.

* Values in column f (xi) go to zero.

(Remark as in Newton-Raphson method) If f (xi) is farer from zero than f (xi -1), then the

iteration fails. This means that we made a mistake in estimating xi using this iteration.

Page 33: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

33

3.1.5 How to choose initial values?

Besides conditions of the method we use, we may also see sign of f (x) for the tested x.

For instance, see values of f (x) x3 – 3x – 1 used in our previous example.

We can make the following sign table:

Page 34: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

34

x f (x) Sign f (x) Remark

-5 -111 -ve

The sign changes

-4 -53 -ve

-2 -3 -ve *

-1 1 +ve *

0 -1 -ve *

1 -3 -ve *

2 1 +ve *

Page 35: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

35

From the sign table, we know that the solution of f (x) 0 is clearly in between

x -2 and x -1,

x -1 and x 0,

and x 1 and x 2.

If we use Secant Method, we may choose the following

x0 -2 and x1 -1,

or x0 -1 and x1 0,

or x0 1 and x1 2.

Page 36: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

36

If we use Newton-Raphson Method, we focus on the first derivative of f (x) x3 – 3x – 1,

i.e. f ′(x0) 3x2 – 3.

We may not choose x0 -1 or x0 1, since this gives f ′(x0) 0.

But, from the sign table, we may choose x0 -2 or x0 0 or x0 2 as long as f ′(x0) is not too close to zero.

If we use Fixed Point Method, we can choose x0 that satisfies

.1)(1or 1)( 0'

0' xFxF

Page 37: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

37

3.2 Interpolation (In -dimension)

The meaning of interpolation in 2-dimension is to define a curve that passes through given data points. As an example, see the following:

Figure 3.4 Points interpolation

x x

x

x

x

Page 38: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

38

3.2.1 Interpolation Polynomial

unique. and exists ,,for

system theofsolution that theimplies This

equations.t independen and

consistent ofnumber )1( of system a build to

of valuesdifferent with ,, 1, ,0 ),,(

points )1( need we,,, find To

s.coeficientunknown are ,, where

,

:polynomial following heConsider t

10

10

10

2210

n

kk

n

n

nn

CCC

n

xnkyx

nCCC

CCC

xCxCxCCy

Page 39: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

39

Given the data points and what is the unique polynomial that passes through the data points?

Solution

Since we are given three different points, then we can only find unique value for three coefficients: C0, C1 and C2. Then, our interpolation polynomial is quadratic:

y = C0 + C1x + C2x2.

Example 3.6

Page 40: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

40

If we substitute the given data points and to the polynomial, we get the following three equations:

2 C0

3 C0 + C1 + C2

3 C0 + 3C1 + 9C2.

This is a system of linear equations. The solution is.

3

1,

3

4,2 210 CCC

Page 41: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

41

Thus, the unique interpolation polynomial that passes through the given data points is

.3

1

3

42 2xxy

Page 42: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

42

Theorem (Interpolation polynomial)

.,,1,0,)(

)(

,

),,(,),,(),,( )1( 1100

nkyxPthat such

nto equal or than less order ofxPpolynomial

unique a produce can wexof value different with

yxyxyxpoints datanGiven

kk

nn

Page 43: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

43

There are many methods to find this unique interpolation polynomial. In this part, we only consider two methods: Lagrange Method and Newton’s Divided Difference Interpolation.

Page 44: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

44

3.2.2 Lagrange Method

.)())(())((

)())(())(()(

where

)()()()(

is Method Lagrangeby built polynomialion Interpolat

).,(, ),,( ),,(

:points data following given the are say weLet

1110

1110

221100

1100

niiiiiii

niii

nn

nn

xxxxxxxxxx

xxxxxxxxxxxL

yxLyxLyxLyxLy

yxyxyx

Page 45: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

45

Given the data points and Apply Lagrange Method to find interpolation polynomial passing through these points.

221100

221100

)()()(

bygiven is polynomialion interpolat Lagrange Then,

(3,3).),(dan (1,3)),( (0,2),),(Let

yxLyxLyxLy

yxyxyx

Example 3.7

Solution

Page 46: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

46

.2

3

2

1)3(

2

1

)3)(10(1

)3)(0(

))((

))(()(

.13

4

3

1)31)((

3

1

)30)(10(

)31)((

))((

))(()(

where

2

2101

201

2

2010

210

xxxx

xx

xxxx

xxxxxL

xxxx

xx

xxxx

xxxxxL

Page 47: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

47

.3

1

3

42

)3(6

1

6

1)3(

2

3

2

1)2(1

3

4

3

1

polynomialion interpolat the

obtain weequation, sLagrange' the to)( ngSubstituti

.6

1

6

11)(

6

1

)13)(03(

)1)(0(

))((

))(()(

2

222

2

1202

102

xx

xxxxxxy

xL

xxxx

xx

xxxx

xxxxxL

i

Page 48: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

48

3.2.3 Newton’s Divided Difference Interpolation

Lagrange method has the following weaknesses:

1) Lagrange Interpolation Polynomial is hard to find if we have many data points.

2) If we want to add data, we have to restart our computation from the beginning.

In this part, we discuss a method that can handle the weaknesses of Lagrange Method, called Newton’s Divided Difference Interpolation. Before that, we first need to produce a table of divided difference.

Page 49: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

49

3.2.3.1 Table of Divided Difference

3.5. Table

in listed formulas by the defined areon so and

three two,one, orders of difference divided The

)).(,(, )),(,( )),(,(

: points following given the are weSuppose

1100 nn xfxxfxxfx

Page 50: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

50

n

nn

xx

xxfxxf

0

110 ],,[],,[

2

211 ],[],[

ii

iiii

xx

xxfxxf

Order Symbol Definition

0 f [xi] f (xi)

1 f [xi , xi +1]

2 f [xi , xi +1 , xi +2]

3 f [xi , xi +1 , xi +2 , xi +3]

n f [x0 , x1 ,…, xn - 1 , xn]

1

1][][

ii

ii

xx

xfxf

3

32121 ],,[],,[

ii

iiiiii

xx

xxxfxxxf

Table 3.5 Orders of Divided Difference

Page 51: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

51

x f (x)

x0 f (x0)

x1 f (x1)

x2 f (x2)

x3 f (x3)

Table 3.6 Divided Difference Formula2 31

10

10

10

)()(

],[

xx

xfxf

xxf

20

2110

210

],[],[

],,[

xx

xxfxxf

xxxf

21

21

21

)()(

],[

xx

xfxf

xxf

30

321210

3210

],,[],,[

],,,[

xx

xxxfxxxf

xxxxf

31

3221

321

],[],[

],,[

xx

xxfxxf

xxxf

32

32

32

)()(

],[

xx

xfxf

xxf

Page 52: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

52

Based on Table 3.5, we can produce table of divided difference as in Table 3.6.

Though Table 3.6 shows an estimation for four data points, a similar way can be used for different number of data points.

Example 3.8

Produce a table of divided difference for the following data points:

and

SolutionTable of divided difference for this data is

Page 53: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

53

2 x

f (x)

1 3

2 0 7/3

4 29/6

4 8 12 65/72

16 17/8

3 -8 21/6

-5

-2 17

31

321

03

4

Page 54: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

54

3.2.3.2 Newton’s Divided Difference Interpolation

].,,,[)())((

],,[))((

],[)(

)()(

as written is polynomialion interpolat difference

divided sNewton' ,difference divided of definition theFrom

10110

21010

100

0

nn xxxfxxxxxx

xxxfxxxx

xxfxx

xfxPy

Page 55: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

55

Example 3.9

Find interpolation polynomial that passes through (0,2), (1,3) dan (3,3) using Newton’s divided difference interpolation.

Solution

Table of divide difference for these three points is

x y

0 2

1

1 3

0

3 3

3

1

21

Page 56: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

56

.3

1

3

42

3

1)1)(0()1)(0(2

],,[))((],[)()()(

2

210101000

bygiven is example for this polynomialion interpolat difference divided sNewton' theThus,

xx

xxx

xxxfxxxxxxfxxxfxPy

Page 57: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

57

REMARKS

.3

)3(3

1)3(

3

42)3(,3 when )

.3

)1(3

1)1(

3

42)1(,1 when )

.2)0(,0 when )

2

2

Pxiii

Pxii

Pxi

Page 58: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

58

3.3 Integral Solution Using Numerical Methods

In this part, we discuss the following numerical integration methods:

1) Rectangular Rule

2) Trapezoidal Rule

3) Simpson’s Rule

Before doing the approximation, we first have to give the number of subintervals that we want to consider and find the length of each subinterval.

Page 59: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

59

3.3.1 Number of subintervals and the length of each subinterval

We suppose that the interval from x a to xb is divided into n number of subintervals, where the length of each subinterval is

If x0 a and xn b, then in general, xi a ih.

.n

abh

Page 60: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

60

The positions of x0, x1, … ,xn are shown in the following figure.

f (x)

x

y

| | | | | | x0 x1 x2 x3 xn

h h

Figure 3.5 Number of subintervals

Page 61: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

61

3.3.2 Rectangular Rule

In this method, we suppose that every subinterval forms a rectangle, where the height of each subinterval is

Areas of all rectangles are computed. Total area of these rectangles is the approximate area

below the curve of the function, which is also the estimation of the integral that we want to determine.

).(2

1),( 1

** iiii xxxxf

Page 62: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

62

Figure 3.6 Rectangular Rule

f (x)

x

y

| | |

x1* x2

* x3*

Page 63: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

63

We have given the length of each subinterval denoted by h.

If the height of the ith rectangle is

then the area of the ith rectangle is Total area of all rectangles

),( *ixf

).( *ixfh

)].()()([

)()()(**

2*

1

**2

*1

n

n

xfxfxfh

xfhxfhxfh

Page 64: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

64

RECTANGULAR RULE

. lssubinterva ofnumber theincrease we

if accurate more be will)( of Estimation

:Note

).(2

1 where 1

*

n

dxxf

xxx

b

a

iii

])()()([)(

**2

*1 n

b

axfxfxfhdxxf

Page 65: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

65

Example 3.10

. 1

0

2

als subintervten usingdxeEstimate x

.747131.0

)471308.7(1.0 table, thefrom Thus,

0.110

01

is lsubinterva

each oflength then the1, and 0Given

1

0

2

dxe

n

abh

ba

x

Solution

Page 66: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

66

i xi xi* f (xi

* )

0 0 - -

1 0.1 0.05 0.997503

2 0.2 0.15 0.977751

3 0.3 0.25 0.939413

4 0.4 0.35 0.884706

5 0.5 0.45 0.816686

6 0.6 0.55 0.738968

7 0.7 0.65 0.655406

8 0.8 0.75 0.569783

9 0.9 0.85 0.485537

10 1 0.95 0.405555

TOTAL 7.471308

Page 67: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

67

3.3.3 Trapezoidal Rule

A revision of the Rectangular Rule. While in the Rectangular Rule we make a rectangle

for each subinterval, in Trapezoidal Rule we make a trapezoid for each subinterval.

Areas of all trapezoids are computed. Total area of all trapezoids is the estimation of the

area below the curve of the function, which is also the approximation of the integral of the function.

Page 68: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

68

Figure 3.7 Trapezoidal Rule

f (x)

x

y

x0 x1 x2 xn

Page 69: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

69

Thus, If the length of each subinterval is h, Height of the left hand side of the ith trapezoid = Height of the right hand side of the ith trapezoid =

Then the area of the ith trapezoid is

),( 1ixf

),( ixf

)).()((2

11 ii xfxfh

Page 70: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

70

Total area of all trapezoids

.)(2

1)()()()(

2

1

)(2

1)(

2

1

)(2

1)(

2

1)(

2

1)(

2

1

))()((2

1

))()((2

1))()((

2

1

1210

1

1201

1

1201

nn

nn

nn

xfxfxfxfxfh

xhfxfh

xhfxfhxhfxfh

xfxfh

xfxfhxfxfh

Page 71: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

71

TRAPEZOIDAL RULE

)(

2

1)()()()(

2

1)(

121 bfxfxfxfafhdxxf n

b

a

where x0 a and xn b

Page 72: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

72

. intervalin )(graph for the

minimum a )( and maximum a )(

give which and Here,

).(12

)()(

12

)(

:Rule lTrapezoidafor boundError

"

2"

1"

21

2"

2

3

1"

2

3

bxaxf

tftf

btabta

tfn

abtf

n

ab

Page 73: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

73

Example 3.11

0.1 10

01

is lsubinterva

each oflength then the1, and 0Given

h

ba

. 1

0

2

dxeestimate to

als subintervten withRule lTrapezoida Use

x

Solution

Page 74: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

74

i xi f (a) & f (b ) f (xi ), i=,…, n

TOTAL

Page 75: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

75

.)23(4)(

)12(2)(

2)(Then ,)(Given

ation.differenti following the

do toneed webound,error thecompute To

.746211.0

)778167.6()367879.1(2

1 1.0

table thefrom Thus,

2

2

22

2

2"'

2"

'

1

0

x

x

xx

x

exxxf

exxf

xexfexf

dxe

Page 76: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

76

Figure 3.7 Trapezoidal Rule

x

f (x)

f (x)

O 1

below. described as 10

intervalin increasing is )(graph that means This

.10 intervalin every for ,0)( that Note"

"'

x

xf

xxxf

Page 77: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

77

.lyrespective ,2 )0( and 735759.0 )1(

are 10 intervalin )(

of valuesminimum and maksimum the, So

735759.0)1)1(2(2 )1(

and 2)1)0(2(2 )0(

have we,)12(2)( From

1.0 intervalin maximum is )1( and

minimum is )0( , versus)( ofgraph theFrom

""

"

12"

02"

2"

"

""

2

2

2

ff

xxf

ef

ef

exxf

xf

fxxf

x

Page 78: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

78

.001667.0000614.0 or

)2()10(12

)01()735759.0(

)10(12

)01(or

)(12

)()(

12

)(

:Rule lTrapezoida of formulaerror the

to valuesminimum and maximum thengsubstitutiby

ion approximat thisof bounderror theestimate weNow

2

3

2

3

2"

2

3

1"

2

3

tfn

abtf

n

ab

Page 79: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

79

ion.approximat integral the tobounderror theaddingby

estimationour of accuration theincreasecan We

0.747878. 745597.0or

0.0016670.746211 000614.0 0.746211

interval following in the isresult theThus,

1

0

1

0

2

2

dxe

dxe

x

x

Page 80: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

80

3.3.4 Simpson’s Rule

Basic of Rectangular Rule Using constant to estimate the area of each subinterval.

Basic of Trapezoidal Rule Using linear equation to estimate the area of each subinterval.

Basic of Simpson’s Rule Using quadratic equation to estimate the area of each subinterval.

Page 81: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

81

.2or 2

and

gives This

. and between in is of valueThe

integrate. want tohat wefunction t in the

lssubinterva successive twodefine that points thebe

)),(,( and ))(,()),(,(Let

12020

1

0112

201

221100

xxxxx

x

hxxxx

xxx

xfxxfxxfx

Page 82: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

82

:figure following in the described as ),( parabola

below area theis )( that know We

.))(,( and ))(,()),(,(

esinterpolat that parabola a be )(Let

2

0

221100

2

xP

dxxP

xfxxfxxfx

cbxaxxP

x

x

Figure 3.7 Simpson’s Rule

x

y

x0 x1 x2 h h

P(x) = ax2 + bx + c

Page 83: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

83

)).()()()((2

))()()()((4

)()((3

)(

have we, and Taking

:follows as Rule sSimpson' formulatecan wecurve, a

below area estimate toparabola using ofresult theFrom

2642

1531

0

n

n

b

a

n

xfxfxfxf

xfxfxfxf

bfafh

dxxf

bxax

Page 84: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

84

lyrespective , intervalin )( of values

minimum and maximum theare )( and )(

and , where

)(180

)()(

180

)(

bygiven is Rule sSimpson'for bounderror The

)4(

2)4(

1)4(

21

2)4(

4

5

1)4(

4

5

bxaxf

tftf

btabta

tfn

abtf

n

ab

Page 85: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

85

.)(

following thehave Then we

. bounderror with

)(

is Rule sSimpson' using

integralan of valueeapproximat that theSuppose

21

21

S

b

aS

SS

b

a

ESdxxfES

EE

Sdxxf

Page 86: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

86

Example 3.12

integral. thecompute tous help that will tablea make We

.1.010

01 intervaleach oflength The

.1 to0 from respect to

with )( integrate want to We.)(Given 2

h

bax

xfexf x

. 1

0

2

dxecompute to

als subintervten withRule sson'Apply Simp

x

Solution

Page 87: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

87

i xi f (a) & f (b) f (xodd) f (xeven)

TOTAL

Page 88: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

88

.10 intervalin )( of valuesminimum and

maximum thefind toneed webound,error theestimate To

.746825.0

)037901.3(2)740266.3(4367879.13

1.0

have we table, theFrom

)4(

1

0

2

xxf

dxe x

Page 89: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

89

.0)15204(8)(

writeWe

.0)( ofsolution thecalculate toneed we

),( of points extrimumget To

.)15204(8)(

)3124(4)(

2)(

have we,)( From

2

2

2

2

2

24)5(

)5(

)4(

24)5(

24)4(

'

x

x

x

x

x

exxxxf

xf

xf

exxxxf

exxxf

xexf

exf

Page 90: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

90

.357589.7)1(

and ,419481.7)958572.0(

,12)0(

computecan we

,)3124(4)( from Now,

958572.0or 015204 ii)

or ,0or 08 i)

haveonly we

10 intervalin then ,0 sincebut

tested,becan that factors threeexists There

)4(

)4(

)4(

24)4(

24

2

2

f

f

f

exxxf

xxx

xx

xe

x

x

Page 91: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

91

1.0 )( 3.8Figure )4( xinterval in x versusxfGraph

O

12

7.419481

7.357589

minimum

maximum

f (4)(x)

x1 0.958572

Page 92: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

92

.000005.0000007.0

00000412.000000667.0

)419481.7()10(180

)01()12(

)10(180

)01(

bygiven is bounderror theThus,

419481.7)958572.0( is valueminimum the

and 12)0( is valuemaximum the

,10 intervalin )(for

: thatconcludecan wen,computatioour on Based

4

5

4

5

)4(

)4(

)4(

f

f

xxf

Page 93: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

93

lue.biggest va the takealways we

error, maximumfor and

alue,smallest v the takealways we

error, minimum for the example,For

lue.closest va not the

interval,biggest a takealways we

them,ofion approximat the

take toneed weif that boundserror for Note

error bounds

approximate error bounds

Page 94: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

94

.746830.0)(746818.0

000005.0746825.0)(000007.0746825.0

Conclusion

b

a

b

a

dxxf

dxxf

Page 95: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

95

3.4 Numerical Solution of Differential equations

In this part, we discuss two numerical methods to compute approximate solutions of differential equations:

1) One-step Euler method 2) The fourth order Runge-Kutta method

Page 96: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

96

NOTATION

).,('

i.e. , and in function

a asnotation thisuse also wepart, In this

or '

by denoted isoperation aldifferenti theUsually,

yxfydx

dy

yx

dx

dyy

Page 97: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

97

3.4.1 One-step Euler Method

This method is the most basic numerical method used to solve differential equation.

We shall discuss this Euler Method using the following example:

Example 3.13

2.

(1,1). )2(

xatyof value the eApproximat

through passingyxxdx

dyGiven

Page 98: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

98

Figure 3.9 One-step Euler Method with h = 1.

Solution

See the following figure

h 1 2

(x0, y0)(x1, y1)

4

1

y

x

Page 99: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

99

. of value theofion approximat theis

that assume wefigure, previous In the

.'by given is curve a of

line tangent theofgradient that theknow We

1

y

ydx

dyy

Page 100: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

100

l.subinterva considered theoflength theis and

),,(at line tangent theofgradient theis ' where

'

'

have we together,line tangent theof

gradient theandequation gradient thePutting

01

000

001

01

01

010

xxh

yxy

hyyy

h

yy

xx

yyy

Page 101: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

101

3)2)(1(1

'

is 2at of valueeapproximat theThus,

112

and

21)12(1

)2(

),('

that Note

001

01

000

000

hyyy

xy

xxh

yxx

yxfy

Page 102: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

102

tablefollowing in the explained as

2at 3 eapproximat that weisresult The xy

Notice that in general, the formula we use to estimate y can be written as

' 1 iii hyyy

The formula of One-step Euler Method

i xi yi yi’

0 1 1 2

1 2 3 -

Page 103: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

103

2.0. 1.5, ,0.1 and

5.0 2

12

is lsubintervaeach oflength Then the

ls.subinterva twointo interval thedivide weSuppose

ls?subinterva moreor twointo divided is 2 to

1 from interval theifion approximat

our ofaccuracy theincrease Can we

210

xxx

h

x

x

Page 104: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

104

See the following figure:

Figure 3.10 One-step Euler Method with h 0.5.

(x, y)

(x, y)

y

x

(x, y)

1 1.5 2

h h

Page 105: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

105

.2

)2)(5.0(1

'

obtain we,5.0 with nowbut before, did weAs

.5.1at of valueeapproximat theis Here

. compute tohave we, computing Before

. is 2at of value

eapproximat that thesuppose Now,

001

1

12

2

hyyy

h

xyy

yy

yxy

Page 106: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

106

..

..

yxx

,yxfy

y

x

xy

752

2)512)(51(

)2(

)(' Thus,

2. usinggradient the

eapproximat tois docan What we.5.1at

line tangent theofgradient exact thecomputenot can we

,5.1at of eexact valu theknownot do weSince

111

111

1

Page 107: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

107

i xi yi yi′

0 1 1 2

1 1.5 2 2.75

2 2 3.375 -

: tablefollowing in the listed are results The

before. one n thebetter tha ision approximat This

.375.3

)75.2)(5.0(2

'

' and

112

12

12

121

hyyy

h

yy

xx

yyy

Page 108: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

108

3.2.8,,.4, 11.2, , 1

are of Values

3)2.0(1

xxxxx

x

x

Example 3.14

NOTATION

.at last value thereaching until lsubinterva of

n calculatioevery in of value the to up add

and begin with that wemeansnotation This

.)(

by denoted becan considered be to of valuesThe

bx

xh

ax

bhax

x

3.2.8,,.4, 11.2, , 1

are of Values

3)2.0(1

xxxxx

x

x

Page 109: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

109

Example 3.15

.2 , (1,1)

)2( ,

xatyeapproximat through passing

yxxdx

dygiven i.e. problem previous our

solveto als subintervfive take weSuppose

.2)2.0(1 and

.2.0 5

12 Here,

x

h

Solution

Page 110: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

110

i xi yi yi’

0 1.0 1 2

1 1.2 1.4 2.36

2 1.4 1.872 2.712

3 1.6 2.4144 3.0544

4 1.8 3.02528 3.38528

5 2.0 3.702336 -

The results of our approximation are listed in the following table:

Approximation by One-step Euler method with h 0.2.

Page 111: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

111

If we take ten subintervals, we have

i xi yi yi’

0 1.0 1 2

1 1.1 1.2 2.19

2 1.2 1.419 2.379

3 1.3 1.6569 2.5669

4 1.4 1.91359 2.75359

5 1.5 2.188949 2.938949

6 1.6 2.482844 3.122844

7 1.7 2.795128 3.305128

8 1.8 3.125641 3.485641

9 1.9 3.474205 3.664205

10 2.0 3.840626 -

Approximation by One-step Euler method with h 0.1.

Page 112: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

112

3.4.2 : The fourth order Runge-Kutta Method

Runge-Kutta Method is more accurate compare to Euler Method.

As usual, given y′ f (x, y) and the initial condition (x0, y0) and we want to find the value of y at other values of x.

Page 113: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

113

).22(6

1 and

where

),(

2,

2

2,

2

),(

: follows as valuesteintermediafour

calculate toneed weMethod, Kutta-RungeIn

43211

1

34

23

12

1

kkkkyy

xxh

kyhxhfk

ky

hxhfk

ky

hxhfk

yxhfk

ii

ii

ii

ii

ii

ii

Page 114: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

114

Example 3.16

2.)5.0(1

(1,1). )2(

xforyof value the eApproximat

through passingyxxdx

dyGiven

have we(1,1),),(

Using values.teintermediafour following the

calculate we,5.1at estimate To

.2,5.1,1 have weexample In this

00

1

210

yx

xy

xxx

Solution

Page 115: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

115

.273438.1

]609375.1)25.12(25.1)[5.0(

)609375.1 ,25.1((0.5)

2,

2

21875.1

]5.1)25.12(25.1)[5.0(

)5.1 ,25.1((0.5)

2,

2

1 ]1)12(1)[5.0(

)1 ,1((0.5)

),(

2003

1002

001

f

ky

hxhfk

f

ky

hxhfk

f

yxhfk

Page 116: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

116

1.5. at 249349.2 :Result

.249349.2

)511719.1)273438.1(2)21875.1(2(16

11

)22(6

1 and

511719.1

]273438.2)5.12(5.1)[5.0(

)273438.2,5.1((0.5)

),(

11

432101

3004

xy

kkkkyy

f

kyhxhfk

Page 117: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

117

have We

2.249349). (1.5,),( using nowbut n,calculatio

previousour repeat we,2at compute To

11

2

yx

xy

.718343.1

]2.999186)75.12(75.1)[5.0(

)2.999186 ,75.1((0.5)

2

499674.12.249349,

2

5.05.1(0.5)

2,

2

499674.1

]2.249349)5.12(5.1)[5.0(

)2.249349 ,5.1((0.5)

),(

1112

111

f

f

ky

hxhfk

f

yxhfk

Page 118: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

118

.011180.2

]022359.4)22(2[)5.0(

)022359.4,2()5.0(

)773010.1249349.2,5.05.1((0.5)

),( 3114

f

f

f

kyhxhfk

773010.1

]108521.3)75.12(75.1)[5.0(

)108521.3,75.1()5.0(

2

718343.1249349.2,

2

5.05.1(0.5)

2,

22

113

f

f

ky

hxhfk

Page 119: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

119

i xi yi k1 k2 k3 k4

0 1 1 1 1.21875 1.273438 1.511719

1 1.5 2.249349 1.499674 1.718383 1.773010 2.011180

2 2 3.998276 - - - -

:ncalculatioour ofresult for the tablefollowing theSee

2. when 998276.3 :Result

.998276.3

)22(6

1 and

22

432112

xy

kkkkyy

Page 120: 1 CHAPTER 3 NUMERICAL METHODS Roots of Nonlinear equations Interpolation (In  -Dimension) Numerical Integration Numerical Solution of Differential Equations.

120

Conclusion

If we increase the number of subintervals(i.e. with smaller value of h),then we obtain a more accurate approximation

.2at 999997.3obtain we1(0.1)2, i.e.

ls,subinterva by taking continue, weIf

.2at 999948.3 have we

2, )2.0(1 i.e. ls,subinterva take weIf

xyx

ten

xy

xfive


Recommended