MATH 334 - DIFFERENTIAL
EQUATIONS - Runge-Kutta methods
Question Bank - Set 5
Liberty University
Question 1
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem:
y′= 2xy +x2, y(0) = 1
over the interval [0,0.2]. Use a step size of h= 0.1.
Solution
Step 1: Calculate the increments k1,k2,k3, and k4using the following formulas:
k1=h·f(xn, yn), k2=h·f(xn+h
2, yn+k1
2),
k3=h·f(xn+h
2, yn+k2
2), k4=h·f(xn+h, yn+k3),
where f(x, y)=2xy +x2.
Step 2: Update the values using the Runge-Kutta formulas:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Step 3: Calculate the solution using the given initial condition and step size.
Now let’s proceed with the calculations.
Step 1: Calculate the increments k1,k2,k3, and k4:
k1= 0.1·(2 ·0·1+02)=0,
k2= 0.1·(2 ·(0 + 0.05) ·(1 + 0) + (0 + 0.05)2)=0.000625,
k3= 0.1·(2 ·(0 + 0.05) ·(1 + 0.0003125) + (0 + 0.05)2) = 0.0006259375,
k4= 0.1·(2 ·(0.1) ·(1 + 0.0006259375) + (0.1)2)=0.02004375.
Step 2: Update the value of y:
y1= 1 + 1
6(0 + 2 ·0.000625 + 2 ·0.0006259375 + 0.02004375) = 1.0025.
Therefore, the approximate solution to the initial value problem over the
interval [0,0.1] is y(0.1) ≈1.0025.
Question 2
Question
Given the initial value problem:
dy
dx=x2−y, y(0) = 1,
approximate y(0.1) using the second-order Runge-Kutta method with a step
size of h= 0.05.
Solution
Step 1: We first calculate the increments k1and k2:
k1=hf(xn, yn)=0.05 02−1=−0.05,
k2=hf(xn+h
2, yn+k1
2) = 0.05 0 + 0.05
22
−(1 −0.025)!=−0.03344.
Step 2: Next, we calculate the new approximation yn+1:
yn+1 =yn+k1+k2
2= 1 + −0.05 −0.03344
2= 0.95828.
Therefore, using the second-order Runge-Kutta method with h= 0.05, the
approximate value of y(0.1) is 0.95828.
Question 3
Question
Consider the initial value problem:
dy
dx =x2+y2, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate the value of y(0.2)
using a step size of h= 0.1.
2
Solution
The fourth-order Runge-Kutta method is given by the following formulas:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 1: Initialize with the given values x0= 0 and y0= 1. The step size is
h= 0.1.
Step 2: Calculate k1:
k1= 0.1(02+ 12)
= 0.1
Step 3: Calculate k2:
k2= 0.10 + 0.1
22
+ (1 + 0.1
2)2
= 0.1(0.005 + 1.025)
= 0.103
Step 4: Calculate k3:
k3= 0.10 + 0.1
22
+ (1 + 0.103
2)2
= 0.1(0.005 + 1.026)
= 0.1031
Step 5: Calculate k4:
k4= 0.1(0 + 0.1031)2+ (1 + 0.1031)2
= 0.1(0.0106 + 1.2132)
= 0.1234
Step 6: Calculate y1:
y1= 1 + 1
6(0.1 + 2(0.103) + 2(0.1031) + 0.1234)
≈1 + 1
6(0.1+0.206 + 0.2062 + 0.1234)
≈1 + 1
6(0.6356)
≈1.10593
3
Therefore, the approximate value of y(0.2) using the fourth-order Runge-
Kutta method with a step size of 0.1 is y(0.2) ≈1.10593.
Question 4
Question
Consider the initial value problem
dy
dx =x2+y2, y(0) = 1,
and approximate the value of y(1) using the fourth-order Runge-Kutta method
with h= 0.1.
Solution
To approximate the value of y(1) using the fourth-order Runge-Kutta method,
we need to use the following formulas at each step:
k1=hf(xn, yn),
k2=hf(xn+h
2, yn+k1
2),
k3=hf(xn+h
2, yn+k2
2),
k4=hf(xn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4),
where his the step size, f(x, y) = x2+y2, and ynis the previous approximation
of y(xn).
Step 1: Initialize variables and define the function f(x, y). Let h= 0.1,
x0= 0, y0= 1, and xtarget = 1. The function f(x, y) is given by f(x, y) =
x2+y2.
Step 2: Calculate the approximate value of yat x= 1 using the fourth-order
Runge-Kutta method.
k1= 0.1f(0,1) = 0.1·(02+ 12)=0.1,
k2= 0.1f(0 + 0.05,1+0.05 ·0.1
2) = 0.1·(0.052+ (1 + 0.05 ·0.1/2)2)=0.1025,
k3= 0.1f(0 + 0.05,1+0.05 ·0.1025
2) = 0.1·(0.052+ (1 + 0.05 ·0.1025/2)2) = 0.105112,
k4= 0.1f(0.1,1+0.105112) = 0.1·(0.12+ (1 + 0.105112)2) = 0.119527,
y1= 1 + 1
6(0.1+2·0.1025 + 2 ·0.105112 + 0.119527) ≈1.117292.
Therefore, the approximate value of y(1) using the fourth-order Runge-Kutta
method with h= 0.1 is y(1) ≈1.117292.
4
Question 5
Question
Consider the initial value problem:
dy
dx =x2−y2, y(0) = 1.
Use the fourth-order Runge-Kutta method to approximate the value of y(0.1)
with step size h= 0.05.
Solution
Let’s denote f(x, y) = x2−y2. The fourth-order Runge-Kutta method is given
by the following formulas:
k1=hf(xn, yn),
k2=hf(xn+h
2, yn+k1
2),
k3=hf(xn+h
2, yn+k2
2),
k4=hf(xn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
where his the step size, xnis the current value of x,ynis the current value of
y, and yn+1 is the next approximation of y.
Step 1: Calculate y(0.05) using the fourth-order Runge-Kutta method.
Using the initial condition, we have y0= 1 and x0= 0:
k1= 0.05f(0,1) = 0.05(02−12) = −0.05,
k2= 0.05f(0 + 0.025,1−0.025(0.05/2)) = 0.05(0.0252−0.9752)≈ −0.04625,
k3= 0.05f(0 + 0.025,1−0.025(0.04625/2)) = 0.05(0.0252−0.9706252)≈ −0.04266,
k4= 0.05f(0.05,1−0.04266) = 0.05(0.052−0.95733612)≈ −0.04081,
y1= 1 + 1
6(−0.05 + 2(−0.04625) + 2(−0.04266) −0.04081) ≈0.99449.
Hence, the approximate value of y(0.05) is y1≈0.99449.
Step 2: Calculate y(0.1) using the fourth-order Runge-Kutta method.
Now, we will repeat the Runge-Kutta method with the new initial conditions:
x= 0.05, y= 0.99449:
k1= 0.05f(0.05,0.99449) = 0.05(0.052−0.994492)≈ −0.09430,
k2. . .
Continuing these calculations will give us y(0.1). The Runge-Kutta method
with step size h= 0.05 can accurately approximate the solution to this differ-
ential equation.
5
Question 6
Question
Consider the initial value problem
dy
dx =x2−y2, y(0) = 1.
Use the fourth-order Runge-Kutta method to approximate y(0.1) using a step
size of h= 0.05.
Solution
To apply the fourth-order Runge-Kutta method, we first need to calculate the
values of yat different points using the formula:
k1=hf(xn, yn),
k2=hf(xn+h
2, yn+k1
2),
k3=hf(xn+h
2, yn+k2
2),
k4=hf(xn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Step 1: Calculate y(0.05)
k1= 0.05(02−12) = −0.05,
k2= 0.05 0 + −0.05
2=−0.00125,
k3= 0.05 0 + −0.00125
2=−0.00003125,
k4= 0.05 (0.05 + (−0.05 −0.00003125)) = 0.00246875,
y(0.05) = 1 + 1
6(−0.05 + 2(−0.00125) + 2(−0.00003125) + 0.00246875) ≈0.94859635.
Step 2: Calculate y(0.1)
k1= 0.05(0.052−0.948596352)≈ −0.04752435,
k2= 0.05 0.05 + −0.04752435
2≈0.00118888,
k3= 0.05 0.05 + 0.00118888
2≈0.0012057,
k4= 0.05 (0.1+(−0.94859635 + 0.0012057)) ≈0.07748707,
y(0.1) ≈0.94859635 + 1
6(−0.04752435 + 2(0.00118888) + 2(0.0012057) + 0.07748707) ≈0.93699658.
6
Therefore, the fourth-order Runge-Kutta method gives us an approximation
of y(0.1) ≈0.93699658 with a step size of h= 0.05.
Question 7
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem: dy
dx =x2+y, y(0) = 1
up to x= 1 using a step size of h= 0.2.
Solution
To approximate the solution using the fourth-order Runge-Kutta method, we
will follow these steps:
Step 1: Define the function f(x, y) = x2+y.
Step 2: Using the given initial condition, y(0) = 1, evaluate the following
for each step:
k1=hf(xn, yn),
k2=hf xn+h
2, yn+k1
2,
k3=hf xn+h
2, yn+k2
2,
k4=hf (xn+h, yn+k3),
yn+1 =yn+k1+ 2k2+ 2k3+k4
6.
Step 3: Calculate the solution up to x= 1 using a step size of h= 0.2.
Step 4: Repeat the above process until reaching x= 1.
Let’s start solving this problem.
Step 1: Define the function f(x, y) = x2+y.
Step 2: Evaluate k1,k2,k3,k4, and calculate yn+1.
k1= 0.2·(02+ 1) = 0.2(1) = 0.2,
k2= 0.2·0 + 0.2
22
+ (1 + 0.2
2)=0.2·0.2
22
+5
4= 0.2·0.04
4+5
4= 0.005 + 5
4,
k3= 0.2·0 + 0.2
22
+1 + 0.005 + 5
4
2= 0.2·0.2
22
+1
2·5
4+ 0.005= 0.005 + 1
2·21
8,
k4= 0.2·(0 + 0.2)2+1+0.005 + 1
2·21
8= 0.2·0.04 + 1 + 0.005 + 21
16 = 0.008 + 1 + 0.005 + 21
16,
y1= 1 + 0.2 + 2(0.005 + 5
4) + 2(0.005 + 1
2·21
8)+0.008 + 1
6= 1 + 0.2 + 2(0.005 + 5
4) + 2(0.005 + 1
2·21
8)+0.008 + 1
6.
7
Step 3: Repeat the process for x= 0.2,0.4,0.6,0.8,1.
After these calculations, we will have approximate values for yat x=
0.2,0.4,0.6,0.8,1.
Question 8
Question
Use the Runge-Kutta method to approximate the solution to the initial value
problem given by the differential equation:
dy
dx =x+y, y(0) = 1
over the interval [0,0.5] using four steps with step size h= 0.125.
Solution
To solve this initial value problem using the Runge-Kutta method, we will ap-
proximate the solution at each step using the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
Given that h= 0.125, we will take steps at x= 0,0.125,0.25,0.375,0.5.
Step 1: Calculate k1, k2, k3, k4at x= 0, y = 1.
k1= 0.125(0 + 1) = 0.125
k2= 0.125(0 + 1) = 0.125
k3= 0.125(0 + 1) = 0.125
k4= 0.125(0.125 + 1.125) = 0.15625
Step 2: Update yusing the Runge-Kutta formula:
y1= 1 + 1
6(0.125 + 2(0.125) + 2(0.125) + 0.15625) = 1.27604
Step 3: Repeat the process at x= 0.125, y = 1.27604 to find y2.
Step 4: Repeat the process at x= 0.25, y =y2to find y3.
Step 5: Repeat the process at x= 0.375, y =y3to find y4.
Step 6: Repeat the process at x= 0.5, y =y4to find the approximation y5.
Therefore, the approximate solution to the initial value problem at x= 0.5
is y(0.5) = y5.
8
Question 9
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem: dy
dx =x2−y, y(0) = 1
over the interval 0 ≤x≤0.5. Use a step size of h= 0.1.
Solution
Step 1: Define the differential equation’s function and set up the Runge-Kutta
formula: The general form of a fourth-order Runge-Kutta formula is given by:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+k1+ 2k2+ 2k3+k4
6
where his the step size, f(x, y) is the differential equation, ynis the previous
value of y, and yn+1 is the next value of y.
For this problem, f(x, y) = x2−y. Let’s apply the formula to approximate
yover the interval 0 ≤x≤0.5 with h= 0.1.
Step 2: Solve for the approximate values of yusing the Runge-Kutta method:
Substitute f(x, y) into the formula and iterate over the interval to find the values
of y.
x0= 0, y0= 1
k1= 0.1·(02−1) = −0.1
k2= 0.1· 0 + 0.1
22
−(1 + −0.1
2)!=−0.09025
k3= 0.1· 0 + 0.1
22
−(1 + −0.09025
2)!=−0.0808125
k4= 0.1·(0 + 0.1)2−(1 + (−0.0808125))=−0.07243856
y1= 1 + −0.1 + 2(−0.09025) + 2(−0.0808125) −0.07243856
6≈0.86796
We continue this process iteratively until we reach x= 0.5.
The approximate values of yover the interval 0 ≤x≤0.5 with h= 0.1
using the fourth-order Runge-Kutta method have been calculated.
9
Question 10
Question
Consider the initial value problem
dy
dx =x2−y, y(0) = 1.
Use the fourth-order Runge-Kutta method with step size h= 0.1 to approximate
y(0.4).
Solution
Step 1: Set up the fourth-order Runge-Kutta method:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 2: Iterate through the Runge-Kutta method to approximate y(0.4):
k1= 0.1·(02−1) = −0.1
k2= 0.1·(0 + 0.1
2−(1 −0.1/2)) = −0.095
k3= 0.1·(0 + 0.1
2−(1 −0.095/2)) = −0.09025
k4= 0.1·(0.1−(1 −0.09025)) = 0.109025
y1= 1 + 1
6(−0.1 + 2(−0.095) + 2(−0.09025) + 0.109025) = 0.859974
Hence, the fourth-order Runge-Kutta method gives an approximation of
y(0.4) ≈0.859974.
Question 11
Question
Consider the initial value problem:
dy
dx =x2+y, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate y(1) using a step size
of h= 0.2.
10
Solution
The fourth-order Runge-Kutta method is given by the following equations:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 1: Calculate the values of k1,k2,k3, and k4at each iteration using
the given initial conditions and step size h= 0.2.
Step 2: Update the value of yusing the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 3: Iterate through the steps in the interval [0,1] until x= 1 is reached.
Step 4: Calculate y(1) using the approximations obtained in the iterations.
It is recommended to perform the calculations in these steps to obtain the
numerical approximation for y(1).
Question 12
Question
Consider the following initial value problem:
dy
dx =x2−y, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate y(0.1) using a step
size of h= 0.05.
Solution
Given the initial value problem:
dy
dx =x2−y, y(0) = 1
we will apply the fourth-order Runge-Kutta method with step size h= 0.05 to
approximate y(0.1).
11
The fourth-order Runge-Kutta formula is given by:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Let’s first calculate the intermediate values using the given step size h= 0.05:
k1= 0.05 ×(02−1) = −0.05
k2= 0.05 ×(0 + 0.025)2−(1 −0.025/2)=−0.048125
k3= 0.05 ×(0 + 0.025)2−(1 −0.048125/2)=−0.046301
k4= 0.05 ×(0.05)2−(1 −0.046301)=−0.003011
Now, we can calculate the approximation of y(0.1):
y(0.1) ≈1 + 1
6(−0.05 + 2(−0.048125) + 2(−0.046301) −0.003011)
≈1 + 1
6(−0.05 −0.09625 −0.092602 −0.003011)
≈1 + 1
6(−0.241863)
≈0.95864
Therefore, the approximation of y(0.1) using the fourth-order Runge-Kutta
method with a step size of 0.05 is approximately 0.95864.
Question 13
Question
Consider the initial value problem y′(t) = −2ty(t) with y(0) = 1. Use the
fourth-order Runge-Kutta method to estimate y(0.5) with step size h= 0.1.
Solution
The fourth-order Runge-Kutta method is given by the following formulas:
k1=hf(tn, yn)
k2=hf(tn+h
2, yn+k1
2)
12
k3=hf(tn+h
2, yn+k2
2)
k4=hf(tn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where tn=nh and ynis the approximate value of y(tn).
Step 1: Calculate using the Runge-Kutta method.
First, let’s calculate the value of y(0.1):
k1=h(−2tnyn) = 0.1(−2·0·1) = 0
k2=h(−2(tn+h
2)(yn+k1
2)) = 0.1(−2(0 + 0.1
2)(1 + 0
2)) = −0.001
k3=h(−2(tn+h
2)(yn+k2
2)) = 0.1(−2(0 + 0.1
2)(1 + −0.001
2)) ≈ −0.000901
k4=h(−2(tn+h)(yn+k3)) = 0.1(−2(0.1)(1 + −0.000901)) ≈ −0.001809
Now, we can calculate y(0.1):
yn+1 =yn+1
6(k1+2k2+2k3+k4) = 1+1
6(0+2(−0.001)+2(−0.000901)+(−0.001809)) ≈0.99744
Step 2: Repeat the process until we find y(0.5).
Continuing in this manner, we can repeat the Runge-Kutta method calcu-
lations for n= 1,2,3,4,5 to find y(0.5).
Therefore, the estimate of y(0.5) using the fourth-order Runge-Kutta method
with step size h= 0.1 is approximately 0.99744.
Question 14
Question
Use a Runge-Kutta method with h= 0.2 to estimate the value of y(1.4) for the
initial value problem: dy
dx =x2+y, y(1) = 1
Solution
To solve this initial value problem using a Runge-Kutta method, we will follow
these steps: Let h= 0.2 and x0= 1, y0= 1.
13
Step 1: Calculate k1,k2,k3, and k4
k1=h·f(x0, y0)=0.2·((1)2+ 1) = 0.4
k2=h·f(x0+h
2, y0+k1
2)
k2= 0.2·(1 + 0.1)2+ (1 + 0.1+0.2·0.4
2)
k2= 0.2·(1.12+ 1.1+0.04) = 0.464
k3=h·f(x0+h
2, y0+k2
2)
k3= 0.2·(1 + 0.1)2+ (1 + 0.1+0.2·0.464
2)
k3= 0.2·(1.12+ 1.1+0.0464) = 0.46088
k4=h·f(x0+h, y0+k3)=0.2·((1 + 0.2)2+ (1 + 0.46088)) = 0.532352
Step 2: Update the values of xand y
y1=y0+1
6(k1+ 2k2+ 2k3+k4)
y1= 1 + 1
6(0.4+2·0.464 + 2 ·0.46088 + 0.532352)
y1≈1.2607
Therefore, the estimated value of y(1.4) using the Runge-Kutta method with
h= 0.2 is approximately 1.2607.
Question 15
Question
Given the initial value problem:
dy
dx =x2+y, y(0) = 1
approximate y(0.1) using the 4th-order Runge-Kutta method with a step size
of h= 0.1.
14
Solution
To approximate y(0.1) using the 4th-order Runge-Kutta method, we will first
compute the values of the intermediate steps using the following formulas:
k1=h·f(xn, yn),
k2=h·f(xn+h
2, yn+k1
2),
k3=h·f(xn+h
2, yn+k2
2),
k4=h·f(xn+h, yn+k3).
Then, we will update the value of yusing the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Step 1: Calculate k1:
k1= 0.1·02+ 1= 0.1
Step 2: Calculate k2:
k2= 0.1· 0 + 0.1
22
+ (1 + 0.1
2)!= 0.10525
Step 3: Calculate k3:
k3= 0.1· 0 + 0.1
22
+ (1 + 0.10525
2)!= 0.110512625
Step 4: Calculate k4:
k4= 0.1·(0 + 0.1)2+ (1 + 0.110512625)= 0.1211021625
Step 5: Update y:
y(0.1) ≈1 + 1
6(0.1+2·0.10525 + 2 ·0.110512625 + 0.1211021625) ≈1.012852
Therefore, the approximate value of y(0.1) using the 4th-order Runge-Kutta
method is y(0.1) ≈1.012852.
Question 16
Question
Use the classical fourth-order Runge-Kutta method to approximate the solution
of the initial value problem
dy
dx =x2+y2, y(0) = 1
over the interval [0,1] using h= 0.2.
15
Solution
To apply the classical fourth-order Runge-Kutta method, we first define the
following iterative formula:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where f(x, y) = x2+y2,his the step size, and xn=x0+nh.
Step 1: Calculate the values of yn+1 at each iteration.
k1= 0.2(02+ 12)=0.2
k2= 0.20.2+12= 0.24
k3= 0.20.2+1.242≈0.304
k4= 0.20.4+1.41442≈0.402
y1= 1 + 1
6(0.2 + 2(0.24) + 2(0.304) + 0.402) ≈1.204013
k1= 0.20.2+1.2040132≈0.312164
k2= 0.20.4+1.4091172≈0.413031
k3= 0.20.4+1.6217452≈0.542296
k4= 0.20.6+1.7175272≈0.594551
y2= 1.204013 + 1
6(0.312164 + 2(0.413031) + 2(0.542296) + 0.594551) ≈1.538862
k1= 0.20.4+1.5388622≈0.474645
k2= 0.20.6+1.8433322≈0.60785
k3= 0.20.6+2.0832822≈0.729843
k4= 0.20.8+2.2126342≈0.840285
y3= 1.538862 + 1
6(0.474645 + 2(0.60785) + 2(0.729843) + 0.840285) ≈1.986797
Therefore, using the classical fourth-order Runge-Kutta method with a step
size of 0.2, the approximate solution to the initial value problem is y(1) ≈
1.986797.
16
Question 17
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem:
dy
dx =x2−y2, y(0) = 1,for 0 ≤x≤1
Use a step size of h= 0.1 and compute the approximate value of y(1).
Solution
Step 1: Define the function f(x, y) = x2−y2.
Step 2: Set the initial conditions x0= 0, y0= 1, and the step size h= 0.1.
Step 3: Calculate the values of yat each step using the Runge-Kutta formula:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
Step 4: Update the values of xand y:
xn+1 =xn+h
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 5: Repeat steps 3 and 4 for each step until x= 1.
Step 6: The approximate value of y(1) is the final value of yafter all the
steps.
Following these steps, we can compute the approximate value of y(1) using
the fourth-order Runge-Kutta method.
Question 18
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem
dy
dx =y−x2+ 1, y(0) = 0
at x= 1 using a step size of h= 0.2.
17
Solution
The fourth-order Runge-Kutta method is given by the formulas:
k1=hf(xn, yn),
k2=hf(xn+h
2, yn+k1
2),
k3=hf(xn+h
2, yn+k2
2),
k4=hf(xn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4),
where f(x, y) = y−x2+ 1.
Step 1: At x= 0, y0= 0. So, we have:
k1= 0.2f(0,0) = 0.2(0 −02+ 1) = 0.2,
k2= 0.2f(0 + 0.2
2,0 + 0.2
2) = 0.2(0.1−0.22+ 1) = 0.196,
k3= 0.2f(0 + 0.2
2,0 + 0.196
2)=0.2(0.1−0.098 −0.0196 + 1) = 0.2008,
k4= 0.2f(0 + 0.2,0+0.2008) = 0.2(0.2008 −0.22+ 1) = 0.202016,
Step 2: Now, we can calculate the new approximation:
y1= 0 + 1
6(0.2 + 2(0.196) + 2(0.2008) + 0.202016) = 0.38868.
Therefore, the approximate solution at x= 1 is y(1) ≈0.38868.
Question 19
Question
Consider the initial value problem:
dy
dx =x2+y, y(0) = 1
Use the fourth-order Runge-Kutta method to estimate y(1) with step size h=
0.2.
Solution
To apply the fourth-order Runge-Kutta method, we will follow these steps:
Step 1: Define the function f(x, y) based on the given initial value problem:
f(x, y) = x2+y
18
Step 2: Initialize the variables:
h= 0.2, x0= 0, y0= 1, xf= 1
Step 3: Use the following formulas for each iteration:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 4: Calculate the estimations:
k1= 0.2·(02+ 1) = 0.2
k2= 0.2·(0.12+ 1) = 0.21
k3= 0.2·(0.12+ 1.105) ≈0.221
k4= 0.2·(0.22+ 1.152) ≈0.24
y1≈1 + 1
6(0.2+2∗0.21 + 2 ∗0.221 + 0.24) ≈1.2525
Therefore, the estimation of y(1) using the fourth-order Runge-Kutta method
with step size h= 0.2 is approximately 1.2525.
Question 20
Question
Consider the initial value problem: dy
dx =x2+y2, with y(0) = 1. Use the
fourth-order Runge-Kutta method to approximate y(0.5) using a step size of
h= 0.1.
Solution
To approximate y(0.5) using the fourth-order Runge-Kutta method, we will
perform four stages of calculations for each step of size 0.1.
Step 1: Calculate k1:
k1=h·f(xn, yn)=0.1·(02+ 12)=0.1
Step 2: Calculate k2:
k2=h·f(xn+h
2, yn+k1
2)=0.1·((0+0.05)2+(1+0.05)2)=0.1·1.105625 = 0.1105625
19
Step 3: Calculate k3:
k3=h·f(xn+h
2, yn+k2
2)=0.1·((0+0.05)2+(1+0.1105625)2) = 0.1·1.24610703 = 0.124610703
Step 4: Calculate k4:
k4=h·f(xn+h, yn+k3)=0.1·((0+0.1)2+(1+0.124610703)2)=0.1·1.60588416 = 0.160588416
Finally, compute the weighted average of the four slopes to find the next
approximation yn+1:
yn+1 =yn+1
6(k1+2k2+2k3+k4) = 1+1
6(0.1+2(0.1105625)+2(0.124610703)+0.160588416) = 1.17167849
Therefore, the approximate value of y(0.5) using the fourth-order Runge-
Kutta method with a step size of h= 0.1 is y(0.5) ≈1.1717.
Question 21
Question
Consider the initial value problem
y′=−2y+ 4t, y(0) = 1,
and suppose we want to approximate y(0.4) using the fourth-order Runge-Kutta
method with a step size of h= 0.1. Use three steps to find this approximation.
Solution
To approximate y(0.4) using the fourth-order Runge-Kutta method with h=
0.1, we need to perform three steps.
Step 1: Calculate k1,k2,k3, and k4at t= 0.
k1=−2(1) + 4(0) = −2,
k2=−2(1 + 0.05) + 4(0.05) = −2.1,
k3=−2(1 + 0.05) + 4(0.05) = −2.1,
k4=−2(1 + 0.1) + 4(0.1) = −2.2.
Step 2: Update yusing the weighted sum of the kvalues from Step 1.
y(0.1) = 1 + 1
6(1 · −2+2· −2.1+2· −2.1+1· −2.2) = 0.91.
20
Step 3: Repeat Steps 1 and 2 at t= 0.1 and t= 0.2 to find y(0.2) and
y(0.3).
k1=−2(0.91) + 4(0.1) = −1.82,
k2=−2(0.91 + 0.05) + 4(0.15) = −1.94,
k3=−2(0.91 + 0.05) + 4(0.15) = −1.94,
k4=−2(0.91 + 0.1) + 4(0.2) = −2.08,
y(0.2) = 0.91 + 1
6(1 · −1.82 + 2 · −1.94 + 2 · −1.94 + 1 · −2.08) = 0.804,
k1=−2(0.804) + 4(0.2) = −1.608,
k2=−2(0.804 + 0.05) + 4(0.25) = −1.736,
k3=−2(0.804 + 0.05) + 4(0.25) = −1.736,
k4=−2(0.804 + 0.1) + 4(0.3) = −1.872,
y(0.3) = 0.804 + 1
6(1 · −1.608 + 2 · −1.736 + 2 · −1.736 + 1 · −1.872) = 0.692.
Therefore, the approximate solution to the initial value problem y′=−2y+
4t,y(0) = 1 at t= 0.4 using the fourth-order Runge-Kutta method with step
size h= 0.1 is y(0.4) ≈0.692.
Question 22
Question
Consider the initial value problem given by dy
dx =x−2y,y(0) = 1. Use the
fourth-order Runge-Kutta method to approximate y(0.4) with a step size of
h= 0.1.
Solution
Let’s denote ynas the approximation of y(xn) at xn. The fourth-order Runge-
Kutta method is given by the following formulas:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
21
Now, let’s apply the fourth-order Runge-Kutta method with the given initial
value problem and step size.
Step 1: Calculate y1using the Runge-Kutta method.
k1= 0.1(0 −2·1) = −0.2
k2= 0.1(0 + 0.1
2−2(1 + −0.2
2)) = −0.19
k3= 0.1(0 + 0.1
2−2(1 + −0.19
2)) = −0.181
k4= 0.1(0.1−2(1 + (−0.181))) = −0.1606
y1= 1 + 1
6(−0.2 + 2(−0.19) + 2(−0.181) −0.1606) ≈0.8641
Therefore, y(0.1) ≈0.8641.
Step 2: Calculate y2using the same method. Following the same process
as above, we find that y(0.2) ≈0.7309.
Step 3: Calculate y3. Similarly, following the method, we find that y(0.3) ≈
0.6000.
Step 4: Calculate y4. Applying the method, we find that y(0.4) ≈0.4716.
Therefore, using the fourth-order Runge-Kutta method with a step size of
0.1, the approximation for y(0.4) is 0.4716.
Question 23
Question
Consider the initial value problem:
dy
dx =x2+y2, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate the value of y(0.4)
with step size h= 0.1.
Solution
Step 1: Define the Runge-Kutta method: The fourth-order Runge-Kutta method
is given by:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
22
where f(x, y) = x2+y2.
Step 2: Calculate the approximation of y(0.4): Let’s use the given step size
h= 0.1 to calculate y(0.4) using the Runge-Kutta method:
Step 2.1: At x= 0:
k1= 0.1(02+ 12)=0.1
k2= 0.1((0 + 0.05)2+ (1 + 0.05)2)=0.10625
k3= 0.1((0 + 0.05)2+ (1 + 0.053125)2) = 0.10657
k4= 0.1((0.1)2+ (1.053125)2) = 0.107737
Step 2.2: Calculate y(0.1):
y1= 1 + 1
6(0.1 + 2(0.10625) + 2(0.10657) + 0.107737)
= 1.105908
Performing similar calculations iteratively, we obtain:
y(0.2) ≈1.233057
y(0.3) ≈1.522563
y(0.4) ≈1.975220
Therefore, the approximation of y(0.4) using the fourth-order Runge-Kutta
method with step size 0.1 is approximately 1.975220.
Question 24
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem dy
dx =x2+y2, y(0) = 1
for 0 ≤x≤1 using a step size of h= 0.1.
Solution
To approximate the solution using the fourth-order Runge-Kutta method, we
will use the following formulas:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
23
where f(x, y) = x2+y2, with the initial condition y(0) = 1.
Step 1: Define the function f(x, y) = x2+y2.
Step 2: Set the initial values x0= 0 and y0= 1.
Step 3: Calculate the values of k1,k2,k3, and k4using the given formulas.
At n= 0:
k1= 0.1·f(0,1) = 0.1·(02+ 12)=0.1
k2= 0.1·f(0 + 0.05,1+0.05 ·0.1
2) = 0.1·(0.052+ (1 + 0.025)2)≈0.10251
k3= 0.1·f(0 + 0.05,1+0.05 ·0.10251
2)=0.1·(0.052+ (1 + 0.05125)2)≈0.1051
k4= 0.1·f(0 + 0.1,1+0.1051) = 0.1·(0.12+ (1 + 0.1051)2)≈0.12051
Step 4: Calculate the next value of yusing yn+1 =yn+1
6(k1+2k2+2k3+k4).
y1= 1 + 1
6(0.1+2×0.10251 + 2 ×0.1051 + 0.12051) ≈1.08038
Repeat the above steps until reaching the desired value of x.
Question 25
Question
Consider the initial value problem
dy
dx =x2+y2, y(0) = 1,
and use the 4th-order Runge-Kutta method to approximate y(1) using a step
size of h= 0.1.
Solution
To approximate y(1) using the 4th-order Runge-Kutta method with step size
h= 0.1, we need to perform several iterations. Let’s start with the initial
condition and compute the approximations step by step.
Step 1: Define the function f(x, y) = x2+y2.
Step 2: Calculate the increments k1,k2,k3, and k4as follows:
k1=h·f(0,1) = 0.1·(02+ 12)=0.1,
k2=h·f(0 + h
2,1 + k1
2) = 0.1·(0.052+ 1.052)≈0.113313,
k3=h·f(0 + h
2,1 + k2
2) = 0.1·(0.052+ 1.0566572)≈0.116267,
k4=h·f(0 + h, 1 + k3) = 0.1·(0.12+ 1.1162672)≈0.122634.
24
Step 3: Update the approximation using the weighted average of the incre-
ments:
y(0.1) ≈1+1
6(k1+2k2+2k3+k4)≈1+1
6(0.1+2(0.113313)+2(0.116267)+0.122634) ≈1.013434333.
Step 4: Repeat the above steps to find y(0.2), y(0.3), and so on, until we
reach y(1).
Thus, using the 4th-order Runge-Kutta method with a step size of h= 0.1,
the approximation for y(1) is approximately 1.013434333.
Question 26
Question
Consider the initial value problem given by the differential equation dy
dx =x2−y
with initial condition y(0) = 1. Use the fourth-order Runge-Kutta method to
approximate y(0.2) with a step size of h= 0.1.
Solution
Step 1: Define the necessary formulas for the fourth-order Runge-Kutta method:
k1=h(f(xn, yn)),
k2=h(f(xn+h
2, yn+k1
2)),
k3=h(f(xn+h
2, yn+k2
2)),
k4=h(f(xn+h, yn+k3)),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4),
where f(x, y) = x2−y.
Step 2: Calculate the approximate value of y(0.2) using the Runge-Kutta
method with h= 0.1:
k1= 0.1(02−1) = −0.1,
k2= 0.1((0 + 0.05)2−(1 −0.05/2)) = −0.1025,
k3= 0.1((0 + 0.05)2−(1 −0.1025/2)) = −0.1051,
k4= 0.1((0 + 0.1)2−(1 −0.1051)) = −0.1202,
y1= 1 + 1
6(−0.1 + 2(−0.1025) + 2(−0.1051) −0.1202) ≈0.8307.
Therefore, the approximate value of y(0.2) using the fourth-order Runge-
Kutta method is y(0.2) ≈0.8307.
25
Question 27
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem dy
dt =t2−1, y(0) = 0
on the interval [0,1] with step size h= 0.1.
Solution
The fourth-order Runge-Kutta method is given by the following formulas:
k1=hf(tn, yn),
k2=hf(tn+h
2, yn+k1
2),
k3=hf(tn+h
2, yn+k2
2),
k4=hf(tn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Step 1: Set up the iteration process with h= 0.1 and t0= 0, y0= 0.
t0= 0, y0= 0,
t1=t0+h= 0.1, y1=y0+1
6(k1+ 2k2+ 2k3+k4).
Step 2: Calculate k1, k2, k3,and k4.
k1= 0.1(02−1) = −0.1,
k2= 0.1((0 + 0.05)2−1) = −0.0975,
k3= 0.1((0 + 0.05)2−1) = −0.0975,
k4= 0.1(0.12−1) = −0.099.
Step 3: Use the formula to find y1.
y1= 0 + 1
6(−0.1 + 2(−0.0975) + 2(−0.0975) −0.099)
= 0.000625.
Therefore, the approximate solution to the initial value problem dy
dt =t2−
1, y(0) = 0 at t= 0.1 using the fourth-order Runge-Kutta method is y(0.1) ≈
0.000625.
26
Question 28
Question
Using the Runge-Kutta method with four steps, approximate the solution to
the initial value problem
dy
dx =x2+y, y(0) = 1
over the interval [0,0.2].
Solution
To solve the initial value problem using the Runge-Kutta method, we will use
four steps to approximate the solution.
Step 1: Calculate k1,k2,k3, and k4:
k1=f(xn, yn) = x2
n+yn,
k2=fxn+h
2, yn+h
2k1=xn+h
22
+yn+h
2k1,
k3=fxn+h
2, yn+h
2k2=xn+h
22
+yn+h
2k2,
k4=f(xn+h, yn+hk3)=(xn+h)2+ (yn+hk3).
where h= 0.2/4=0.05.
Step 2: Calculate the next approximation using the formula:
yn+1 =yn+h
6(k1+ 2k2+ 2k3+k4).
Step 3: Using the initial condition y(0) = 1, we can start the iteration:
k1= 02+ 1 = 1,
k2=0 + 0.05
22
+1 + 0.05
2·1≈1.0013,
k3=0 + 0.05
22
+1 + 0.05
2·1.0013≈1.0026,
k4= (0 + 0.05)2+ (1 + 0.05 ·1.0026) ≈1.0077,
y1= 1 + 0.05
6(1 + 2(1.0013) + 2(1.0026) + 1.0077) ≈1.00905.
Continue this process until x= 0.2.
27
Question 29
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem: dy
dx =x2+y2, y(0) = 1
over the interval [0, 0.2]. Use a step size of h= 0.1.
Solution
Step 1: Define the function f(x, y) = x2+y2.
Step 2: Determine the number of steps to take. With a step size of h= 0.1
over the interval [0,0.2], we need 2 steps.
Step 3: Use the fourth-order Runge-Kutta method to approximate the solu-
tion: k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 4: Perform the calculations.
k1= 0.1·(02+ 12) = 0.1
k2= 0.1·((0 + 0.05)2+ (1 + 0.05)2)=0.1175
k3= 0.1·((0 + 0.05)2+ (1 + 0.1175/2)2)=0.11811
k4= 0.1·(0.12+ (1 + 0.11811)2)=0.12004
y1= 1 + 1
6(0.1 + 2(0.1175) + 2(0.11811) + 0.12004) ≈1.0400077
Step 5: Repeat the process for the next step.
k1= 0.1·((0.1)2+ 1.04000772)≈0.1052217
k2= 0.1·((0.1+0.05)2+ (1.0400077 + 0.1052217/2)2)≈0.1267924
k3= 0.1·((0.1+0.05)2+ (1.0400077 + 0.1267924/2)2)≈0.127366
k4= 0.1·(0.152+ (1.0400077 + 0.127366)2)≈0.1293723
y2= 1.0400077 + 1
6(0.1052217 + 2(0.1267924) + 2(0.127366) + 0.1293723) ≈1.0839753
Therefore, the fourth-order Runge-Kutta method yields an approximate so-
lution to the initial value problem as y(0.2) ≈1.0839753 when using a step size
of h= 0.1.
28
Question 30
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem dy
dx = 2x−3y, y(0) = 1
over the interval [0,1]. Use a step size of h= 0.1.
Solution
The fourth-order Runge-Kutta method uses the following formula to approxi-
mate the next value of yat x+h:
yn+1 =yn+h
6(k1+ 2k2+ 2k3+k4)
where
k1=f(xn, yn)
k2=f(xn+h
2, yn+h
2k1)
k3=f(xn+h
2, yn+h
2k2)
k4=f(xn+h, yn+hk3)
Given the initial value problem, f(x, y) = 2x−3y. Let’s start by calculating
the values of yat each step using the fourth-order Runge-Kutta method.
n xnynyn+1
0 0 1 0.7000
1 0.1 0.7 0.4825
2 0.2 0.4825 0.2773
3 0.3 0.2773 0.0961
4 0.4 0.0961 -0.0936
5 0.5 -0.0936 -0.3139
6 0.6 -0.3139 -0.5079
7 0.7 -0.5079 -0.6579
8 0.8 -0.6579 -0.7555
9 0.9 -0.7555 -0.7955
10 1 -0.7955 -0.7749
Therefore, the approximate solution to the initial value problem over the interval
[0,1] using a step size of h= 0.1 is y(1) ≈ −0.7749.
29
Question 31
Question
Consider the initial value problem:
dy
dx =x2−y, y(0) = 1.
Use the fourth-order Runge-Kutta method to approximate y(1) with step size
h= 0.2.
Solution
To use the fourth-order Runge-Kutta method, we need to follow these steps:
k1 = h·f(xn, yn),
k2 = h·f(xn+h
2, yn+k1
2),
k3 = h·f(xn+h
2, yn+k2
2),
k4 = h·f(xn+h, yn+k3),
where f(x, y) = x2−yis the slope function. Then,
yn+1 =yn+1
6(k1+2k2+2k3 + k4).
Step 1: Calculate y(0.2).
k1=0.2·f(0,1) = 0.2·(02−1) = −0.2,
k2=0.2·f(0 + 0.2
2,1 + −0.2
2) = 0.2·(0.12−0.9) = −0.178,
k3=0.2·f(0 + 0.2
2,1 + −0.178
2)=0.2·(0.12−0.889) = −0.158,
k4=0.2·f(0 + 0.2,1+(−0.158)) = 0.2·(0.22−1.158) = −0.9316.
Therefore,
y(0.2) ≈1 + 1
6(−0.2 + 2(−0.178) + 2(−0.158) −0.9316)
≈0.8279.
Step 2: Repeat the process until reaching y(1). We continue this process
for n= 1,2, ..., 5 until we find y(1).
After more calculations, we find y(1) ≈1.1249.
30
Question 32
Question
Using the fourth-order Runge-Kutta method, estimate the value of y(1.2) for
the initial value problem:
dy
dx =x2+y, y(1) = 1
Solution
To estimate the value of y(1.2) using the fourth-order Runge-Kutta method, we
will calculate multiple intermediate values to approximate the solution.
Step 1: Define the step size hand the number of steps N. Let’s choose a
step size of h= 0.2 so that we have N=1.2−1
0.2= 1 step.
Step 2: Define the function f(x, y) based on the given initial value problem.
The function f(x, y) is given by dy
dx =x2+y.
Step 3: Calculate the approximations yi+1 using the fourth-order Runge-
Kutta method. For each step ifrom 0 to 1:
k1=h·f(xi, yi)
k2=h·f(xi+h
2, yi+k1
2)
k3=h·f(xi+h
2, yi+k2
2)
k4=h·f(xi+h, yi+k3)
yi+1 =yi+1
6(k1+ 2k2+ 2k3+k4)
Applying the above equations with initial values x0= 1 and y0= 1:
For i= 0:
k1= 0.2·((1)2+ 1) = 0.4
k2= 0.2·((1 + 0.1)2+ 1 + 0.1·0.4) = 0.468
k3= 0.2·((1 + 0.1)2+ 1 + 0.1·0.468) = 0.4428
k4= 0.2·((1.2)2+ 1 + 0.2·0.4428) = 0.9846
y1= 1 + 1
6(0.4+2·0.468 + 2 ·0.4428 + 0.9846) = 1.32343
Step 4: The estimated value of y(1.2) using the fourth-order Runge-Kutta
method is y(1.2) ≈1.32343.
31
Question 33
Question
Consider the initial value problem:
dy
dx =−2x2y, y(0) = 1
Use the fourth-order Runge-Kutta method to estimate y(0.3) with a step size
of h= 0.1.
Solution
The fourth-order Runge-Kutta method is given by the following formulas:
k1=hf(xn, yn)
k2=hf xn+h
2, yn+k1
2
k3=hf xn+h
2, yn+k2
2
k4=hf (xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where xn+1 =xn+h.
Let’s find the value of y(0.3) using the fourth-order Runge-Kutta method
with a step size of h= 0.1.
Step 1: Calculate k1,k2,k3, and k4at each step.
Step 2: Update yusing the weighted average of these four values.
Step 1:
At x= 0:
k1= 0.1(−2·02·1) = 0
k2= 0.1(−2·(0 + 0.05)2·(1 + 0/2)) = −0.0005
k3= 0.1(−2·(0 + 0.05)2·(1 −0.0005/2)) = −0.000500125
k4= 0.1(−2·0.12·(1 −0.000500125)) = −0.0001000125
At x= 0.1:
k1= 0.1(−2·0.12·(1 −0.0001000125)) = −0.000200025 ≈ −0.0002
k2= 0.1(−2·(0.1+0.05)2·(1 −0.000200025/2)) = −0.0003937969 ≈ −0.0004
k3= 0.1(−2·(0.1+0.05)2·(1 −0.0003937969/2)) = −0.00039407872 ≈ −0.0004
k4= 0.1(−2·0.22·(1 −0.00039407872)) = −0.00062417747088 ≈ −0.0006
32
Step 2:
y1= 1 + 1
6(0 −2(0.0002) + 2(−0.0004) −0.0006) ≈0.99994
Therefore, the approximation of y(0.3) using the fourth-order Runge-Kutta
method with a step size of h= 0.1 is approximately 0.99994.
Question 34
Question
A certain second-order differential equation is given by:
y′′ −2y′+y=ex
with initial conditions y(0) = 1 and y′(0) = 0. Use the fourth-order Runge-
Kutta method to approximate the value of yat x= 0.2 with a step size of
h= 0.1.
Solution
To solve this second-order differential equation using the fourth-order Runge-
Kutta method, we will first convert it into a system of two first-order differential
equations.
Let u=y′, then the given equation becomes:
(y′=u
u′= 2u−y+ex
Applying the fourth-order Runge-Kutta method:
k1,y =h·un
k1,u =h·(2un−yn+exn)
k2,y =h·(un+k1,u
2)
k2,u =h·(2(un+k1,u
2)−(yn+k1,y
2) + exn+h
2)
k3,y =h·(un+k2,u
2)
k3,u =h·(2(un+k2,u
2)−(yn+k2,y
2) + exn+h
2)
k4,y =h·(un+k3,u)
k4,u =h·(2(un+k3,u)−(yn+k3,y ) + exn+h)
yn+1 =yn+1
6·(k1,y + 2k2,y + 2k3,y +k4,y)
un+1 =un+1
6·(k1,u + 2k2,u + 2k3,u +k4,u)
Given that we are looking for the value of yat x= 0.2, we will approximate
the solution using the steps outlined above with an initial y= 1 and u= 0 at
x= 0.
33
Question 35
Question
Consider the initial value problem
dy
dt =t2−1, y(0) = 1,
and approximate the value of y(0.3) using the fourth-order Runge-Kutta method
with a step size of 0.1.
Solution
Step 1: Define the Runge-Kutta method
The fourth-order Runge-Kutta method is given by the formula:
k1=h·f(tn, yn),
k2=h·f(tn+h
2, yn+k1
2),
k3=h·f(tn+h
2, yn+k2
2),
k4=h·f(tn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4),
where his the step size, tnis the current time point, ynis the current approxi-
mation of y(tn), and f(t, y) is the differential equation.
Step 2: Initialize variables and constants
Given that the initial conditions are y(0) = 1 and the step size is 0.1, we have
t0= 0, y0= 1, and h= 0.1.
Step 3: Perform iterations using the Runge-Kutta method
We will perform iterations to approximate y(0.3) using the provided differential
equation and the Runge-Kutta method.
k1= 0.1·(02−1) = −0.1,
k2= 0.1·((0 + 0.05)2−1) = −0.0975,
k3= 0.1·((0 + 0.05)2−1) = −0.0975,
k4= 0.1·(0.12−1) = −0.099,
y1= 1 + 1
6(−0.1 + 2(−0.0975) + 2(−0.0975) −0.099) = 0.92625.
Therefore, the approximate value of y(0.3) using the fourth-order Runge-
Kutta method with a step size of 0.1 is y(0.3) ≈0.92625.
34
k3= 0.1·(2 ·(0 + 0.05) ·(1 + 0.0003125) + (0 + 0.05)2) = 0.0006259375,
k4= 0.1·(2 ·(0.1) ·(1 + 0.0006259375) + (0.1)2)=0.02004375.
Step 2: Update the value of y:
y1= 1 + 1
6(0 + 2 ·0.000625 + 2 ·0.0006259375 + 0.02004375) = 1.0025.
Therefore, the approximate solution to the initial value problem over the
interval [0,0.1] is y(0.1) ≈1.0025.
Question 2
Question
Given the initial value problem:
dy
dx=x2−y, y(0) = 1,
approximate y(0.1) using the second-order Runge-Kutta method with a step
size of h= 0.05.
Solution
Step 1: We first calculate the increments k1and k2:
k1=hf(xn, yn)=0.05 02−1=−0.05,
k2=hf(xn+h
2, yn+k1
2) = 0.05 0 + 0.05
22
−(1 −0.025)!=−0.03344.
Step 2: Next, we calculate the new approximation yn+1:
yn+1 =yn+k1+k2
2= 1 + −0.05 −0.03344
2= 0.95828.
Therefore, using the second-order Runge-Kutta method with h= 0.05, the
approximate value of y(0.1) is 0.95828.
Question 3
Question
Consider the initial value problem:
dy
dx =x2+y2, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate the value of y(0.2)
using a step size of h= 0.1.
2
Solution
The fourth-order Runge-Kutta method is given by the following formulas:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 1: Initialize with the given values x0= 0 and y0= 1. The step size is
h= 0.1.
Step 2: Calculate k1:
k1= 0.1(02+ 12)
= 0.1
Step 3: Calculate k2:
k2= 0.10 + 0.1
22
+ (1 + 0.1
2)2
= 0.1(0.005 + 1.025)
= 0.103
Step 4: Calculate k3:
k3= 0.10 + 0.1
22
+ (1 + 0.103
2)2
= 0.1(0.005 + 1.026)
= 0.1031
Step 5: Calculate k4:
k4= 0.1(0 + 0.1031)2+ (1 + 0.1031)2
= 0.1(0.0106 + 1.2132)
= 0.1234
Step 6: Calculate y1:
y1= 1 + 1
6(0.1 + 2(0.103) + 2(0.1031) + 0.1234)
≈1 + 1
6(0.1+0.206 + 0.2062 + 0.1234)
≈1 + 1
6(0.6356)
≈1.10593
3
Therefore, the approximate value of y(0.2) using the fourth-order Runge-
Kutta method with a step size of 0.1 is y(0.2) ≈1.10593.
Question 4
Question
Consider the initial value problem
dy
dx =x2+y2, y(0) = 1,
and approximate the value of y(1) using the fourth-order Runge-Kutta method
with h= 0.1.
Solution
To approximate the value of y(1) using the fourth-order Runge-Kutta method,
we need to use the following formulas at each step:
k1=hf(xn, yn),
k2=hf(xn+h
2, yn+k1
2),
k3=hf(xn+h
2, yn+k2
2),
k4=hf(xn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4),
where his the step size, f(x, y) = x2+y2, and ynis the previous approximation
of y(xn).
Step 1: Initialize variables and define the function f(x, y). Let h= 0.1,
x0= 0, y0= 1, and xtarget = 1. The function f(x, y) is given by f(x, y) =
x2+y2.
Step 2: Calculate the approximate value of yat x= 1 using the fourth-order
Runge-Kutta method.
k1= 0.1f(0,1) = 0.1·(02+ 12)=0.1,
k2= 0.1f(0 + 0.05,1+0.05 ·0.1
2) = 0.1·(0.052+ (1 + 0.05 ·0.1/2)2)=0.1025,
k3= 0.1f(0 + 0.05,1+0.05 ·0.1025
2) = 0.1·(0.052+ (1 + 0.05 ·0.1025/2)2) = 0.105112,
k4= 0.1f(0.1,1+0.105112) = 0.1·(0.12+ (1 + 0.105112)2) = 0.119527,
y1= 1 + 1
6(0.1+2·0.1025 + 2 ·0.105112 + 0.119527) ≈1.117292.
Therefore, the approximate value of y(1) using the fourth-order Runge-Kutta
method with h= 0.1 is y(1) ≈1.117292.
4
Question 5
Question
Consider the initial value problem:
dy
dx =x2−y2, y(0) = 1.
Use the fourth-order Runge-Kutta method to approximate the value of y(0.1)
with step size h= 0.05.
Solution
Let’s denote f(x, y) = x2−y2. The fourth-order Runge-Kutta method is given
by the following formulas:
k1=hf(xn, yn),
k2=hf(xn+h
2, yn+k1
2),
k3=hf(xn+h
2, yn+k2
2),
k4=hf(xn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
where his the step size, xnis the current value of x,ynis the current value of
y, and yn+1 is the next approximation of y.
Step 1: Calculate y(0.05) using the fourth-order Runge-Kutta method.
Using the initial condition, we have y0= 1 and x0= 0:
k1= 0.05f(0,1) = 0.05(02−12) = −0.05,
k2= 0.05f(0 + 0.025,1−0.025(0.05/2)) = 0.05(0.0252−0.9752)≈ −0.04625,
k3= 0.05f(0 + 0.025,1−0.025(0.04625/2)) = 0.05(0.0252−0.9706252)≈ −0.04266,
k4= 0.05f(0.05,1−0.04266) = 0.05(0.052−0.95733612)≈ −0.04081,
y1= 1 + 1
6(−0.05 + 2(−0.04625) + 2(−0.04266) −0.04081) ≈0.99449.
Hence, the approximate value of y(0.05) is y1≈0.99449.
Step 2: Calculate y(0.1) using the fourth-order Runge-Kutta method.
Now, we will repeat the Runge-Kutta method with the new initial conditions:
x= 0.05, y= 0.99449:
k1= 0.05f(0.05,0.99449) = 0.05(0.052−0.994492)≈ −0.09430,
k2. . .
Continuing these calculations will give us y(0.1). The Runge-Kutta method
with step size h= 0.05 can accurately approximate the solution to this differ-
ential equation.
5
Question 6
Question
Consider the initial value problem
dy
dx =x2−y2, y(0) = 1.
Use the fourth-order Runge-Kutta method to approximate y(0.1) using a step
size of h= 0.05.
Solution
To apply the fourth-order Runge-Kutta method, we first need to calculate the
values of yat different points using the formula:
k1=hf(xn, yn),
k2=hf(xn+h
2, yn+k1
2),
k3=hf(xn+h
2, yn+k2
2),
k4=hf(xn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Step 1: Calculate y(0.05)
k1= 0.05(02−12) = −0.05,
k2= 0.05 0 + −0.05
2=−0.00125,
k3= 0.05 0 + −0.00125
2=−0.00003125,
k4= 0.05 (0.05 + (−0.05 −0.00003125)) = 0.00246875,
y(0.05) = 1 + 1
6(−0.05 + 2(−0.00125) + 2(−0.00003125) + 0.00246875) ≈0.94859635.
Step 2: Calculate y(0.1)
k1= 0.05(0.052−0.948596352)≈ −0.04752435,
k2= 0.05 0.05 + −0.04752435
2≈0.00118888,
k3= 0.05 0.05 + 0.00118888
2≈0.0012057,
k4= 0.05 (0.1+(−0.94859635 + 0.0012057)) ≈0.07748707,
y(0.1) ≈0.94859635 + 1
6(−0.04752435 + 2(0.00118888) + 2(0.0012057) + 0.07748707) ≈0.93699658.
6
Therefore, the fourth-order Runge-Kutta method gives us an approximation
of y(0.1) ≈0.93699658 with a step size of h= 0.05.
Question 7
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem: dy
dx =x2+y, y(0) = 1
up to x= 1 using a step size of h= 0.2.
Solution
To approximate the solution using the fourth-order Runge-Kutta method, we
will follow these steps:
Step 1: Define the function f(x, y) = x2+y.
Step 2: Using the given initial condition, y(0) = 1, evaluate the following
for each step:
k1=hf(xn, yn),
k2=hf xn+h
2, yn+k1
2,
k3=hf xn+h
2, yn+k2
2,
k4=hf (xn+h, yn+k3),
yn+1 =yn+k1+ 2k2+ 2k3+k4
6.
Step 3: Calculate the solution up to x= 1 using a step size of h= 0.2.
Step 4: Repeat the above process until reaching x= 1.
Let’s start solving this problem.
Step 1: Define the function f(x, y) = x2+y.
Step 2: Evaluate k1,k2,k3,k4, and calculate yn+1.
k1= 0.2·(02+ 1) = 0.2(1) = 0.2,
k2= 0.2·0 + 0.2
22
+ (1 + 0.2
2)=0.2·0.2
22
+5
4= 0.2·0.04
4+5
4= 0.005 + 5
4,
k3= 0.2·0 + 0.2
22
+1 + 0.005 + 5
4
2= 0.2·0.2
22
+1
2·5
4+ 0.005= 0.005 + 1
2·21
8,
k4= 0.2·(0 + 0.2)2+1+0.005 + 1
2·21
8= 0.2·0.04 + 1 + 0.005 + 21
16 = 0.008 + 1 + 0.005 + 21
16,
y1= 1 + 0.2 + 2(0.005 + 5
4) + 2(0.005 + 1
2·21
8)+0.008 + 1
6= 1 + 0.2 + 2(0.005 + 5
4) + 2(0.005 + 1
2·21
8)+0.008 + 1
6.
7
Step 3: Repeat the process for x= 0.2,0.4,0.6,0.8,1.
After these calculations, we will have approximate values for yat x=
0.2,0.4,0.6,0.8,1.
Question 8
Question
Use the Runge-Kutta method to approximate the solution to the initial value
problem given by the differential equation:
dy
dx =x+y, y(0) = 1
over the interval [0,0.5] using four steps with step size h= 0.125.
Solution
To solve this initial value problem using the Runge-Kutta method, we will ap-
proximate the solution at each step using the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
Given that h= 0.125, we will take steps at x= 0,0.125,0.25,0.375,0.5.
Step 1: Calculate k1, k2, k3, k4at x= 0, y = 1.
k1= 0.125(0 + 1) = 0.125
k2= 0.125(0 + 1) = 0.125
k3= 0.125(0 + 1) = 0.125
k4= 0.125(0.125 + 1.125) = 0.15625
Step 2: Update yusing the Runge-Kutta formula:
y1= 1 + 1
6(0.125 + 2(0.125) + 2(0.125) + 0.15625) = 1.27604
Step 3: Repeat the process at x= 0.125, y = 1.27604 to find y2.
Step 4: Repeat the process at x= 0.25, y =y2to find y3.
Step 5: Repeat the process at x= 0.375, y =y3to find y4.
Step 6: Repeat the process at x= 0.5, y =y4to find the approximation y5.
Therefore, the approximate solution to the initial value problem at x= 0.5
is y(0.5) = y5.
8
Question 9
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem: dy
dx =x2−y, y(0) = 1
over the interval 0 ≤x≤0.5. Use a step size of h= 0.1.
Solution
Step 1: Define the differential equation’s function and set up the Runge-Kutta
formula: The general form of a fourth-order Runge-Kutta formula is given by:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+k1+ 2k2+ 2k3+k4
6
where his the step size, f(x, y) is the differential equation, ynis the previous
value of y, and yn+1 is the next value of y.
For this problem, f(x, y) = x2−y. Let’s apply the formula to approximate
yover the interval 0 ≤x≤0.5 with h= 0.1.
Step 2: Solve for the approximate values of yusing the Runge-Kutta method:
Substitute f(x, y) into the formula and iterate over the interval to find the values
of y.
x0= 0, y0= 1
k1= 0.1·(02−1) = −0.1
k2= 0.1· 0 + 0.1
22
−(1 + −0.1
2)!=−0.09025
k3= 0.1· 0 + 0.1
22
−(1 + −0.09025
2)!=−0.0808125
k4= 0.1·(0 + 0.1)2−(1 + (−0.0808125))=−0.07243856
y1= 1 + −0.1 + 2(−0.09025) + 2(−0.0808125) −0.07243856
6≈0.86796
We continue this process iteratively until we reach x= 0.5.
The approximate values of yover the interval 0 ≤x≤0.5 with h= 0.1
using the fourth-order Runge-Kutta method have been calculated.
9
Question 10
Question
Consider the initial value problem
dy
dx =x2−y, y(0) = 1.
Use the fourth-order Runge-Kutta method with step size h= 0.1 to approximate
y(0.4).
Solution
Step 1: Set up the fourth-order Runge-Kutta method:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 2: Iterate through the Runge-Kutta method to approximate y(0.4):
k1= 0.1·(02−1) = −0.1
k2= 0.1·(0 + 0.1
2−(1 −0.1/2)) = −0.095
k3= 0.1·(0 + 0.1
2−(1 −0.095/2)) = −0.09025
k4= 0.1·(0.1−(1 −0.09025)) = 0.109025
y1= 1 + 1
6(−0.1 + 2(−0.095) + 2(−0.09025) + 0.109025) = 0.859974
Hence, the fourth-order Runge-Kutta method gives an approximation of
y(0.4) ≈0.859974.
Question 11
Question
Consider the initial value problem:
dy
dx =x2+y, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate y(1) using a step size
of h= 0.2.
10
Solution
The fourth-order Runge-Kutta method is given by the following equations:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 1: Calculate the values of k1,k2,k3, and k4at each iteration using
the given initial conditions and step size h= 0.2.
Step 2: Update the value of yusing the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 3: Iterate through the steps in the interval [0,1] until x= 1 is reached.
Step 4: Calculate y(1) using the approximations obtained in the iterations.
It is recommended to perform the calculations in these steps to obtain the
numerical approximation for y(1).
Question 12
Question
Consider the following initial value problem:
dy
dx =x2−y, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate y(0.1) using a step
size of h= 0.05.
Solution
Given the initial value problem:
dy
dx =x2−y, y(0) = 1
we will apply the fourth-order Runge-Kutta method with step size h= 0.05 to
approximate y(0.1).
11
The fourth-order Runge-Kutta formula is given by:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Let’s first calculate the intermediate values using the given step size h= 0.05:
k1= 0.05 ×(02−1) = −0.05
k2= 0.05 ×(0 + 0.025)2−(1 −0.025/2)=−0.048125
k3= 0.05 ×(0 + 0.025)2−(1 −0.048125/2)=−0.046301
k4= 0.05 ×(0.05)2−(1 −0.046301)=−0.003011
Now, we can calculate the approximation of y(0.1):
y(0.1) ≈1 + 1
6(−0.05 + 2(−0.048125) + 2(−0.046301) −0.003011)
≈1 + 1
6(−0.05 −0.09625 −0.092602 −0.003011)
≈1 + 1
6(−0.241863)
≈0.95864
Therefore, the approximation of y(0.1) using the fourth-order Runge-Kutta
method with a step size of 0.05 is approximately 0.95864.
Question 13
Question
Consider the initial value problem y′(t) = −2ty(t) with y(0) = 1. Use the
fourth-order Runge-Kutta method to estimate y(0.5) with step size h= 0.1.
Solution
The fourth-order Runge-Kutta method is given by the following formulas:
k1=hf(tn, yn)
k2=hf(tn+h
2, yn+k1
2)
12
k3=hf(tn+h
2, yn+k2
2)
k4=hf(tn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where tn=nh and ynis the approximate value of y(tn).
Step 1: Calculate using the Runge-Kutta method.
First, let’s calculate the value of y(0.1):
k1=h(−2tnyn) = 0.1(−2·0·1) = 0
k2=h(−2(tn+h
2)(yn+k1
2)) = 0.1(−2(0 + 0.1
2)(1 + 0
2)) = −0.001
k3=h(−2(tn+h
2)(yn+k2
2)) = 0.1(−2(0 + 0.1
2)(1 + −0.001
2)) ≈ −0.000901
k4=h(−2(tn+h)(yn+k3)) = 0.1(−2(0.1)(1 + −0.000901)) ≈ −0.001809
Now, we can calculate y(0.1):
yn+1 =yn+1
6(k1+2k2+2k3+k4) = 1+1
6(0+2(−0.001)+2(−0.000901)+(−0.001809)) ≈0.99744
Step 2: Repeat the process until we find y(0.5).
Continuing in this manner, we can repeat the Runge-Kutta method calcu-
lations for n= 1,2,3,4,5 to find y(0.5).
Therefore, the estimate of y(0.5) using the fourth-order Runge-Kutta method
with step size h= 0.1 is approximately 0.99744.
Question 14
Question
Use a Runge-Kutta method with h= 0.2 to estimate the value of y(1.4) for the
initial value problem: dy
dx =x2+y, y(1) = 1
Solution
To solve this initial value problem using a Runge-Kutta method, we will follow
these steps: Let h= 0.2 and x0= 1, y0= 1.
13
Step 1: Calculate k1,k2,k3, and k4
k1=h·f(x0, y0)=0.2·((1)2+ 1) = 0.4
k2=h·f(x0+h
2, y0+k1
2)
k2= 0.2·(1 + 0.1)2+ (1 + 0.1+0.2·0.4
2)
k2= 0.2·(1.12+ 1.1+0.04) = 0.464
k3=h·f(x0+h
2, y0+k2
2)
k3= 0.2·(1 + 0.1)2+ (1 + 0.1+0.2·0.464
2)
k3= 0.2·(1.12+ 1.1+0.0464) = 0.46088
k4=h·f(x0+h, y0+k3)=0.2·((1 + 0.2)2+ (1 + 0.46088)) = 0.532352
Step 2: Update the values of xand y
y1=y0+1
6(k1+ 2k2+ 2k3+k4)
y1= 1 + 1
6(0.4+2·0.464 + 2 ·0.46088 + 0.532352)
y1≈1.2607
Therefore, the estimated value of y(1.4) using the Runge-Kutta method with
h= 0.2 is approximately 1.2607.
Question 15
Question
Given the initial value problem:
dy
dx =x2+y, y(0) = 1
approximate y(0.1) using the 4th-order Runge-Kutta method with a step size
of h= 0.1.
14
Solution
To approximate y(0.1) using the 4th-order Runge-Kutta method, we will first
compute the values of the intermediate steps using the following formulas:
k1=h·f(xn, yn),
k2=h·f(xn+h
2, yn+k1
2),
k3=h·f(xn+h
2, yn+k2
2),
k4=h·f(xn+h, yn+k3).
Then, we will update the value of yusing the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Step 1: Calculate k1:
k1= 0.1·02+ 1= 0.1
Step 2: Calculate k2:
k2= 0.1· 0 + 0.1
22
+ (1 + 0.1
2)!= 0.10525
Step 3: Calculate k3:
k3= 0.1· 0 + 0.1
22
+ (1 + 0.10525
2)!= 0.110512625
Step 4: Calculate k4:
k4= 0.1·(0 + 0.1)2+ (1 + 0.110512625)= 0.1211021625
Step 5: Update y:
y(0.1) ≈1 + 1
6(0.1+2·0.10525 + 2 ·0.110512625 + 0.1211021625) ≈1.012852
Therefore, the approximate value of y(0.1) using the 4th-order Runge-Kutta
method is y(0.1) ≈1.012852.
Question 16
Question
Use the classical fourth-order Runge-Kutta method to approximate the solution
of the initial value problem
dy
dx =x2+y2, y(0) = 1
over the interval [0,1] using h= 0.2.
15
Solution
To apply the classical fourth-order Runge-Kutta method, we first define the
following iterative formula:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where f(x, y) = x2+y2,his the step size, and xn=x0+nh.
Step 1: Calculate the values of yn+1 at each iteration.
k1= 0.2(02+ 12)=0.2
k2= 0.20.2+12= 0.24
k3= 0.20.2+1.242≈0.304
k4= 0.20.4+1.41442≈0.402
y1= 1 + 1
6(0.2 + 2(0.24) + 2(0.304) + 0.402) ≈1.204013
k1= 0.20.2+1.2040132≈0.312164
k2= 0.20.4+1.4091172≈0.413031
k3= 0.20.4+1.6217452≈0.542296
k4= 0.20.6+1.7175272≈0.594551
y2= 1.204013 + 1
6(0.312164 + 2(0.413031) + 2(0.542296) + 0.594551) ≈1.538862
k1= 0.20.4+1.5388622≈0.474645
k2= 0.20.6+1.8433322≈0.60785
k3= 0.20.6+2.0832822≈0.729843
k4= 0.20.8+2.2126342≈0.840285
y3= 1.538862 + 1
6(0.474645 + 2(0.60785) + 2(0.729843) + 0.840285) ≈1.986797
Therefore, using the classical fourth-order Runge-Kutta method with a step
size of 0.2, the approximate solution to the initial value problem is y(1) ≈
1.986797.
16
Question 17
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem:
dy
dx =x2−y2, y(0) = 1,for 0 ≤x≤1
Use a step size of h= 0.1 and compute the approximate value of y(1).
Solution
Step 1: Define the function f(x, y) = x2−y2.
Step 2: Set the initial conditions x0= 0, y0= 1, and the step size h= 0.1.
Step 3: Calculate the values of yat each step using the Runge-Kutta formula:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
Step 4: Update the values of xand y:
xn+1 =xn+h
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 5: Repeat steps 3 and 4 for each step until x= 1.
Step 6: The approximate value of y(1) is the final value of yafter all the
steps.
Following these steps, we can compute the approximate value of y(1) using
the fourth-order Runge-Kutta method.
Question 18
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem
dy
dx =y−x2+ 1, y(0) = 0
at x= 1 using a step size of h= 0.2.
17
Solution
The fourth-order Runge-Kutta method is given by the formulas:
k1=hf(xn, yn),
k2=hf(xn+h
2, yn+k1
2),
k3=hf(xn+h
2, yn+k2
2),
k4=hf(xn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4),
where f(x, y) = y−x2+ 1.
Step 1: At x= 0, y0= 0. So, we have:
k1= 0.2f(0,0) = 0.2(0 −02+ 1) = 0.2,
k2= 0.2f(0 + 0.2
2,0 + 0.2
2) = 0.2(0.1−0.22+ 1) = 0.196,
k3= 0.2f(0 + 0.2
2,0 + 0.196
2)=0.2(0.1−0.098 −0.0196 + 1) = 0.2008,
k4= 0.2f(0 + 0.2,0+0.2008) = 0.2(0.2008 −0.22+ 1) = 0.202016,
Step 2: Now, we can calculate the new approximation:
y1= 0 + 1
6(0.2 + 2(0.196) + 2(0.2008) + 0.202016) = 0.38868.
Therefore, the approximate solution at x= 1 is y(1) ≈0.38868.
Question 19
Question
Consider the initial value problem:
dy
dx =x2+y, y(0) = 1
Use the fourth-order Runge-Kutta method to estimate y(1) with step size h=
0.2.
Solution
To apply the fourth-order Runge-Kutta method, we will follow these steps:
Step 1: Define the function f(x, y) based on the given initial value problem:
f(x, y) = x2+y
18
Step 2: Initialize the variables:
h= 0.2, x0= 0, y0= 1, xf= 1
Step 3: Use the following formulas for each iteration:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 4: Calculate the estimations:
k1= 0.2·(02+ 1) = 0.2
k2= 0.2·(0.12+ 1) = 0.21
k3= 0.2·(0.12+ 1.105) ≈0.221
k4= 0.2·(0.22+ 1.152) ≈0.24
y1≈1 + 1
6(0.2+2∗0.21 + 2 ∗0.221 + 0.24) ≈1.2525
Therefore, the estimation of y(1) using the fourth-order Runge-Kutta method
with step size h= 0.2 is approximately 1.2525.
Question 20
Question
Consider the initial value problem: dy
dx =x2+y2, with y(0) = 1. Use the
fourth-order Runge-Kutta method to approximate y(0.5) using a step size of
h= 0.1.
Solution
To approximate y(0.5) using the fourth-order Runge-Kutta method, we will
perform four stages of calculations for each step of size 0.1.
Step 1: Calculate k1:
k1=h·f(xn, yn)=0.1·(02+ 12)=0.1
Step 2: Calculate k2:
k2=h·f(xn+h
2, yn+k1
2)=0.1·((0+0.05)2+(1+0.05)2)=0.1·1.105625 = 0.1105625
19
Step 3: Calculate k3:
k3=h·f(xn+h
2, yn+k2
2)=0.1·((0+0.05)2+(1+0.1105625)2) = 0.1·1.24610703 = 0.124610703
Step 4: Calculate k4:
k4=h·f(xn+h, yn+k3)=0.1·((0+0.1)2+(1+0.124610703)2)=0.1·1.60588416 = 0.160588416
Finally, compute the weighted average of the four slopes to find the next
approximation yn+1:
yn+1 =yn+1
6(k1+2k2+2k3+k4) = 1+1
6(0.1+2(0.1105625)+2(0.124610703)+0.160588416) = 1.17167849
Therefore, the approximate value of y(0.5) using the fourth-order Runge-
Kutta method with a step size of h= 0.1 is y(0.5) ≈1.1717.
Question 21
Question
Consider the initial value problem
y′=−2y+ 4t, y(0) = 1,
and suppose we want to approximate y(0.4) using the fourth-order Runge-Kutta
method with a step size of h= 0.1. Use three steps to find this approximation.
Solution
To approximate y(0.4) using the fourth-order Runge-Kutta method with h=
0.1, we need to perform three steps.
Step 1: Calculate k1,k2,k3, and k4at t= 0.
k1=−2(1) + 4(0) = −2,
k2=−2(1 + 0.05) + 4(0.05) = −2.1,
k3=−2(1 + 0.05) + 4(0.05) = −2.1,
k4=−2(1 + 0.1) + 4(0.1) = −2.2.
Step 2: Update yusing the weighted sum of the kvalues from Step 1.
y(0.1) = 1 + 1
6(1 · −2+2· −2.1+2· −2.1+1· −2.2) = 0.91.
20
Step 3: Repeat Steps 1 and 2 at t= 0.1 and t= 0.2 to find y(0.2) and
y(0.3).
k1=−2(0.91) + 4(0.1) = −1.82,
k2=−2(0.91 + 0.05) + 4(0.15) = −1.94,
k3=−2(0.91 + 0.05) + 4(0.15) = −1.94,
k4=−2(0.91 + 0.1) + 4(0.2) = −2.08,
y(0.2) = 0.91 + 1
6(1 · −1.82 + 2 · −1.94 + 2 · −1.94 + 1 · −2.08) = 0.804,
k1=−2(0.804) + 4(0.2) = −1.608,
k2=−2(0.804 + 0.05) + 4(0.25) = −1.736,
k3=−2(0.804 + 0.05) + 4(0.25) = −1.736,
k4=−2(0.804 + 0.1) + 4(0.3) = −1.872,
y(0.3) = 0.804 + 1
6(1 · −1.608 + 2 · −1.736 + 2 · −1.736 + 1 · −1.872) = 0.692.
Therefore, the approximate solution to the initial value problem y′=−2y+
4t,y(0) = 1 at t= 0.4 using the fourth-order Runge-Kutta method with step
size h= 0.1 is y(0.4) ≈0.692.
Question 22
Question
Consider the initial value problem given by dy
dx =x−2y,y(0) = 1. Use the
fourth-order Runge-Kutta method to approximate y(0.4) with a step size of
h= 0.1.
Solution
Let’s denote ynas the approximation of y(xn) at xn. The fourth-order Runge-
Kutta method is given by the following formulas:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
21
Now, let’s apply the fourth-order Runge-Kutta method with the given initial
value problem and step size.
Step 1: Calculate y1using the Runge-Kutta method.
k1= 0.1(0 −2·1) = −0.2
k2= 0.1(0 + 0.1
2−2(1 + −0.2
2)) = −0.19
k3= 0.1(0 + 0.1
2−2(1 + −0.19
2)) = −0.181
k4= 0.1(0.1−2(1 + (−0.181))) = −0.1606
y1= 1 + 1
6(−0.2 + 2(−0.19) + 2(−0.181) −0.1606) ≈0.8641
Therefore, y(0.1) ≈0.8641.
Step 2: Calculate y2using the same method. Following the same process
as above, we find that y(0.2) ≈0.7309.
Step 3: Calculate y3. Similarly, following the method, we find that y(0.3) ≈
0.6000.
Step 4: Calculate y4. Applying the method, we find that y(0.4) ≈0.4716.
Therefore, using the fourth-order Runge-Kutta method with a step size of
0.1, the approximation for y(0.4) is 0.4716.
Question 23
Question
Consider the initial value problem:
dy
dx =x2+y2, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate the value of y(0.4)
with step size h= 0.1.
Solution
Step 1: Define the Runge-Kutta method: The fourth-order Runge-Kutta method
is given by:
k1=hf(xn, yn)
k2=hf(xn+h
2, yn+k1
2)
k3=hf(xn+h
2, yn+k2
2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
22
where f(x, y) = x2+y2.
Step 2: Calculate the approximation of y(0.4): Let’s use the given step size
h= 0.1 to calculate y(0.4) using the Runge-Kutta method:
Step 2.1: At x= 0:
k1= 0.1(02+ 12)=0.1
k2= 0.1((0 + 0.05)2+ (1 + 0.05)2)=0.10625
k3= 0.1((0 + 0.05)2+ (1 + 0.053125)2) = 0.10657
k4= 0.1((0.1)2+ (1.053125)2) = 0.107737
Step 2.2: Calculate y(0.1):
y1= 1 + 1
6(0.1 + 2(0.10625) + 2(0.10657) + 0.107737)
= 1.105908
Performing similar calculations iteratively, we obtain:
y(0.2) ≈1.233057
y(0.3) ≈1.522563
y(0.4) ≈1.975220
Therefore, the approximation of y(0.4) using the fourth-order Runge-Kutta
method with step size 0.1 is approximately 1.975220.
Question 24
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem dy
dx =x2+y2, y(0) = 1
for 0 ≤x≤1 using a step size of h= 0.1.
Solution
To approximate the solution using the fourth-order Runge-Kutta method, we
will use the following formulas:
k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
23
where f(x, y) = x2+y2, with the initial condition y(0) = 1.
Step 1: Define the function f(x, y) = x2+y2.
Step 2: Set the initial values x0= 0 and y0= 1.
Step 3: Calculate the values of k1,k2,k3, and k4using the given formulas.
At n= 0:
k1= 0.1·f(0,1) = 0.1·(02+ 12)=0.1
k2= 0.1·f(0 + 0.05,1+0.05 ·0.1
2) = 0.1·(0.052+ (1 + 0.025)2)≈0.10251
k3= 0.1·f(0 + 0.05,1+0.05 ·0.10251
2)=0.1·(0.052+ (1 + 0.05125)2)≈0.1051
k4= 0.1·f(0 + 0.1,1+0.1051) = 0.1·(0.12+ (1 + 0.1051)2)≈0.12051
Step 4: Calculate the next value of yusing yn+1 =yn+1
6(k1+2k2+2k3+k4).
y1= 1 + 1
6(0.1+2×0.10251 + 2 ×0.1051 + 0.12051) ≈1.08038
Repeat the above steps until reaching the desired value of x.
Question 25
Question
Consider the initial value problem
dy
dx =x2+y2, y(0) = 1,
and use the 4th-order Runge-Kutta method to approximate y(1) using a step
size of h= 0.1.
Solution
To approximate y(1) using the 4th-order Runge-Kutta method with step size
h= 0.1, we need to perform several iterations. Let’s start with the initial
condition and compute the approximations step by step.
Step 1: Define the function f(x, y) = x2+y2.
Step 2: Calculate the increments k1,k2,k3, and k4as follows:
k1=h·f(0,1) = 0.1·(02+ 12)=0.1,
k2=h·f(0 + h
2,1 + k1
2) = 0.1·(0.052+ 1.052)≈0.113313,
k3=h·f(0 + h
2,1 + k2
2) = 0.1·(0.052+ 1.0566572)≈0.116267,
k4=h·f(0 + h, 1 + k3) = 0.1·(0.12+ 1.1162672)≈0.122634.
24
Step 3: Update the approximation using the weighted average of the incre-
ments:
y(0.1) ≈1+1
6(k1+2k2+2k3+k4)≈1+1
6(0.1+2(0.113313)+2(0.116267)+0.122634) ≈1.013434333.
Step 4: Repeat the above steps to find y(0.2), y(0.3), and so on, until we
reach y(1).
Thus, using the 4th-order Runge-Kutta method with a step size of h= 0.1,
the approximation for y(1) is approximately 1.013434333.
Question 26
Question
Consider the initial value problem given by the differential equation dy
dx =x2−y
with initial condition y(0) = 1. Use the fourth-order Runge-Kutta method to
approximate y(0.2) with a step size of h= 0.1.
Solution
Step 1: Define the necessary formulas for the fourth-order Runge-Kutta method:
k1=h(f(xn, yn)),
k2=h(f(xn+h
2, yn+k1
2)),
k3=h(f(xn+h
2, yn+k2
2)),
k4=h(f(xn+h, yn+k3)),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4),
where f(x, y) = x2−y.
Step 2: Calculate the approximate value of y(0.2) using the Runge-Kutta
method with h= 0.1:
k1= 0.1(02−1) = −0.1,
k2= 0.1((0 + 0.05)2−(1 −0.05/2)) = −0.1025,
k3= 0.1((0 + 0.05)2−(1 −0.1025/2)) = −0.1051,
k4= 0.1((0 + 0.1)2−(1 −0.1051)) = −0.1202,
y1= 1 + 1
6(−0.1 + 2(−0.1025) + 2(−0.1051) −0.1202) ≈0.8307.
Therefore, the approximate value of y(0.2) using the fourth-order Runge-
Kutta method is y(0.2) ≈0.8307.
25
Question 27
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem dy
dt =t2−1, y(0) = 0
on the interval [0,1] with step size h= 0.1.
Solution
The fourth-order Runge-Kutta method is given by the following formulas:
k1=hf(tn, yn),
k2=hf(tn+h
2, yn+k1
2),
k3=hf(tn+h
2, yn+k2
2),
k4=hf(tn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Step 1: Set up the iteration process with h= 0.1 and t0= 0, y0= 0.
t0= 0, y0= 0,
t1=t0+h= 0.1, y1=y0+1
6(k1+ 2k2+ 2k3+k4).
Step 2: Calculate k1, k2, k3,and k4.
k1= 0.1(02−1) = −0.1,
k2= 0.1((0 + 0.05)2−1) = −0.0975,
k3= 0.1((0 + 0.05)2−1) = −0.0975,
k4= 0.1(0.12−1) = −0.099.
Step 3: Use the formula to find y1.
y1= 0 + 1
6(−0.1 + 2(−0.0975) + 2(−0.0975) −0.099)
= 0.000625.
Therefore, the approximate solution to the initial value problem dy
dt =t2−
1, y(0) = 0 at t= 0.1 using the fourth-order Runge-Kutta method is y(0.1) ≈
0.000625.
26
Question 28
Question
Using the Runge-Kutta method with four steps, approximate the solution to
the initial value problem
dy
dx =x2+y, y(0) = 1
over the interval [0,0.2].
Solution
To solve the initial value problem using the Runge-Kutta method, we will use
four steps to approximate the solution.
Step 1: Calculate k1,k2,k3, and k4:
k1=f(xn, yn) = x2
n+yn,
k2=fxn+h
2, yn+h
2k1=xn+h
22
+yn+h
2k1,
k3=fxn+h
2, yn+h
2k2=xn+h
22
+yn+h
2k2,
k4=f(xn+h, yn+hk3)=(xn+h)2+ (yn+hk3).
where h= 0.2/4=0.05.
Step 2: Calculate the next approximation using the formula:
yn+1 =yn+h
6(k1+ 2k2+ 2k3+k4).
Step 3: Using the initial condition y(0) = 1, we can start the iteration:
k1= 02+ 1 = 1,
k2=0 + 0.05
22
+1 + 0.05
2·1≈1.0013,
k3=0 + 0.05
22
+1 + 0.05
2·1.0013≈1.0026,
k4= (0 + 0.05)2+ (1 + 0.05 ·1.0026) ≈1.0077,
y1= 1 + 0.05
6(1 + 2(1.0013) + 2(1.0026) + 1.0077) ≈1.00905.
Continue this process until x= 0.2.
27
Question 29
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem: dy
dx =x2+y2, y(0) = 1
over the interval [0, 0.2]. Use a step size of h= 0.1.
Solution
Step 1: Define the function f(x, y) = x2+y2.
Step 2: Determine the number of steps to take. With a step size of h= 0.1
over the interval [0,0.2], we need 2 steps.
Step 3: Use the fourth-order Runge-Kutta method to approximate the solu-
tion: k1=h·f(xn, yn)
k2=h·f(xn+h
2, yn+k1
2)
k3=h·f(xn+h
2, yn+k2
2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 4: Perform the calculations.
k1= 0.1·(02+ 12) = 0.1
k2= 0.1·((0 + 0.05)2+ (1 + 0.05)2)=0.1175
k3= 0.1·((0 + 0.05)2+ (1 + 0.1175/2)2)=0.11811
k4= 0.1·(0.12+ (1 + 0.11811)2)=0.12004
y1= 1 + 1
6(0.1 + 2(0.1175) + 2(0.11811) + 0.12004) ≈1.0400077
Step 5: Repeat the process for the next step.
k1= 0.1·((0.1)2+ 1.04000772)≈0.1052217
k2= 0.1·((0.1+0.05)2+ (1.0400077 + 0.1052217/2)2)≈0.1267924
k3= 0.1·((0.1+0.05)2+ (1.0400077 + 0.1267924/2)2)≈0.127366
k4= 0.1·(0.152+ (1.0400077 + 0.127366)2)≈0.1293723
y2= 1.0400077 + 1
6(0.1052217 + 2(0.1267924) + 2(0.127366) + 0.1293723) ≈1.0839753
Therefore, the fourth-order Runge-Kutta method yields an approximate so-
lution to the initial value problem as y(0.2) ≈1.0839753 when using a step size
of h= 0.1.
28
Question 30
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem dy
dx = 2x−3y, y(0) = 1
over the interval [0,1]. Use a step size of h= 0.1.
Solution
The fourth-order Runge-Kutta method uses the following formula to approxi-
mate the next value of yat x+h:
yn+1 =yn+h
6(k1+ 2k2+ 2k3+k4)
where
k1=f(xn, yn)
k2=f(xn+h
2, yn+h
2k1)
k3=f(xn+h
2, yn+h
2k2)
k4=f(xn+h, yn+hk3)
Given the initial value problem, f(x, y) = 2x−3y. Let’s start by calculating
the values of yat each step using the fourth-order Runge-Kutta method.
n xnynyn+1
0 0 1 0.7000
1 0.1 0.7 0.4825
2 0.2 0.4825 0.2773
3 0.3 0.2773 0.0961
4 0.4 0.0961 -0.0936
5 0.5 -0.0936 -0.3139
6 0.6 -0.3139 -0.5079
7 0.7 -0.5079 -0.6579
8 0.8 -0.6579 -0.7555
9 0.9 -0.7555 -0.7955
10 1 -0.7955 -0.7749
Therefore, the approximate solution to the initial value problem over the interval
[0,1] using a step size of h= 0.1 is y(1) ≈ −0.7749.
29
Question 31
Question
Consider the initial value problem:
dy
dx =x2−y, y(0) = 1.
Use the fourth-order Runge-Kutta method to approximate y(1) with step size
h= 0.2.
Solution
To use the fourth-order Runge-Kutta method, we need to follow these steps:
k1 = h·f(xn, yn),
k2 = h·f(xn+h
2, yn+k1
2),
k3 = h·f(xn+h
2, yn+k2
2),
k4 = h·f(xn+h, yn+k3),
where f(x, y) = x2−yis the slope function. Then,
yn+1 =yn+1
6(k1+2k2+2k3 + k4).
Step 1: Calculate y(0.2).
k1=0.2·f(0,1) = 0.2·(02−1) = −0.2,
k2=0.2·f(0 + 0.2
2,1 + −0.2
2) = 0.2·(0.12−0.9) = −0.178,
k3=0.2·f(0 + 0.2
2,1 + −0.178
2)=0.2·(0.12−0.889) = −0.158,
k4=0.2·f(0 + 0.2,1+(−0.158)) = 0.2·(0.22−1.158) = −0.9316.
Therefore,
y(0.2) ≈1 + 1
6(−0.2 + 2(−0.178) + 2(−0.158) −0.9316)
≈0.8279.
Step 2: Repeat the process until reaching y(1). We continue this process
for n= 1,2, ..., 5 until we find y(1).
After more calculations, we find y(1) ≈1.1249.
30
Question 32
Question
Using the fourth-order Runge-Kutta method, estimate the value of y(1.2) for
the initial value problem:
dy
dx =x2+y, y(1) = 1
Solution
To estimate the value of y(1.2) using the fourth-order Runge-Kutta method, we
will calculate multiple intermediate values to approximate the solution.
Step 1: Define the step size hand the number of steps N. Let’s choose a
step size of h= 0.2 so that we have N=1.2−1
0.2= 1 step.
Step 2: Define the function f(x, y) based on the given initial value problem.
The function f(x, y) is given by dy
dx =x2+y.
Step 3: Calculate the approximations yi+1 using the fourth-order Runge-
Kutta method. For each step ifrom 0 to 1:
k1=h·f(xi, yi)
k2=h·f(xi+h
2, yi+k1
2)
k3=h·f(xi+h
2, yi+k2
2)
k4=h·f(xi+h, yi+k3)
yi+1 =yi+1
6(k1+ 2k2+ 2k3+k4)
Applying the above equations with initial values x0= 1 and y0= 1:
For i= 0:
k1= 0.2·((1)2+ 1) = 0.4
k2= 0.2·((1 + 0.1)2+ 1 + 0.1·0.4) = 0.468
k3= 0.2·((1 + 0.1)2+ 1 + 0.1·0.468) = 0.4428
k4= 0.2·((1.2)2+ 1 + 0.2·0.4428) = 0.9846
y1= 1 + 1
6(0.4+2·0.468 + 2 ·0.4428 + 0.9846) = 1.32343
Step 4: The estimated value of y(1.2) using the fourth-order Runge-Kutta
method is y(1.2) ≈1.32343.
31
Question 33
Question
Consider the initial value problem:
dy
dx =−2x2y, y(0) = 1
Use the fourth-order Runge-Kutta method to estimate y(0.3) with a step size
of h= 0.1.
Solution
The fourth-order Runge-Kutta method is given by the following formulas:
k1=hf(xn, yn)
k2=hf xn+h
2, yn+k1
2
k3=hf xn+h
2, yn+k2
2
k4=hf (xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where xn+1 =xn+h.
Let’s find the value of y(0.3) using the fourth-order Runge-Kutta method
with a step size of h= 0.1.
Step 1: Calculate k1,k2,k3, and k4at each step.
Step 2: Update yusing the weighted average of these four values.
Step 1:
At x= 0:
k1= 0.1(−2·02·1) = 0
k2= 0.1(−2·(0 + 0.05)2·(1 + 0/2)) = −0.0005
k3= 0.1(−2·(0 + 0.05)2·(1 −0.0005/2)) = −0.000500125
k4= 0.1(−2·0.12·(1 −0.000500125)) = −0.0001000125
At x= 0.1:
k1= 0.1(−2·0.12·(1 −0.0001000125)) = −0.000200025 ≈ −0.0002
k2= 0.1(−2·(0.1+0.05)2·(1 −0.000200025/2)) = −0.0003937969 ≈ −0.0004
k3= 0.1(−2·(0.1+0.05)2·(1 −0.0003937969/2)) = −0.00039407872 ≈ −0.0004
k4= 0.1(−2·0.22·(1 −0.00039407872)) = −0.00062417747088 ≈ −0.0006
32
Step 2:
y1= 1 + 1
6(0 −2(0.0002) + 2(−0.0004) −0.0006) ≈0.99994
Therefore, the approximation of y(0.3) using the fourth-order Runge-Kutta
method with a step size of h= 0.1 is approximately 0.99994.
Question 34
Question
A certain second-order differential equation is given by:
y′′ −2y′+y=ex
with initial conditions y(0) = 1 and y′(0) = 0. Use the fourth-order Runge-
Kutta method to approximate the value of yat x= 0.2 with a step size of
h= 0.1.
Solution
To solve this second-order differential equation using the fourth-order Runge-
Kutta method, we will first convert it into a system of two first-order differential
equations.
Let u=y′, then the given equation becomes:
(y′=u
u′= 2u−y+ex
Applying the fourth-order Runge-Kutta method:
k1,y =h·un
k1,u =h·(2un−yn+exn)
k2,y =h·(un+k1,u
2)
k2,u =h·(2(un+k1,u
2)−(yn+k1,y
2) + exn+h
2)
k3,y =h·(un+k2,u
2)
k3,u =h·(2(un+k2,u
2)−(yn+k2,y
2) + exn+h
2)
k4,y =h·(un+k3,u)
k4,u =h·(2(un+k3,u)−(yn+k3,y ) + exn+h)
yn+1 =yn+1
6·(k1,y + 2k2,y + 2k3,y +k4,y)
un+1 =un+1
6·(k1,u + 2k2,u + 2k3,u +k4,u)
Given that we are looking for the value of yat x= 0.2, we will approximate
the solution using the steps outlined above with an initial y= 1 and u= 0 at
x= 0.
33
Question 35
Question
Consider the initial value problem
dy
dt =t2−1, y(0) = 1,
and approximate the value of y(0.3) using the fourth-order Runge-Kutta method
with a step size of 0.1.
Solution
Step 1: Define the Runge-Kutta method
The fourth-order Runge-Kutta method is given by the formula:
k1=h·f(tn, yn),
k2=h·f(tn+h
2, yn+k1
2),
k3=h·f(tn+h
2, yn+k2
2),
k4=h·f(tn+h, yn+k3),
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4),
where his the step size, tnis the current time point, ynis the current approxi-
mation of y(tn), and f(t, y) is the differential equation.
Step 2: Initialize variables and constants
Given that the initial conditions are y(0) = 1 and the step size is 0.1, we have
t0= 0, y0= 1, and h= 0.1.
Step 3: Perform iterations using the Runge-Kutta method
We will perform iterations to approximate y(0.3) using the provided differential
equation and the Runge-Kutta method.
k1= 0.1·(02−1) = −0.1,
k2= 0.1·((0 + 0.05)2−1) = −0.0975,
k3= 0.1·((0 + 0.05)2−1) = −0.0975,
k4= 0.1·(0.12−1) = −0.099,
y1= 1 + 1
6(−0.1 + 2(−0.0975) + 2(−0.0975) −0.099) = 0.92625.
Therefore, the approximate value of y(0.3) using the fourth-order Runge-
Kutta method with a step size of 0.1 is y(0.3) ≈0.92625.
34