Q 3.7-7E

Question

Use the fourth-order Runge–Kutta subroutine with = 0.25 to approximate the solution to the initial value problem y'=2y-6,y(0)=1, at = 1. (Thus, input = 4.) Compare this approximation to the actual solution y=3-2e2x evaluated at = 1.

 

Step-by-Step Solution

Verified
Answer

ϕ(1)=-11.7679

1Step 1: Find the values of k i i = 1, 2, 3, 4

Since f(x,y)=2y-6and x = 0, y = 1 and h = 0.25

 

k1=hf(x,y)=0.25(2(1)-6)=-1k2=hfx+h2,y+k12=-1.25k3=hfx+h2,y+k22=-1.3125k4=hfx+h,y+k3=-1.65625



2Step 2: Find the values of x and y

x=0+0.25=0.25y=1+16k1+2k2+2k3+k4=1+16(-1-2(1.25)-2(1.3125)-1.65625)=-0.29688

3Step 3: Use values of x and y for finding values of k i i = 1, 2, 3, 4

k1=hf(x,y)=0.25(2(-0.29688)-6)=-1.62844k2=hfx+h2,y+k12=-2.06055k3=hfx+h2,y+k22=-2.16358k4=hfx+h,y+k3=-2.73022


Now 

x=0.25+0.25=0.5y=1+16k1+2k2+2k3+k4=1+16(-1.64844-2(2.06055-2(2.16358-2.73022)=-2.43470




4Step 4: Repeat the procedure for two times

k1=hf(x,y)=0.25(2(-2.43470)-6)=-2.71735k2=hfx+h2,y+k12=-3.39670k3=hfx+h2,y+k22=-3.56652k4=hfx+h,y+k3=-4.50060x=0.5+0.25=0.75y=1+16k1+2k2+2k3+k4=1+16(-2.71735-2(3.39670)-2(3.56652)-4.50060)=-5.95876


And


k1=hf(x,y)=0.25(2(-5.95876)-6)=-4.47938k2=hfx+h2,y+k12=-5.59922k3=hfx+h2,y+k22=-5.87918k4=hfx+h,y+k3=-7.41895x=0.75+0.25=1y=1+16k1+2k2+2k3+k4=-5.95876+16(-4.47938-2(5.59922)-2(5.87918)-7.41895)=-11.7679

Since at x = 1

ϕ(x)=3-2e2xϕ(1)=-11.7781

 

Then y(1)-ϕ1=0.0120

Hence the solution is ϕ(1)=-11.7679