+ All Categories
Home > Documents > 5.4 Runge-Kutta 4 Method

5.4 Runge-Kutta 4 Method

Date post: 03-Jan-2016
Category:
Upload: abel-spence
View: 57 times
Download: 1 times
Share this document with a friend
Description:
5.4 Runge-Kutta 4 Method. Carl Runge (1856-1927). Martin Wilhelm Kutta (1 867-1944 ). Motivation. With Euler’s method, error is described by a straight line: i.e., it is proportionate to (linear in) D t . We say that error is O( D t ) : “Order D t”, or “Big-O D t ” Can we do better?. - PowerPoint PPT Presentation
18
5.4 Runge-Kutta 4 Method
Transcript
Page 1: 5.4 Runge-Kutta 4 Method

5.4 Runge-Kutta 4 Method

Page 2: 5.4 Runge-Kutta 4 Method

Carl Runge(1856-1927)

Martin Wilhelm Kutta

(1867-1944)

Page 3: 5.4 Runge-Kutta 4 Method

Motivation• With Euler’s method, error is described by a straight line: i.e., it is proportionate to

(linear in) t.• We say that error is O(t) : “Order t”, or “Big-O t”• Can we do better?

Page 4: 5.4 Runge-Kutta 4 Method

First Estimate ∂1• Recall update rule from Euler’s Method:

Pn ← Pn-1 + f(tn-1, Pn-1 ) ∆t where f is the derivative function

• We call f(tn-1, Pn-1 ) 80 the first estimate, or ∂1

∆t = 8

∂1 = 80

Page 5: 5.4 Runge-Kutta 4 Method

Second Estimate ∂2

• Second estimate ∂2 uses the halfway point along the

line segment to ∂1

Page 6: 5.4 Runge-Kutta 4 Method

Second Estimate ∂2• Combined with slope 0.10 (from dP/dt = 0.10P), this gives us a new

endpoint = (0.1)(140)(8) = 112, which is the second estimate ∂2.

• ∂2 = f(tn-1+0.5t, Pn-1+0.5∂1) t

∆t = 8

∂2= 112

Page 7: 5.4 Runge-Kutta 4 Method

Third Estimate ∂3

• Third estimate ∂3 uses the halfway point along the line segment from ∂2

• ∂3 =(0.1)(156)(8) = 124.8

Page 8: 5.4 Runge-Kutta 4 Method

Third Estimate ∂3

• (0.1)(156)(8) = 124.8, which is the third estimate ∂3.

• ∂3 = f(tn-1+0.5t, Pn-1+0.5∂2) t

∂3= 124.8

Page 9: 5.4 Runge-Kutta 4 Method

Fourth Estimate ∂4

• Fourth estimate ∂4 is taken at end of interval

• ∂4 =(0.1)(224.8)(8) = 179.84

Page 10: 5.4 Runge-Kutta 4 Method

Fourth Estimate ∂4

• ∂4 =(0.1)(224.8)(8) = 179.84, which is the fourth estimate ∂4.

• ∂4 = f(tn-1+ t, Pn-1+∂3) t

∂4= 179.8

Page 11: 5.4 Runge-Kutta 4 Method

Runge-Kutta 4 Estimate• Bring it all together: a weighted average that privileges the middle values:

Pn = Pn-1 + (∂1 + 2∂2 + 2∂3 + ∂4) / 6 = 100 + (80 + 2*112 + 2*124.8 + 179.84) / 6

= 222.24

• Relative error = |222.4 - 222.55| / |222.55| = 0.14%(Compare 19% for Euler’s Method)

• RK4 error is O(t4) : a very small number, because error is < 1.

Page 12: 5.4 Runge-Kutta 4 Method

Runge-Kutta 4 Algorithm

t ← t0

P(t0)← P0

Initialize NumberOfSteps

for n going from 1 to NumberOfSteps do the following:

tn ← t0 + n∆t

∂1 = f(tn-1, Pn-1 )

∂2 = f(tn-1+0.5t, Pn-1+0.5∂1) t∂3 = f(tn-1+0.5t, Pn-1+0.5∂2) t∂4 = f(tn-1+ t, Pn-1+∂3) t

Page 13: 5.4 Runge-Kutta 4 Method

Runge-Kutta 4 in Excel

Page 14: 5.4 Runge-Kutta 4 Method

Runge-Kutta 4 in Excel

Page 15: 5.4 Runge-Kutta 4 Method

Runge-Kutta 4 in Excel

Page 16: 5.4 Runge-Kutta 4 Method

Runge-Kutta 4 in Excel

Page 17: 5.4 Runge-Kutta 4 Method

Runge-Kutta 4 in Excel

Page 18: 5.4 Runge-Kutta 4 Method

Runge-Kutta 4 in Excel


Recommended