← 2022 Paper 2

UPSC 2022 Maths Optional Paper 2 Q8b — Step-by-Step Solution

15 marks · Section B

Runge-Kutta methods (RK2/RK4) · Numerical Analysis · asked 4× in 13 yrs · Read the full method →

Question

Using RK4, solve dy/dx=x+y2dy/dx=x+y^2 with y(0)=1y(0)=1, at x=0.2x=0.2. Use 4 decimal places, step length 0.10.1.

Technique

Standard RK4 with h=0.1h=0.1, two steps.

Solution

Setup. f(x,y)=x+y2f(x,y)=x+y^2. x0=0,y0=1x_0=0,y_0=1. h=0.1h=0.1. Two RK4 steps.

Step 1 — RK4 step 1: x=0x=0.1x=0\to x=0.1

k1=hf(x0,y0)=0.1(0+12)=0.1k_1=h f(x_0,y_0)=0.1\cdot(0+1^2)=0.1.

k2=hf(x0+h/2,y0+k1/2)=0.1f(0.05,1.05)=0.1(0.05+1.052)=0.1(0.05+1.1025)=0.11.1525=0.11525k_2=h f(x_0+h/2,y_0+k_1/2)=0.1\cdot f(0.05,1.05)=0.1(0.05+1.05^2)=0.1(0.05+1.1025)=0.1\cdot 1.1525=0.11525.

k3=hf(x0+h/2,y0+k2/2)=0.1f(0.05,1.057625)=0.1(0.05+1.0576252)k_3=h f(x_0+h/2,y_0+k_2/2)=0.1\cdot f(0.05,1.057625)=0.1(0.05+1.057625^2).

1.0576252=1.1185711.057625^2=1.118571. So k3=0.1(0.05+1.118571)=0.11.168571=0.116857k_3=0.1(0.05+1.118571)=0.1\cdot 1.168571=0.116857.

k4=hf(x0+h,y0+k3)=0.1f(0.1,1.116857)=0.1(0.1+1.1168572)k_4=h f(x_0+h,y_0+k_3)=0.1\cdot f(0.1,1.116857)=0.1(0.1+1.116857^2).

1.1168572=1.2473701.116857^2=1.247370. So k4=0.1(0.1+1.247370)=0.11.347370=0.134737k_4=0.1(0.1+1.247370)=0.1\cdot 1.347370=0.134737.

y1=y0+16(k1+2k2+2k3+k4)=1+16(0.1+0.23050+0.23371+0.13474)y_1=y_0+\dfrac{1}{6}(k_1+2k_2+2k_3+k_4)=1+\dfrac{1}{6}(0.1+0.23050+0.23371+0.13474) =1+16(0.69895)=1+0.11649=1.11649=1+\dfrac{1}{6}(0.69895)=1+0.11649=1.11649.

Round to 4 decimals: y1=1.1165y_1=1.1165.

Step 2 — RK4 step 2: x=0.1x=0.2x=0.1\to x=0.2

k1=0.1f(0.1,1.1165)=0.1(0.1+1.11652)k_1=0.1\cdot f(0.1,1.1165)=0.1(0.1+1.1165^2).

1.11652=1.246571.1165^2=1.24657. k1=0.1(0.1+1.24657)=0.11.34657=0.13466k_1=0.1(0.1+1.24657)=0.1\cdot 1.34657=0.13466.

k2=0.1f(0.15,1.1165+0.13466/2)=0.1f(0.15,1.1839)k_2=0.1\cdot f(0.15,1.1165+0.13466/2)=0.1\cdot f(0.15,1.1839).

1.18392=1.40161.1839^2=1.4016. k2=0.1(0.15+1.4016)=0.11.5516=0.15516k_2=0.1(0.15+1.4016)=0.1\cdot 1.5516=0.15516.

k3=0.1f(0.15,1.1165+0.15516/2)=0.1f(0.15,1.1941)k_3=0.1\cdot f(0.15,1.1165+0.15516/2)=0.1\cdot f(0.15,1.1941).

1.19412=1.42591.1941^2=1.4259. k3=0.1(0.15+1.4259)=0.11.5759=0.15759k_3=0.1(0.15+1.4259)=0.1\cdot 1.5759=0.15759.

k4=0.1f(0.2,1.1165+0.15759)=0.1f(0.2,1.2741)k_4=0.1\cdot f(0.2,1.1165+0.15759)=0.1\cdot f(0.2,1.2741).

1.27412=1.62331.2741^2=1.6233. k4=0.1(0.2+1.6233)=0.11.8233=0.18233k_4=0.1(0.2+1.6233)=0.1\cdot 1.8233=0.18233.

y2=1.1165+16(0.13466+0.31032+0.31518+0.18233)y_2=1.1165+\dfrac{1}{6}(0.13466+0.31032+0.31518+0.18233) =1.1165+16(0.94249)=1.1165+\dfrac{1}{6}(0.94249) =1.1165+0.15708=1.1165+0.15708 =1.2736=1.2736.

Answer

  y(0.2)1.2736.  \boxed{\;y(0.2)\approx 1.2736.\;}
We post more of this — worked solutions, CSAT trap breakdowns, guide chapters — a few times a week on Telegram. Free, no sign-in. Join

This solution is part of the Maths Coverage Map — 13 years, mapped. Get the take-away PDF free.