54
Summary of Lectures Just click to see next animation Prepared by: Dr. Suhaila Mohamad Yusuf [email protected] Prepared by Dr. Suhaila Mohamad Yusuf

Computational mathematic

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Summary of Lectures

Just click to see next animation

Prepared by: Dr. Suhaila Mohamad [email protected]

Page 2: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

CHAPTER 6NON-LINEAR EQUATIONS

Page 3: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Centre Limit Theorem

• Given an equation of f(x) with an interval of [a,b], you need to determine whether there exist at least a real root in that interval

• CLT said that if f(a) and f(b) have opposite sign (one is –ve and another is +ve) then there exist at least a real root in that interval

af(a) +ve

bf(b) -ve

Page 4: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Bisection Method

i a b f(a) f(b) c f(c)

0 0 1

f(x) = x3 – 3x2 + 8x - 5

-5 1 0.5 -1.625

1 0.5 1-1.6251

c = (a + b) / 2 [0,1] ℇ=0.005

These are from the given interval

6

0.5-ve f(x) +ve f(x)

f(c) > then, ℇnew interval!

0.75 -0.266

2 0.75 1-0.2661 0.875 0.373

3 0.75 0.373-0.2660.875 0.8125 0.056

4 0.75 0.056-0.2660.813 0.7815 -0.103

5 0.782 0.056-0.1030.813 0.7975 -0.0210.798 0.056-0.0210.813 0.8055 0.020

7 0.798 0.02-0.0210.806 0.802 0.002

Calculated from this equation

0 1-ve f(x)

How to choose the new interval?

We need to take this c value. How about another one?

CLT said that f(a) and f(b) should have opposite sign!

Repeat all the steps CAREFULLY until f(c) < ℇ

Is this < ℇ? Yes, stop! No, next iteration!

This is the root!!

Make sure these parts have opposite sign!

Page 5: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

False Position Method

i a b f(a) f(b) c f(c)

0 0 1

f(x) = x3 – 3x2 + 8x - 5

-5 1 0.833 -1.625

c = [af(b) - bf(a)] / [f(b) – f(a)] [0,1] =0.005ℇ

These are from the given interval

Calculated from this equation

Is this < ℇ? Yes, stop! No, next iteration!

1 0 0.162-50.8333 0.807 0.029

2 0 0.029-50.807 0.802 0.004

This is the root!!Remember how to choose the

interval value? What does the CLT said about interval?

Page 6: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Secant Method

i xi xi+1 xi+2 f(xi+2)

0 1 0

f(x) = sin (x) + 3x – e3

0.2652

1 0 0.37230.4710

xi+2 = [xif(xi+1) – xi+1f(xi)] / [f(xi+1) – f(xi)]

x0 = 1 , x1 = 0 =0.0005ℇ

These are from the given values of x0 and x1

Calculated from this equation

Is this < ℇ? Yes, stop! No, next iteration!

Continue iteration until f(xi+2) < ℇ

New interval. Take the latest 2 values as next interval

0.0295-0.00122 0.4710 0.35990.3723

3 0.3723 0.00000.36040.3599

0.4710

This is the root!!

Page 7: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Newton’s Method

n xn f(xn) f’(xn)

0 1

f(x) = x3 – sin x

1 0.93555 2.032390.01392

Xn+1 = xn – [f(xn) / f’(xn)] x0 = 1 =0.0005ℇ

This is from the given values of x0

Calculated from this equation

Is |xn+1 – xn| < ℇ? Yes, stop! No, next iteration!

Continue iteration until |xn+1 – xn| < ℇ

2 0.92870 1.988580.00015

3 0.92862 1.98807-0.00001

2.45970

This is the root!!

4 0.92862

Calculated from the derivative of f(x)

0.15853

Page 8: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

CHAPTER 7EIGENVALUE PROBLEM

Page 9: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Characteristic Polynomial• p(λ) = det (A –λI)

51

23A

51

23

10

01

51

23IA

• p(λ) = det (A –λI) = [(3- λ)(5- λ)] – [(-2)(-1)] = λ2 - 8λ + 13

Page 10: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Gerschgorin’s Circle Theorem

421

131

123

A

Row 1:|λ – 3| < |–2| + |1||λ – 3| < 3

Row 2:|λ – 3| < |–1| + |1||λ – 3| < 2

Row 3:|λ – (-4)| < |1| + |–2||λ – 4| < 3

0 < λ < 6λ ϵ (0,6)

1 < λ < 5λ ϵ (1,5)

-7 < λ < -1λ ϵ (-7,-1)

radius = 3

radius = 2

radius = 3

-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6

λ ϵ (-7,6)

Page 11: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Power Method

• Aims to find dominant eigenvalue (largest value of eigenvalue)

544

101

121

A v(0) = (0,0,1)T

ε = 0.001

Page 12: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Power Method

544

101

121

Av(0) = (0,0,1)T

ε = 0.001

k (v(k))T (Av(k))T mk+1

0

1

0

-0.2

0

0.2

1

1

-1 1 5 5

ǁv(k+1)-v(k)ǁ < ε ? No, next iteration

Note that ǁv(k+1)-v(k)ǁ is a difference of two vectors.

222)0()1(

2222

211

)11()02.0()02.0(

)(...)()(

vv

uvuvuvuv nn

EigenvalueEigenvector

2

34

5

6

7

-0.235

-0.245-0.248

-0.249

-0.250

-0.250

0.235

0.2450.248

0.249

0.250

0.250

1

11

1

1

1

-0.765

-0.755-0.752

-0.751

-0.750

0.765

0.7550.752

0.751

0.750

3.12

3.043.016

3.008

3.000

3.12

3.043.016

3.008

3.000

A v*Abs max between

these values

These values-0.8 0.8 3.4 3.4

divided by that value

to have these values

Page 13: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Shifted Power Method

• Aims to find smallest eigenvalue and intermediate eigenvalue

544

101

121

A v(0) = (0,1,0)T

ε = 0.001λ1 = 3.0

Page 14: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Shifted Power Method

244

131

122

0.300

00.30

000.3

544

101

121

100

010

001

0.3

544

101

121

0.3 IA

IAB

Page 15: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Shifted Power Method

244

131

122

Bv(0) = (0,1,0)T

ε = 0.001

k (v(k))T (Bv(k))T mk+1

0

1

0

-0.5

1

0.75

0

1

2 -3 -4 -4

ǁv(k+1)-v(k)ǁ < ε ? No, next iteration

Note that ǁv(k+1)-v(k)ǁ is a difference of two vectors.

2222

211 )(...)()( nn uvuvuvuv

Shifted EigenvalueEigenvector

2

34

5

6

7

-0.5

-0.5-0.5

-0.5

-0.5

-0.5

0.583

0.5170.508

0.504

0.502

0.501

1

11

1

1

1

1.166

1.0721.034

1.016

1.008

-1.249

-1.108-1.051

-1.024

-1.012

-2.332

-2.144-2.068

-2.032

-2.016

-2.332

-2.144-2.068

-2.032

-2.016

B v*Abs max between

these values

These values1.5 -1.75 -3 -3

divided by that value

to have these values

10 -0.5 10 1

8

9

-0.5

-0.5

0.5

0.5

1

1

1.002

1.000

1.004

-1.003

-1.000

-1.006

-2.004

-2.000

-2.008

-2.004

-2.000

-2.008

Page 16: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Shifted Power Method

• λshifted = -2.0

• λ3 = λshifted + λ1 = -2.0 + 3.0 = 1.0

• Intermediate λ2

λ1 + λ2 + λ3 = a11 + a22 + a33

3.0 + λ2 + 1.0 = 1 + 0 + 5 λ2 = 2.0

544

101

121

A

Caution!!! Use the original matrix, A.

Not the shifted matrix, B.

Page 17: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

CHAPTER 8INTERPOLATION

Page 18: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Interpolation Approximation

May need table re-arrangement

Least Square

Langrage

Newton Divided Difference

Newton Backward Difference

Newton Forward Difference

Page 19: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Newton Forward Differencek 0 1 2 3 4 5

xk 1.0 1.2 1.4 1.6 1.8 2.0

yk 0.5000 0.4545 0.4167 0.3846 0.3571 0.3333

Find y(1.1)

k xk yk ∆yk ∆2yk ∆3yk ∆4yk ∆5yk

0 1.0 0.5000

1 1.2 0.4545

2 1.4 0.4167

3 1.6 0.3846

4 1.8 0.3571

5 2.0 0.3333

-0.0455 0.0077 -0.0020 0.0009 -0.0007

-0.0378 0.0057 -0.0011 0.0002

-0.0321 0.0046 -0.0009

-0.0275 0.0037-0.0238

This value

minus this value

To get this value

Repeat until last column

x=1.1 located here

x=1.0 is chosen as ref. point

because of higher degree

Page 20: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Newton Forward Difference• h = 1.2 – 1.0 = 0.2 and

r = (x – x0) / h = (1.1 – 1.0) / 0.2 = 0.5

4761.0

0000191.00000352.0000125.00009625.002275.05000.0

)0007.0(120

)45.0)(35.0)(25.0)(15.0)(5.0(

)0009.0(24

)35.0)(25.0)(15.0)(5.0()0020.0(

6)25.0)(15.0)(5.0(

)0077.0(2

)15.0)(5.0()0455.0)(5.0(5000.0)1.1(p

y!5

)4r)(3r)(2r)(1r(ry

!4)3r)(2r)(1r(r

y!3

)2r)(1r(r y

!2)1r(r

yr y)x(p

5

05

04

03

02

005

Page 21: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Newton Backward Differencek 0 1 2 3 4 5

xk 1.0 1.2 1.4 1.6 1.8 2.0

yk 0.5000 0.4545 0.4167 0.3846 0.3571 0.3333

Find y(1.9)

k xk yk ∇yk ∇2yk ∇3yk ∇4yk ∇5yk

0 1.0 0.5000

1 1.2 0.4545

2 1.4 0.4167

3 1.6 0.3846

4 1.8 0.3571

5 2.0 0.3333

-0.04550.0077

-0.0020

0.0009

-0.0007

-0.03780.0057

-0.0011

0.0002

-0.03210.0046

-0.0009-0.0275

0.0037-0.0238

This value

minus this value

To get this value

Repeat until last column

x=1.9 located here

x=2.0 is chosen as ref. point

because of higher degree

Page 22: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Newton Backward Difference• h = 1.2 – 1.0 = 0.2 and

r = (x – x0) / h = (1.9 – 2.0) / 0.2 = -0.5

3448.0

0000191.0000007869.000005625.00004625.00119.03333.0

)0007.0(120

)45.0)(35.0)(25.0)(15.0)(5.0(

)0002.0(24

)35.0)(25.0)(15.0)(5.0()0009.0(

6

)25.0)(15.0)(5.0(

)0037.0(2

)15.0)(5.0()0238.0)(5.0(3333.0)9.1(

!5

)4)(3)(2)(1(

!4

)3)(2)(1(!3

)2)(1(

!2

)1( )(

5

55

54

53

52

555

p

yrrrrr

yrrrr

yrrr

yrr

yryxp

Page 23: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Newton Divided Differencek 0 1 2 3 4

xk 1.0 1.6 2.5 3.0 3.2

yk 0.5000 0.3846 0.2857 0.2500 0.2381

Find y(1.3)

k xk f[xk] f1[xk] f2[xk] f3[xk] f4[xk]

0 1.0 0.5000

1 1.6 0.3846

2 2.5 0.2857

3 3.0 0.2500

4 3.2 0.2381

-0.1923 0.0549 -0.0137 0.0032

-0.1099 0.0275 -0.0066

-0.0714 0.0170

-0.0595

To fill in this col, we know that lower

value – upper value

See this number?

Go to col xk and count down the col according to

number on top of the col. Then the

last value of x minus with the first value of x.

1st step, mark the col like

this start from f[xk].

1 2 3 4 5

Big problem is ‘divide with what?’

1

20.16.1

5000.03846.0

1

26.15.2

3846.02857.0

3

20.15.2

)1923.0(1099.0

Page 24: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Newton Divided Difference

• Interpolation Polynomial expression

• Assign the value into the polynomial expression

)xx)(xx)(xx)(xx](x,x,x,x,x[f

)xx)(xx)(xx](x,x,x,x[f

)xx)(xx](x,x,x[f)xx](x,x[fy)x(p

321043210

2103210

1021001004

4353.0

00058752.00014796.0004941.005769.05.0

)0.33.1)(5.23.1)(6.13.1)(0.13.1(0032.0

)5.23.1)(6.13.1)(0.13.1)(0137.0(

)6.13.1)(0.13.1(0549.0)0.13.1)(1923.0(5.0)3.1(p4

Page 25: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

k 0 1 2 3 4

xk

yk

Newton Divided Difference

• Re-arrange the table then do as previous• How to re-arrange table?

k 0 1 2 3 4

xk 1.0 1.6 2.5 3.0 3.2

yk 0.5000 0.3846 0.2857 0.2500 0.2381

Find y(2.8)

k 0 1 2 3 4

xk

yk

1.0

0.5000

1.6

0.3846

2.5

0.2857

3.0

0.2500

3.2

0.2381

2.8 is in hereValue of x before

and after 2.8Decending value of

remaining x

Page 26: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Langragek 0 1 2 3 4

xk 1.0 1.6 2.5 3.0 3.2

yk 0.5000 0.3846 0.2857 0.2500 0.2381

n

0iiinn1100n y)x(Ly)x(L.......y)x(Ly)x(L)x(p

Find y(1.3)

44332211004

4

0iii4

y)x(Ly)x(Ly)x(Ly)x(Ly)x(L)x(p

y)x(L)x(p

Page 27: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Langrage

• Calculate L0

2936.0)2.30.1)(0.30.1)(5.20.1)(6.10.1()2.33.1)(0.33.1)(5.23.1)(6.13.1(

)xx)(xx)(xx)(xx()x3.1)(x3.1)(x3.1)(x3.1(

)3.1(L40302010

43210

• With the same method, calculate L1, L2 ,L3 ,L4

Because it is L0, x0 is nowhere to be found up here

Because it is L0, x0 is deducted with other x

Page 28: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Langrage

4353.0

)2381.0(3726.0)2500.0(7329.0

)2857.0(6152.0)3846.0(9613.0)5000.0(2936.0

y)3.1(L)3.1(p4

0iii4

Page 29: Computational mathematic

Least Square

• Determine the appropriate linear polynomial

expression, p(x) = a0 + a1x based on the following data:

• Determine f(2.3)

Prepared by Dr. Suhaila Mohamad Yusuf

1

0

1

0

21

10

v

v

a

a

ss

ss

x 1 2 3 4 5

f(x) 0.50 1.40 2.00 2.50 3.10

Page 30: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

xk0 xk1 xk2 fk xk0fk xk1fk1 1 1 0.5 0.5 0.5

1 2 4 1.4 1.4 2.8

1 3 9 2.0 2.0 6.0

1 4 16 2.5 2.5 10.0

1 5 25 3.1 3.1 15.5

5 15 55 - 9.5 34.8

Least Square

1

0

1

0

21

10

v

v

a

a

ss

ss

8.34

5.9

a

a

5515

155

1

0

Page 31: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Least Square

• Solution, a0 = 0.01 dan a1 = 0.63

• Therefore, the polynomial expression is p(x) =

0.01x + 0.63

• To determine f(2.3):

8.34

5.9

a

a

5515

155

1

0

653.0)3.2(p)3.2(f653.063.0)3.2(01.0)3.2(p

Page 32: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

CHAPTER 9NUMERICAL

DIFFERENTIATION

Page 33: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

NUMERICAL INTEGRATION

FIRST DERIVATIVE

f‘(x) SECOND DERIVATIVE

f‘’(x)

2-point Formula

Forward Difference

Central Difference

Backward Difference

3-point Formula

Forward Difference

Backward Difference

5-point Formula

Forward Difference

Central Difference

Central Difference

3-point Formula 5-point

Formula

Central Difference

Page 34: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

SORRY!!! I DIDN’T PREPARE ANYTHING. THIS CHAPTER IS TOO

EASY. MAKE SURE YOU KNOW WHICH FORMULA TO USE..

Page 35: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

CHAPTER 10NUMERICAL

INTEGRATION

Page 36: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Numerical Integration

• Interval / scale, h

N

abh

Page 37: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Trapezoidal Rule

• Approximate the following integral using the Trapezoidal rule with h=0.5

dxx

x

4

1 4

Nb a

h

4 1

0 56

.

Page 38: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Trapezoidal Rule

prepared by Razana Alwee8486.48614.1

4142.10.46

2780.15.35

1339.10.34

9806.05.23

8165.00.22

6396.05.11

4472.00.104

)(

Total

x

xxfxi

i

iii

1st and last values

In-between values

dxxfdxx

x

4

1

4

1)(

4

hf f f f f f f

220 6 1 2 3 4 5

8486.428614.12

5.0

8896.2

Page 39: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Simpson’s 1/3 Rule

• Approximate the following integral using the Trapezoidal rule with h=0.5

dxx

x

4

1 4

Nb a

h

4 1

0 56

.

Page 40: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

9504.18982.28614.1

4142.10.46

2780.15.35

1339.10.34

9806.05.23

8165.00.22

6396.05.11

4472.00.104

)(

Total

x

xxffxi

i

iiii

Simpson’s 1/3 Rule

1st and last values

Odd column

Even column

2

12

3

11260

4

124

34 ii

ii ffff

hdx

x

x

)9504.1(2)8982.2(48614.13

5.0

8925.2

Page 41: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Simpson’s 3/8 Rule

• Approximate the following integral using the Trapezoidal rule with h=0.25

dxx

x

4

1 4

1225.0

14

h

abN

Page 42: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Simpson’s 3/8 Rule

9174.27191.78614.1

4142.100.412

3470.175.311

2780.150.310

2070.125.39

1339.100.38

0586.175.27

9806.050.26

9000.025.25

8165.000.24

7298.075.13

6396.050.12

5455.025.11

4472.000.104

)(

Total

x

xxffxi

i

iiii

1st and last values

Remaining values

‘Ganda 3’ (3,6,9)

4

1

3

131323120

4

123

8

3

4 i iiii fffff

hdx

x

x

)9174.2(2)7191.7(38614.18

)25.0(3

8925.2

Page 43: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Formula for Romberg Table

i hi Ri,1 Ri,2 Ri,3

1

2

3

ab

12

1h

22

1h

101

1,1 2ff

hR

22

11211,11, 2

1i

kkiii fhRR 14

41

1,11,1

,

j

jijij

ji

RRR

Romberg Integration

Page 44: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Romberg Integration

• Use Romberg integration to approximate

• Compute the Romberg table until |Ri,j - Ri,j-1|<0.0005

dxx

x

4

1 4

Page 45: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Romberg Integration

h b a1 4 1 3

.7921.2

4142.14472.02

32 101

1,1

ffh

R

f0f1

h = 31 4

Integration starts from 1 to 4 and only has 1

segment

4772.041

14

1

dxx

x

4

1 4

4142.144

44

1

How to calculate these?

13

14

h

abN

From the h here, we can know the N

(number of segments)

Therefore, we only have f0 and f1, the first node

and the last node

Find the f0 = f(1) and f1 = f(4) using this f(x)

Page 46: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

i hi Ri,1 Ri,2 Ri,3

Romberg Integration

Fill in the Romberg Table with answers that you’ve got previously

31

2

3

2.7921

Now we need to fill in the 2nd

row

h2 is half of h11.5

This value needs to be calculated using other

formula

Page 47: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Romberg Integration

5.12

112 hh

f0 f2

h = 1.51 4

Integration starts from 1 to 4 and has 2

segments

9806.045.2

5.24

1

dxx

x

4

1 4

How to calculate this?

25.1

14

h

abN

From the h here, we can know the N

(number of segments)

Therefore, we have three nodes f0 ,f1, and f2,

Find the f1 = f(2.5) using this f(x)

))5.2((2

1

)(2

1

2

1

11,1

111,1

1

11211,11,2

fhR

fhR

fhRRk

k

8670.2

9806.037921.22

1

2.5

f1

Remember!! Every time you calculate new Rxx, your f0, f1, ... fx will be changed!!

Draw diagram to be safe!!

Page 48: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Romberg Integration

• Calculate R2,2 using another formula

8920.2

3

7921.28670.24

3

4 1,11,22,2

RRR

0005.0025.08670.28920.21,22,2 RR

• Is |Ri,j - Ri,j-1|<0.0005? Only compare with R in the same row, not the same column

Page 49: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

i hi Ri,1 Ri,2 Ri,3

Romberg Integration

Fill in the Romberg Table with answers that you’ve got previously

31

2

3

2.7921

Now we need to fill in the 3rd

row

h3 is half of h2

1.5

This value needs to be calculated using other

formula

2.8670 2.8920

0.75

Page 50: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Romberg Integration

75.02

123 hh

f0 f2

h = 0.75

1 2.5

Integration starts from 1 to 4 and has 4

segments

7298.0475.1

75.14

1

dxx

x

4

1 4

How to calculate this?

475.0

14

h

abN

From the h here, we can know the N

(number of segments)

Therefore, we have five nodes f0 ,f1, f2 ,f3 and f4,

Find the f1 = f(1.75) and f3 = f(3.25) using this f(x)

1.75

f1

3.25 4

f3 f4

)(2

1

2

1

3121,2

2

11221,21,3

ffhR

fhRRk

k

8861.2

2070.17298.05.18670.22

1

))25.3()75.1((2

121,2

ffhR2070.1

425.3

25.34

1

Page 51: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Romberg Integration

• Calculate R3,2 using another formula

8925.2

3

8670.28861.24

3

4 1,21,32,3

RRR

0005.00064.08861.28925.21,32,3 RR

• Is |Ri,j - Ri,j-1|<0.0005? Only compare with R in the same row, not the same column

Page 52: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

Romberg Integration

• Calculate R3,3 using another formula

8925.2

15

8920.28925.216

15

4 2,22,33,3

RRR

0005.00000.08925.28925.22,33,3 RR

• Is |Ri,j - Ri,j-1|<0.0005? Only compare with R in the same row, not the same column

Stop Iteration!!

Page 53: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

i hi Ri,1 Ri,2 Ri,3

Romberg Integration

Fill in the Romberg Table with answers that you’ve got previously

31

2

3

2.7921

The solution of integration is here

1.5 2.8670 2.8920

0.75 2.8925 2.89252.8861

You don’t need to generate Trapezoidal Table!

Just follow my way..

Page 54: Computational mathematic

Prepared by Dr. Suhaila Mohamad Yusuf

ALL THE BEST!