Runge Kutta Method. 1

Embed Size (px)

Citation preview

  • 8/2/2019 Runge Kutta Method. 1

    1/20

  • 8/2/2019 Runge Kutta Method. 1

    2/20

    Introduction: Numerical methods for differential equations are of great

    importance to the engineer because practical problemsoften lead to differential equations that cannot be solvedaccurately to get exact results.

    These are a group of implicit and explicit methods used forapproximation of solutions of Ordinary Differentialequations.

    The methods are classified as :

    ExplicitEmbeddedImplicit

    We shall mainly talk about the explicit method used to findthe solution of ODE.

  • 8/2/2019 Runge Kutta Method. 1

    3/20

    Explicit method: Forward Euler method

    Generic second-order method

    Kuttas third-order method

    Classic fourth-order method

  • 8/2/2019 Runge Kutta Method. 1

    4/20

  • 8/2/2019 Runge Kutta Method. 1

    5/20

    Engineering Applications Control Systems

    Laplace transforms

    Electrical equations Chemical engineering

  • 8/2/2019 Runge Kutta Method. 1

    6/20

    Formulae

    34

    23

    12

    1

    4321

    ,

    2

    1,

    2

    1

    2

    1,

    2

    1

    ,

    226

    1

    kyhxfhk

    kyhxfhk

    kyhxfhk

    yxfhk

    kkkky

  • 8/2/2019 Runge Kutta Method. 1

    7/20

    Problem :1) Using Runge Kutta fourth order method, find y(0.2) for theequation dy/dx= (y-x)/(y+x), y(0)=1 taking h=0.2

    >> By data f(x,y) = (y-x)/(y+x), x0=0, y0=1, h=0.2We shall first compute k1, k2, k3, k4

    k1 = h f(x0,y0) = (0.2) f(0,1) = (0.2) [(1-0)/(1+0)] = 0.2

    k2 = h f(x0 + h/2 , y0 +k1/2) = (0.2) f(0.1, 1.1) =(0.2) [(1.1-0.1)/ (1.1+0.1)] = 0.1667

    k3 = h f(x0 +h/2 , y0 +k2/2) = (0.2) f(0.1, 1.0835) =(0.2) [(1.0835-0.1)/ (1.0835+0.1)] = 0.1662

  • 8/2/2019 Runge Kutta Method. 1

    8/20

    k4 = h f(x0 + h , y0 +k3) = (0.2) f(0.2, 1.1662) =

    (0.2) [(1.1662-0.2)/ (1.1662+0.2)] = 0.1414

    We have, y(x0 + h) = y0 + 1/6 (k1 +k2 + k3 + k4 )

    Therefore,

    y(0.2) = 1 + 1/6 [(0.2 + 2(0.1667) + 2(0.1662) + 0.1414]

    Thus y(0.2) = 1.1679

  • 8/2/2019 Runge Kutta Method. 1

    9/20

    2) Use Runge Kutta fourth order method to find y at x=0.1 given

    that dy/dx= 3ex + 2y, y(0)=0 taking h=0.1

    >> By data f(x, y) = 3ex + 2y, x0=0, y0=0, h=0.1

    We shall first compute k1, k2, k3, k4

    k1 = h f(x0,y0) = (0.1) f(0,0) = (0.1) [3e0

    + 2 0] = 0.3k2 = h f(x0 + h/2 , y0 +k1/2) = (0.1) f(0.05, 0.15)

    = (0.1) [3e0.05 + 2(0.15)] = 0.3454

    k3 = h f(x0 +h/2 , y0 +k2/2) = (0.1) f(0.05, 0.1727)

    = (0.1) [3e0.05 + 2(0.1727)] = 0.3499

  • 8/2/2019 Runge Kutta Method. 1

    10/20

    k4 = h f(x0 + h , y0 +k3) = (0.1) f(0.1, 0.3499)

    = (0.1) [3e0.1 + 2(0.3499)] = 0.4015

    We have, y(x0 + h) = y0 + 1/6 (k1 +2k2 +2 k3 + k4 )

    Therefore,

    y(0.1) = 0 + 1/6 [(0.3 + 2(0.3454) + 2(0.3499) + 0.4015]

    Thus y(0.2) = 0.3487

  • 8/2/2019 Runge Kutta Method. 1

    11/20

    Engineering Example:A ball at 1200K is allowed to cool down in air at an

    ambient temperature of 300K. Assuming heat is lost

    only due to radiation, the differential equation for thetemperature of the ball is given by

    Find the temperature at t= 480 seconds seconds using Runge

    Kutta 4th order method. Assume a step size of h= 240 seconds.

    Kdt

    d12000,1081102067.2

    8412

  • 8/2/2019 Runge Kutta Method. 1

    12/20

    Step 1:

    8412 1081102067.2 dt

    d

    84121081102067.2, tf

    hkkkkii 43211 226

    1

    1200)0(,0,000

    ti

    5579.410811200102067.21200,0, 841201

    ftfk o

    38347.0108105.653102067.205.653,120

    2405579.42

    11200,240

    2

    10

    2

    1,

    2

    1

    8412

    1002

    f

    fhkhtfk

  • 8/2/2019 Runge Kutta Method. 1

    13/20

    Continued..

    8954.310810.1154102067.20.1154,120

    24038347.02

    11200,240

    2

    10

    2

    1,

    2

    1

    8412

    2003

    f

    fhkhtfk

    0069750.0108110.265102067.210.265,240240984.31200,2400,

    8412

    3004

    f

    fhkhtfk

    K

    hkkkk

    65.675

    2401848.26

    11200

    240069750.08954.3238347.025579.46

    11200

    2261 432101

  • 8/2/2019 Runge Kutta Method. 1

    14/20

    1 is the approximatetemperature at t1= t0+ h= 0+ 240=240

    ( 240) = 1 = 675.65K

    Step 2:Kti 65.675,240,1

    11

    44199.0108165.675102067.265.675,240, 8412111

    ftfk

    31372.0108161.622102067.261.622,360

    24044199.0

    2

    165.675,240

    2

    1240

    2

    1,

    2

    1

    8412

    1112

    f

    fhkhtfk

    34775.0108100.638102067.200.638,360

    24031372.02

    165.675,240

    2

    1240

    2

    1,

    2

    1

    8412

    2113

    f

    fhkhtfk

  • 8/2/2019 Runge Kutta Method. 1

    15/20

    2 is the approximate temperature at t2= t1 +h =240+240=480

    (480) = 2 = 594.91K

    25351.0108119.592102067.219.592,48024034775.065.675,240240,

    8412

    3114

    f

    fhkhtfk

    K

    hkkkk

    91.594

    2400184.26

    165.675

    24025351.034775.0231372.0244199.06

    165.675

    2261

    432112

  • 8/2/2019 Runge Kutta Method. 1

    16/20

    Comparison with other methods

    0

    200

    400

    600

    800

    1000

    1200

    1400

    0 100 200 300 400 500

    Time, t(sec)

    Temperature,

    (K)

    Exact

    4th order

    Heun

    Euler

  • 8/2/2019 Runge Kutta Method. 1

    17/20

    Conclusion The solutions obtained from range kutta method is

    almost accurate when compared with that of othermethods.

    The graph in the previous slide also depicts that rangeKutta methods solution is almost near exact solution.

  • 8/2/2019 Runge Kutta Method. 1

    18/20

    Bibliography Engineering mathematics by Dr K.S.C

    Wikipedia

    http://numericalmethods.eng.usf.edu/topics/runge_kutta_4th_method.html

  • 8/2/2019 Runge Kutta Method. 1

    19/20

    Queries ???

  • 8/2/2019 Runge Kutta Method. 1

    20/20

    Thank you