Solutions of Initial Value Problems(IVPs) (Numerical Method)

Euler Method

Formula: xi+1=xi+hf(ti,xi)
[xi+1yi+1]=[xiyi]+hf(ti,[xiyi])


1) Solve x=xt2+1, 0t2, x(0)=0.5 with h=0.2 using Euler method numerically. Find x2

Solution:xi+1=xi+hf(ti,xi)


Note that: ti=a+iht0=0,t1=0+0.2=0.2,t2=0+2(0.2)=0.4,...


let i=0,

x1=x0+(0.2)f(t0,x0)=0.5+0.2(x0(t0)2+1)=0.5+0.2(0.50+1)=0.8
let i=1,
x2=x1+(0.2)f(t1,x1)=0.8+0.2(0.8(0.2)2+1)=1.152



2) {x=x(1y),x(0)=2y=y(1x),y(0)=1,h=0.1
Use Euler method to find [x2y2]

Solution:


[xi+1yi+1]=[xiyi]+hf(ti,[xiyi])


When i=0,

[x1y1]=[x0y0]+(0.1)f(t0,[x0y0])=[21]+0.1[2(11)1(12)]=[21.1]

When i=1,

[x2y2]=[x1y1]+(0.1)f(t1,[x1y1])=[21.1]+0.1[2(11.1)1.1(12)]=[1.981.21]



Taylor Method

Formula:

xi+1=xi+hf(ti,xi)+h22!f(ti,xi)+h33!f(ti,xi)+...

1) Apply Taylor method of order 4 on x=tx13 to find the approximation with x(1)=1. Find x1

Solution:

x(t)=f(x)=tx13

x(t)=f(x)=ddt(x(t))=ddt(tx13)=x13+13t2x13

x(t)=f(x)=ddt(x(t))=ddt(x13+13t2x13)=13tx13+23t2x1319t3x1

x(4)(t)=f(4)(x)=ddt(x(t))=ddt(13tx13+23t2x1319t3x1)=(13x1319t2x1)+(43tx1329t3x1)(19t2x1+19t4x53)

let i=0,

x1=x0+hf(t0,x0)+h22!f(t0,x0)+h33!f(t0,x0)+h44!f(4)(t0,x0)=1+0.1(1)+(0.1)22!(1+13)+(0.1)33!(13+2319)+(0.1)44!(1319+43291919)=1.106819444


Runge-Kutta Method

Consider the initial value problem x=5x+5t2+2t,0t1,x(0)=1. Calculate x1

  • Midpoint method (Runge-Kutta's method of order 2)
Formula:

k1=f(ti,xi)xi+1=xi+hf(ti+h2,xi+h2ki)


Solution:

let i=0,

k1=f(t0,x0)=5(1)+5(0)2+2(0)=5x1=1+0.1f(0+0.12,1+0.12(5))=1+0.1f(0.05,0.75)=1+0.1(5(0.75)+5(0.05)2+2(0.05))=0.6325



  • Heun's third order method (Runge-Kutta's method of order 3)
Formula:

k1=f(ti,xi)k2=f(ti+h3,xi+h3k1)k3=f(ti+2h3,xi+2h3k2)xi+1=xi+h4(k1+3k3)


Solution:

let i=0,

k1=f(t0,x0)=5(1)+5(0)2+2(0)=5k2=f(0+0.13,1+0.13(5))=f(130,56)=5(56)+5(130)2+2(130)=737180k3=f(0+2(0.1)3,1+2(0.1)3(737180))=f(115,19632700)=5(19632700)+5(115)2+2(115)=1879540x1=x0+0.14(k1+3k3)=1+140(5+3(1879540))=0.614028



  • Runge-Kutta's method of order 4


Formula:

k1=f(ti,xi)k2=f(ti+h2,xi+h2k1)k3=f(ti+h2,xi+h2k2)k4=f(ti+1,xi+hk3)xi+1=xi+h6(k1+2k2+3k3+k4)

Solution:

let i=0,

k1=f(t0,x0)=5k2=f(0+0.12,1+0.12(5))=f(120,34)=5(34)+5(120)2+2(120)=29180k3=f(0+0.12,1+0.12(29180))=f(120,13091600)=5(12091600)+5(120)2+2(120)=1273320k4=f(0+0.1,1+0.1(1273320))=f(0.1,19273200)=5(19273200)+5(0.1)2+2(0.1)=1767640x1=1+0.16(5+2(29180)+2(1273320)+(1767640))=0.616796875

Comments

Popular Posts