1 / 66100%
MATH 334 - DIFFERENTIAL
EQUATIONS - Runge-Kutta methods
Question Bank - Set 3
Liberty University
Question 1
Question
Consider the initial value problem:
dy
dx =x2y, y(0) = 1.
Apply the classical fourth-order Runge-Kutta method with step size h= 0.1 to
approximate y(0.4).
Solution
Step 1: Define the differential equation and the initial condition.
dy
dx =x2y, y(0) = 1.
Step 2: Choose the step size h= 0.1 and determine the number of steps
needed to reach x= 0.4. The number of steps nis given by n=0.40
0.1= 4.
Step 3: Apply the Runge-Kutta formula to approximate y(0.4).
k1=h·(021) = 0.1,
k2=h·((0 + h
2)2(1 + k1
2)) = 0.09475,
k3=h·((0 + h
2)2(1 + k2
2)) = 0.0895075,
k4=h·((0 + h)2(1 + k3)) = 0.0845569.
Step 4: Compute the final approximation.
y(0.4) 1 + 1
6(k1+ 2k2+ 2k3+k4)
= 1 + 1
6(0.12(0.09475) 2(0.0895075) 0.0845569)
= 1 0.10.1895 0.179015 0.0845569
= 0.5469281.
Therefore, the approximation of y(0.4) using the classical fourth-order Runge-
Kutta method is 0.5469281.
Question 2
Question
Consider the initial value problem given by the differential equation y= 2x+y
with the initial condition y(0) = 1. Use the second-order Runge-Kutta method
to approximate y(0.2) using a step size of h= 0.1.
Solution
We will use the second-order Runge-Kutta method to approximate y(0.2) by
taking steps of size h= 0.1.
Given differential equation: y= 2x+yStep size: h= 0.1 Initial condition:
y(0) = 1
Step 1: Calculate k1and k2values using the Runge-Kutta formulas:
k1=h(2x0+y0) = 0.1 (2(0) + 1) = 0.1
k2=h2(x0+h
2)+(y0+k1
2)
= 0.12(0 + 0.1
2) + (1 + 0.1
2)
= 0.1(1.1) = 0.11
Step 2: Update the approximation using the weighted average of k1and k2:
y1=y0+k1+k2
2
= 1 + 0.1+0.11
2= 1.055
Therefore, the second-order Runge-Kutta approximation for y(0.2) using a
step size of h= 0.1 is y(0.2) 1.055.
2
Question 3
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 approx-
imate the solution of the differential equation at x= 0.4.
Solution
To apply the fourth-order Runge-Kutta method, we first need to set up the
following system of equations:
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 1: Evaluate k1, k2, k3, k4, and then find the new approximation yn+1
using the given initial condition y(0) = 1.
k1= 0.1·(02+ 1) = 0.1
k2= 0.1·0 + 1 + 0.1
2= 0.105
k3= 0.1·0 + 1 + 0.105
2= 0.11025
k4= 0.1·(0.1+1.0525) = 0.11525
y1= 1 + 1
6(0.1+2·0.105 + 2 ·0.11025 + 0.11525)
= 1.0551875
Therefore, the approximate solution of the differential equation at x= 0.1
is y(0.4) 1.0551875.
3
Question 4
Question
Consider the initial value problem:
dy
dx = 2xy, y(0) = 1.
Use the fourth-order Runge-Kutta method with step size 0.1 to approximate
the value of yat x= 0.4.
Solution
To solve this initial value problem using the fourth-order Runge-Kutta method,
we need to follow these steps:
Step 1: Define the function f(x, y) = 2xy.
Step 2: Initialize the values with x0= 0, y0= 1, and h= 0.1, where his
the step size.
Step 3: Calculate the next approximations:
k1=h·f(x0, y0)=0.1·(2(0) 1) = 0.1,
k2=h·f(x0+h
2, y0+k1
2)=0.1·f0 + 0.1
2,1 + 0.1
2= 0.1·f(0.05,0.95),
k3=h·f(x0+h
2, y0+k2
2)=0.1·f0 + 0.1
2,1 + k2
2,
k4=h·f(x0+h, y0+k3)=0.1·f(0.1,1 + k3).
Step 4: Update the values of xand y:
x1=x0+h= 0 + 0.1=0.1,
y1=y0+1
6(k1+ 2k2+ 2k3+k4).
Step 5: Repeat Steps 3 and 4 to find yat x= 0.4:
x2= 0.2, y2
x3= 0.3, y3
x4= 0.4, y4.
After performing the necessary calculations, the approximate value of yat
x= 0.4 obtained using the fourth-order Runge-Kutta method with step size 0.1
is the value of y4.
4
Question 5
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem dy
dt =t2y, y(0) = 1,
at t= 0.2 using a step size of h= 0.1.
Solution
Step 1: Define the increment function f(t, y) = t2y.
Step 2: Use the fourth-order Runge-Kutta method to compute the approxi-
mate value of yat t= 0.2. Let h= 0.1.
k1=h·f(0,1) = 0.1·(021) = 0.1,
k2=h·f(0 + 0.5h, 1+0.5k1)=0.1·(0.0520.1) 0.09975,
k3=h·f(0 + 0.5h, 1+0.5k2)=0.1·(0.0520.09975) 0.0995001,
k4=h·f(0 + h, 1 + k3)=0.1·(0.120.0995001) 0.00049999.
Step 3: Compute the new value of yusing the weighted average of the four
slopes:
y(0.1) 1 + 1
6(k1+ 2k2+ 2k3+k4)
1 + 1
6(0.1 + 2(0.09975) + 2(0.0995001) + 0.00049999)
0.98084.
Therefore, the approximate solution to the initial value problem at t= 0.2
is y(0.2) 0.98084.
Question 6
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem dy
dx =x2+y, y(0) = 1
over the interval [0,1] with a step size of h= 0.1.
5
Solution
We will use the fourth-order Runge-Kutta method to approximate the solution
to the given initial value problem.
Given the initial value problem:
dy
dx =x2+y, y(0) = 1
we can rewrite the equation in the form y=f(x, y) as follows:
y=x2+y
Using the fourth-order Runge-Kutta method with step size h= 0.1, we will
find the approximate values of yat x= 0.1,0.2, ..., 1.
Step 1: Calculate y1using the formula:
k1=hf(xn, yn)=0.1·f(0,1) = 0.1·(02+ 1) = 0.1
k2=hf(xn+h
2, yn+k1
2)=0.1·f(0.05,1+0.05·0.1/2) = 0.1·(0.052+1+0.05·0.1/2) 0.1025
k3=hf(xn+h
2, yn+k2
2)=0.1·f(0.05,1+0.05·0.1025/2) = 0.1·(0.052+1+0.1025·0.1/2) 0.1051
k4=hf(xn+h, yn+k3)=0.1·f(0.1,1+0.1051) = 0.1·(0.12+1.1051) 0.1151
y1=y0+1
6(k1+2k2+2k3+k4) = 1+ 1
6(0.1+2·0.1025+2·0.1051+0.1151) 1.0939
Now we repeat the process at x= 0.2.
Step 2: Calculate y2using the formula: Repeat the above process with
x= 0.2.
Continue this process until x= 1 to find the approximate values of yat
x= 0.1,0.2, ..., 1.
Question 7
Question
Consider the initial value problem
dy
dx =x2y, y(0) = 1.
Use the fourth-order Runge-Kutta method to approximate the value of y(0.1)
with step size h= 0.05.
6
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: Calculate the intermediate values using the given formula.
k1= 0.05(021) = 0.05,
k2= 0.05 0 + 0.05(0.05)
2=0.049375,
k3= 0.05 0 + 0.049375
2=0.04881875,
k4= 0.05(0.0521 + 0.04881875) = 0.02390078125.
Step 2: Compute the new value of y.
yn+1 = 1 + 1
6(0.05 + 2(0.049375) + 2(0.04881875) 0.02390078125)
= 1 0.02448976042
= 0.9755102396.
Therefore, the approximate value of y(0.1) using the fourth-order Runge-
Kutta method with step size 0.05 is y(0.1) 0.9755.
Question 8
Question
Consider the initial value problem dy
dx =x2+y2,y(0) = 1. Use the fourth-order
Runge-Kutta method to estimate y(1) with a step size of h= 0.1.
Solution
Step 1: Define the function f(x, y) = x2+y2.
Step 2: Using the fourth-order Runge-Kutta method, we can calculate the
next approximation yi+1 based on the current approximation yiusing the for-
mula:
k1=h·f(xi, yi)
7
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)
Step 3: Calculate the values of y1using the above formula and iterate until
x= 1.
Let’s proceed with the calculations:
k1= 0.1·(02+ 12)=0.1
k2= 0.1·0 + 0.1
22
+1 + 0.1
22
= 0.10125
k3= 0.1·0 + 0.1
22
+1 + 0.10125
22
= 0.1025040625
k4= 0.1·(0 + 0.1)2+ (1 + 0.1025040625)2= 0.103765923
y1= 1 + 1
6(0.1 + 2(0.10125) + 2(0.1025040625) + 0.103765923)
y1= 1.105366903
Therefore, the estimate of y(1) using the fourth-order Runge-Kutta method
with a step size of h= 0.1 is approximately 1.1054.
Question 9
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem: dy
dx =x2y, y(0) = 1
Find an approximation to y(0.2) using a step size of h= 0.1.
8
Solution
Step 1: Define the function f(x, y) based on the given initial value problem.
f(x, y) = x2y
Step 2: Implement the fourth-order Runge-Kutta method with the given
step size h= 0.1 until x= 0.2.
k1=hf(xn, yn)=0.1·f(0,1) = 0.1·(021) = 0.1
k2=hf(xn+h
2, yn+k1
2)=0.1·f0 + 0.1
2,1 + 0.1
2= 0.1·f(0.05,0.9)
= 0.1·(0.0520.9) = 0.09475
k3=hf(xn+h
2, yn+k2
2)=0.1·f0 + 0.1
2,1 + 0.09475
2= 0.1·f(0.05,0.852625)
= 0.1·(0.0520.852625) = 0.09062875
k4=hf(xn+h, yn+k3)=0.1·f(0 + 0.1,1+(0.09062875)) = 0.1·f(0.1,0.90937125)
= 0.1·(0.120.90937125) = 0.087312875
Now, find ynat x= 0.2:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 3: Calculate y(0.2) using the values of k1,k2,k3, and k4calculated
above.
yn+1 = 1 + 1
6(0.1 + 2(0.09475) + 2(0.09062875) 0.087312875)
= 1 + 0.5(0.09475 0.1812575) = 1 + 0.5(0.2760075) = 1 0.13800375
= 0.86199625
Therefore, the approximate solution to y(0.2) using the fourth-order Runge-
Kutta method with step size h= 0.1 is 0.862.
Question 10
Question
Consider the initial value problem given by the differential equation:
y=x2+y, y(0) = 1.
Approximate the value of y(0.1) using the fourth-order Runge-Kutta method
with a step size of h= 0.05.
9
Solution
Step 1: Define the increment functions 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).
Step 2: Compute the approximations Applying the Runge-Kutta formulas
with h= 0.05, we perform the following calculations:
k1= 0.05 (0)2+ 1= 0.05,
k2= 0.05 0 + 0.05
22
+ (1 + 0.05
2)!= 0.0525,
k3= 0.05 0 + 0.05
22
+ (1 + 0.0525
2)!= 0.0528125,
k4= 0.05 (0 + 0.05)2+ (1 + 0.0528125)= 0.0681219.
Step 3: Update the value of yFinally, we update the value of yusing the
formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Substitute the computed values into the formula to find y(0.1):
y(0.1) = 1 + 1
6(0.05 + 2 ·0.0525 + 2 ·0.0528125 + 0.0681219) 1.017333.
Therefore, the approximate value of y(0.1) using the fourth-order Runge-
Kutta method with a step size of h= 0.05 is y(0.1) 1.017333.
Question 11
Question
Use a fourth-order Runge-Kutta method to approximate the solution of the
initial value problem dy
dx =x2y, y(0) = 0
from x= 0 to x= 1 using a step size of h= 0.1.
10
Solution
The fourth-order Runge-Kutta method can be implemented as follows:
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) = x2y.
Step 1: First, calculate the values of k1,k2,k3, and k4at each step.
k1= 0.1·((0)20) = 0
k2= 0.1·(0 + 0.1
2)2(0 + 0
2)= 0.0005
k3= 0.1·(0 + 0.1
2)2(0 + 0.0005
2)= 0.00049975
k4= 0.1·0.12(0.00049975)= 0.00100025
Step 2: Next, calculate the value of yn+1.
yn+1 = 0 + 1
6(0 + 2(0.0005) + 2(0.00049975) + 0.00100025)
= 0.0002
Therefore, the approximate solution of the initial value problem at x= 1
using a step size of h= 0.1 is y(1) 0.0002.
Question 12
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem given by:
dy
dx =x2y, y(0) = 1
Evaluate y(0.1) using a step size of h= 0.1.
11
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) as x2y.
Step 2: Use the fourth-order Runge-Kutta 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).
Step 3: Update yn+1 using the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Step 4: Apply the above formulas iteratively to compute y(0.1).
By following these steps, we can approximate y(0.1) using the fourth-order
Runge-Kutta method.
Question 13
Question
Consider the initial value problem given by the differential equation:
y=2x
y, y(0) = 1
Use the fourth-order Runge-Kutta method to estimate the value of y(1) using
a step size of h= 0.1.
Solution
Let’s denote f(x, y) as f(x, y) = 2x
y. We will use the fourth-order Runge-Kutta
method with step size h= 0.1 to estimate the value of y(1).
Step 1: Define the Runge-Kutta 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)
12
Step 2: Calculate the approximate value of yat xn+1 =xn+h:
yn+1 =yn+1
6(k1+2k2+2k3 + k4)
Step 3: Substitute the given values into the formulas and calculate y(1)
using the fourth-order Runge-Kutta method:
k1=0.1·2·0
1= 0
k2=0.1·2·(0 + 0.05)
1= 0.1
k3=0.1·2·(0 + 0.05)
1= 0.1
k4=0.1·2·0.1
1= 0.02
y1= 1 + 1
6(0 + 2 ·0.1+2·0.1+0.02) = 1.0533
Therefore, the estimated value of y(1) using the fourth-order Runge-Kutta
method with a step size of h= 0.1 is approximately 1.0533.
Question 14
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem with step size h= 0.1:
dy
dx =x2+y, y(0) = 1
Solution
Step 1: Define the function f(x, y) = x2+yand the step size h= 0.1.
Step 2: Initialize x0= 0, y0= 1, and define the number of steps n= 5 (as
we are given h= 0.1).
Step 3: Implement the fourth-order Runge-Kutta method to approximate
yi+1 for i= 0,1,2,3,4:
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).
13
Step 4: Calculate yi+1 for each step i= 0,1,2,3,4.
Step 5: Tabulate the results:
i xiyiyi+1
0 0 1 0.5073
1 0.10.5073 0.7575
2 0.20.7575 0.9019
3 0.30.9019 0.9830
4 0.40.9830 1.0324
Therefore, the fourth-order Runge-Kutta method approximates the solution
at x= 0.4 to be y(0.4) 1.0324.
Note: This process can be repeated with smaller step sizes for increased
accuracy.
Question 15
Question
Consider the initial value problem given by the differential equation y= 2yx
with the initial condition 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 approximate the value of y(0.1) using the fourth-order Runge-Kutta method
with step size h= 0.05, we will follow these steps:
Step 1: Define the function f(x, y) = 2yx.
Step 2: Define the initial condition y0= 1 and the step size h= 0.05.
Step 3: Apply the fourth-order Runge-Kutta method iteratively:
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 xnand ynare the current values of xand y, respectively.
Step 4: Perform the iterative calculations:
14
n= 0:
k1= 0.05f(0,1) = 0.05(2(1) 0) = 0.1
k2= 0.05f0 + 0.05
2,1 + 0.1
2= 0.05(2(1 + 0.05/2) 0.025) = 0.10125
k3= 0.05f0 + 0.05
2,1 + 0.10125
2= 0.05(2(1 + 0.10125/2) 0.025) = 0.10200625
k4= 0.05f(0 + 0.05,1+0.10200625) = 0.05(2(1 + 0.10200625) 0.05) = 0.10402501
y1= 1 + 1
6(0.1 + 2(0.10125) + 2(0.10200625) + 0.10402501) = 1.10800520833
Therefore, using the fourth-order Runge-Kutta method, the approximate
value of y(0.1) is y11.108.
Question 16
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem: dy
dx =x2+y, y(0) = 1
over the interval [0, 1] using a step size of 0.2.
Solution
Step 1: Define the function f(x, y) = x2+y.
Step 2: Calculate the increments k1,k2,k3, and k4using the formulas:
k1=f(xi, yi),
k2=f(xi+h
2, yi+h
2k1),
k3=f(xi+h
2, yi+h
2k2),
k4=f(xi+h, yi+hk3),
where h= 0.2, xi= 0, and yi= 1.
Step 3: Update the values of xand yusing the formula:
yi+1 =yi+h
6(k1+ 2k2+ 2k3+k4).
Step 4: Repeat the process for each iteration until x= 1.
Step 5: The approximated solution at x= 1 is the final value of y.
15
Question 17
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem:
(y= 2y2x
y(0) = 1
on the interval [0,0.4] with a step size of h= 0.1.
Solution
Step 1: Define the function f(x, y) = 2y2xand the step size h= 0.1.
Step 2: Initialize x0= 0 and y0= 1.
Step 3: Calculate the approximations using the fourth-order Runge-Kutta
method:
k1=h·f(x0, y0)=0.1·(2 ·12·0) = 0.2
k2=h·f(x0+h
2, y0+k1
2)=0.1·f(0.05,1+0.1·0.2
2)=0.1·f(0.05,1.01) = 0.1·(2 ·1.01 0.1) = 0.2002
k3=h·f(x0+h
2, y0+k2
2)=0.1·f(0.05,1+0.1·0.2002
2)=0.1·f(0.05,1.01 + 0.01001) = 0.1·(2 ·1.0201 0.1) = 0.20198
k4=h·f(x0+h, y0+k3)=0.1·f(0.1,1+0.20198) = 0.1·f(0.1,1.20198) = 0.1·(2 ·1.20198 0.2) = 0.240396
y1=y0+1
6(k1+ 2k2+ 2k3+k4) = 1 + 1
6(0.2 + 2(0.2002) + 2(0.20198) + 0.240396) 1.02379
Therefore, the approximation of yat x= 0.1 is y11.02379.
Repeat the above steps to find the approximations at x= 0.2, x= 0.3, and
x= 0.4 to complete the solution.
Question 18
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem
(y=yt2+ 1
y(0) = 0
over the interval 0 t1 using four equally spaced steps.
16
Solution
The fourth-order Runge-Kutta method is given by the following formula:
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),
where his the step size given by 10
4= 0.25.
Step 1: Initialize the values with t0= 0 and y0= 0.
Step 2: Calculate k1,k2,k3, and k4using the given formula.
k1= 0.25(0 02+ 1) = 0.25,
k2= 0.25(0.25 (0 + 0.0625) + 1) = 0.25(1.1875) = 0.296875,
k3= 0.25(0.25 (0 + 0.1484375) + 1) = 0.25(1.1015625) = 0.275390625,
k4= 0.25(0.5(0 + 0.1376953125) + 1) = 0.25(1.362304687) = 0.3405761719.
Step 3: Calculate the next approximation value using the formula yn+1 =
yn+1
6(k1+ 2k2+ 2k3+k4).
y1= 0 + 1
6(0.25 + 2(0.296875) + 2(0.275390625) + 0.3405761719)
= 0 + 0.5830078125
= 0.5830078125.
Therefore, the approximation of the solution at t= 0.25 is y(0.25)
0.5830078125.
Question 19
Question
Consider the initial value problem for a first-order ordinary differential equation:
dy
dx =x2y, y(0) = 1.
Apply the classical fourth-order Runge-Kutta method to approximate y(0.1)
using a step size of h= 0.1.
17
Solution
Step 1: Define the Runge-Kutta method. We have the following equations:
k1=hf(xn, yn)
k2=hf(xn+ 0.5h, yn+ 0.5k1)
k3=hf(xn+ 0.5h, yn+ 0.5k2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 2: Calculate the values of k: With f(x, y) = x2y, we have
k1= 0.1×(021) = 0.1,
k2= 0.1×(0.0520.9) = 0.09625,
k3= 0.1×(0.0520.9) = 0.09625,
k4= 0.1×(0.120.904375) 0.0905625.
Step 3: Update y:
y(0.1) 1 + 1
6(0.1 + 2(0.09625) + 2(0.09625) 0.0905625)
0.90229.
Therefore, the approximate value of y(0.1) using the classical fourth-order
Runge-Kutta method with h= 0.1 is 0.90229.
Question 20
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,1] with 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 differential equation and the initial condition.
The given initial value problem is:
dy
dx =x2+y, y(0) = 1
18
Step 2: Determine the step size h.
Given that the interval is [0,1] and the step size is h= 0.2, we have n=10
0.2= 5
subintervals.
Step 3: Set up the fourth-order Runge-Kutta formulas.
The fourth-order Runge-Kutta formulas are given by:
k1=h·f(xn, yn),
k2=h·fxn+h
2, yn+k1
2,
k3=h·fxn+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 4: Perform the iterations using the Runge-Kutta method.
Let’s perform the iterations:
n xnynk1k2k3
k4yn+1
0 0 1 ...
. .
1 0.2. . . .
. .
2 0.4. . . .
. .
3 0.6. . . .
. .
4 0.8. . . .
. .
5 1 . . . .
. .
Step 5: Calculate the approximate solution.
Now, we substitute the values of xn,yn,k1,k2,k3, and k4into the formulas to
calculate yn+1 at each step.
After performing the calculations, we find the approximate solution for y(1)
using the fourth-order Runge-Kutta method with the given step size.
Therefore, the approximate solution of the initial value problem dy
dx =x2+
y, y(0) = 1 at x= 1 is ... (fill in the final value after completing the calculations).
19
Question 21
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.
Solution
To approximate the value of y(1) using the fourth-order Runge-Kutta method,
we will follow these steps: Let h= 0.2, x0= 0, and y0= 1.
Step 1: Calculate k1,k2,k3, and k4according to the fourth-order Runge-
Kutta method:
k1=hf(x0, y0) = 0.2(02+ 1) = 0.2,
k2=hf x0+h
2, y0+k1
2= 0.2 0
22
+1
2!= 0.1,
k3=hf x0+h
2, y0+k2
2= 0.2 0
22
+1
2!= 0.1,
k4=hf(x0+h, y0+k3) = 0.212+ 1 + 0.1= 0.42.
Step 2: Calculate the next approximation y1using the formula:
y1=y0+1
6(k1+ 2k2+ 2k3+k4).
Substitute the values of k1,k2,k3, and k4to find y1:
y1= 1 + 1
6(0.2 + 2(0.1) + 2(0.1) + 0.42) = 1 + 1
6(0.2 + 0.2 + 0.2 + 0.42) = 1.1183.
Therefore, the approximate value of y(1) using the fourth-order Runge-Kutta
method with a step size of h= 0.2 is y(1) 1.1183.
Question 22
Question
Consider the initial value problem:
dy
dx =x2+y2, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate y(1) with a step size
of h= 0.1.
20
Solution
Step 1: We start by setting up the fourth-order Runge-Kutta method, which 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)
Step 2: We apply the method to approximate the value of y(1):
k1= 0.1(02+ 12) = 0.1
k2= 0.1 0
22
+1 + 0.1
22!= 0.1025
k3= 0.1 0
22
+1 + 0.1025
22!0.1049
k4= 0.1 (1 + 0.1049)20.2233
y11 + 1
6(0.1 + 2(0.1025) + 2(0.1049) + 0.2233) 1.1256
Therefore, the approximate value of y(1) using the fourth-order Runge-Kutta
method with a step size of h= 0.1 is y(1) 1.1256.
Question 23
Question
Consider the initial value problem given by the differential equation dy
dx =x2+y2
with the initial condition y(0) = 1. Use the 4th-order Runge-Kutta method to
approximate the value of yat x= 1 using a step size of x= 0.2.
Solution
Step 1: Define the increment function f(x, y) = x2+y2.
Step 2: Calculate the values of yat each step using the 4th-order Runge-
21
Kutta method:
k1= x·f(x, y)=0.2·(02+ 12)=0.2
k2= x·f(x+1
2x, y +1
2k1)=0.2·(0.12+ 1.12)=0.242
k3= x·f(x+1
2x, y +1
2k2)=0.2·(0.12+ 1.212)=0.2862
k4= x·f(x+ x, y +k3)=0.2·(0.22+ 1.38842)=0.332288
y(x+ x) = y+1
6(k1+ 2k2+ 2k3+k4) = 1 + 1
6(0.2+2×0.242 + 2 ×0.2862 + 0.332288) = 1.190474
Therefore, the approximate value of yat x= 1 using the 4th-order Runge-
Kutta method with a step size of x= 0.2 is 1.190474.
Question 24
Question
Consider the initial value problem:
dy
dx =x2y, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate y(1) with a step size
of h= 0.2. Show all your computations up to the required number of decimal
places.
Solution
To approximate y(1) using the fourth-order Runge-Kutta method, we first need
to compute the values of yat each step using the following formula:
k1=h·f(xn, yn)
k2=h·f(xn+ 0.5h, yn+ 0.5k1)
k3=h·f(xn+ 0.5h, yn+ 0.5k2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where f(x, y) = x2y.
Step 1: Calculate yat each step using the Runge-Kutta method.
k1= 0.2[(0)21] = 0.2
k2= 0.2[(0.2)2(1 + 0.1(0.2))] = 0.185
k3= 0.2[(0.2)2(1 + 0.1(0.185))] = 0.1711
k4= 0.2[(0.4)2(1 + 0.1(0.1711))] = 0.1572
y1= 1 + 1
6(0.2 + 2(0.185) + 2(0.1711) 0.1572) 0.8569
22
Step 2: Repeat the process until x= 1.
At x= 0.2, y10.8569
At x= 0.4, y20.7286
At x= 0.6, y30.6074
At x= 0.8, y40.4920
At x= 1.0, y(1) 0.3822
Therefore, the fourth-order Runge-Kutta method gives the approximate
value of y(1) as 0.3822.
Question 25
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
estimate the value of yat x= 0.1. Use a step size of h= 0.05.
Solution
The fourth-order Runge-Kutta method uses the following formulas to approxi-
mate the next value of y:
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+yand (xn, yn) are the previous values.
Step 1: Initialize the values.
Using the initial condition y(0) = 1 and h= 0.05, we have x0= 0, y0= 1.
Step 2: Compute k1, k2, k3, k4.
k1= 0.05 ·f(0,1) = 0.05 ·(02+ 1) = 0.05
k2= 0.05 ·f(0 + 0.025,1+0.025 ·0.5) = 0.05 ·(0.0252+ 1.0125) = 0.05125
k3= 0.05 ·f(0 + 0.025,1+0.025 ·0.5125) = 0.05 ·(0.0252+ 1.025625) = 0.05128125
k4= 0.05 ·f(0 + 0.05,1+0.05128125) = 0.05 ·(0.052+ 1.05128125) = 0.05134641
23
Step 3: Compute y1
y1= 1 + 1
6(0.05 + 2 ·0.05125 + 2 ·0.05128125 + 0.05134641)
= 1 + 1
6(0.05 + 0.1025 + 0.1025625 + 0.05134641)
= 1 + 1
6(0.30640991)
= 1.05106832
Therefore, the estimated value of yat x= 0.1 using the fourth-order Runge-
Kutta method with a step size of 0.05 is approximately 1.0511.
Question 26
Question
Consider the following initial value problem:
dy
dx =x2+y, y(0) = 1
Apply the fourth-order Runge-Kutta method to estimate y(1) using a step
size of h= 0.2.
Solution
Step 1: Define the function f(x, y) = x2+y.
Step 2: Calculate the approximations using the fourth-order Runge-Kutta
method:
k1=h·f(0,1) = 0.2·(02+ 1) = 0.2
k2=h·f(0 + h
2,1 + k1
2)=0.2·(0.12+ 1 + 0.1·0.2/2) = 0.227
k3=h·f(0 + h
2,1 + k2
2)=0.2·(0.12+ 1 + 0.227 ·0.2/2) = 0.254
k4=h·f(0 + h, 1 + k3)=0.2·(0.22+ 1 + 0.254) = 0.314
Step 3: Compute the next approximation using the weighted average of k1,
k2,k3, and k4:
y(0.2) = 1 + 1
6(0.2+2·0.227 + 2 ·0.254 + 0.314)
= 1 + 1
6(0.2+0.454 + 0.508 + 0.314)
= 1 + 1
6(1.476)
1.246
24
Therefore, the estimated value of y(1) using the fourth-order Runge-Kutta
method with a step size of 0.2 is approximately 1.246.
Question 27
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, 1] with a step size of 0.1.
Solution
To apply the fourth-order Runge-Kutta method, we will use the following for-
mulas: 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+y,h= 0.1, and x0= 0, y0= 1.
Step 1: First, we calculate k1, k2, k3,and k4at each step.
k1= 0.1×(02+ 1) = 0.1,
k2= 0.1×0 + 0.1
22
+ (1 + 0.1
2) = 0.10525,
k3= 0.1×0 + 0.1
22
+ (1 + 0.10525
2)=0.11061,
k4= 0.1×(0 + 0.1)2+ (1 + 0.11061) = 0.12161.
Step 2: Using the values of k1, k2, k3,and k4, we can calculate the next
value of y
y1= 1 + 1
6(0.1+2×0.10525 + 2 ×0.11061 + 0.12161)
= 1.1139.
Therefore, the approximate solution of the initial value problem at x= 0.1
is y1.1139.
25
Question 28
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem: dy
dx =exy, y(0) = 1
over the interval [0,1]. Use a step size of h= 0.2.
Solution
Let’s denote f(x, y) = exyand h= 0.2. We will use the fourth-order
Runge-Kutta method to approximate the solution.
Step 1: Initialize variables and set up the iteration.
Given that y(0) = 1 and h= 0.2, we have:
x0= 0, y0= 1, h = 0.2
Now, the iteration for 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)
Step 2: Perform the iteration.
We will perform the iteration for the given initial value problem over the
interval [0,1] with step size h= 0.2.
Iteration 1 (n= 0):
k1= 0.2[f(0,1)] = 0.2(e01) = 0.2,
k2= 0.2[f(0.1,1+0.1/2)] = 0.2(e0.11.05) 0.020184,
k3= 0.2[f(0.1,10.020184/2)] = 0.2(e0.11.030092) 0.045624,
k4= 0.2[f(0.2,10.045624)] = 0.2(e0.21.045624) 0.22046,
y1= 1 + 1
6(0.2 + 2(0.020184) + 2(0.045624) 0.22046) 0.904429
26
Iteration 2 (n= 1):
k1= 0.2[f(0.2,0.904429)] 0.2(e0.20.904429) 0.235155,
k2= 0.2[f(0.3,0.904429 0.235155/2)] 0.2(e0.30.8213525) 0.315559,
k3= 0.2[f(0.3,0.904429 0.315559/2)] 0.2(e0.30.771670) 0.365248,
k4= 0.2[f(0.4,0.904429 0.365248)] 0.2(e0.40.739180) 0.430985,
y2= 0.904429 + 1
6(0.235155 + 2(0.315559) + 2(0.365248) 0.430985) 0.796036
Continue this process until x= 1 to generate more iterations and approxi-
mate the solution.
Question 29
Question
Consider the initial value problem:
dy
dx =x2y, y(0) = 1.
Use the fourth-order Runge-Kutta method with step size h= 0.1 to approximate
y(0.4).
Solution
To apply the fourth-order Runge-Kutta method to approximate y(0.4), we first
need to compute the intermediate values of yat each step.
Step 1: Calculate k1, k2, k3, k4at each step using the formula:
k1=h·f(xn, yn),
k2=h·fxn+h
2, yn+k1
2,
k3=h·fxn+h
2, yn+k2
2,
k4=h·f(xn+h, yn+k3),
where f(x, y) = x2y.
Step 2: Update yusing the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Let’s start the computations:
27
Step 1:
k1= 0.1·(021) = 0.1,
k2= 0.1·0 + 0.1
21 + 0.1
2=0.09575,
k3= 0.1·0 + 0.1
21 + 0.09575
2=0.09158,
k4= 0.1·(0 + 0.11+(0.09158)) = 0.081842.
Step 2:
y1= 1 + 1
6(0.1 + 2(0.09575) + 2(0.09158) 0.081842)
= 0.970624.
Therefore, using the fourth-order Runge-Kutta method with step size h=
0.1, the approximate value of y(0.4) is 0.970624.
Question 30
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem
y= 2yx2+ 1, y(0) = 0
at x= 0.1. Perform four iterations with a step size of h= 0.025.
Solution
Given the initial value problem, we will use the fourth-order Runge-Kutta
method to approximate the solution at x= 0.1 with a step size of h= 0.025.
The general formula for the fourth-order Runge-Kutta method is:
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 k1, k2, k3, k4,and yn+1 for the first iteration:
k1= 0.025 ·f(0,0) = 0.025(2 ·002+ 1) = 0.025,
28
k2= 0.025 ·f(0.0125,0.0125) = 0.025(2 ·0.0125 0.01252+ 1) = 0.02621875,
k3= 0.025·f(0.0125,0.01260937) = 0.025(2·0.012609370.01252+1) = 0.02618312,
k4= 0.025·f(0.025,0.01279281) = 0.025(2·0.012792810.0252+1) = 0.02719776,
y1= 0 + 1
6(0.025 + 2(0.02621875) + 2(0.02618312) + 0.02719776)0.01283281.
Step 2: Repeat the process for the next three iterations to find y2, y3, and
y4:
y20.02856707, y30.04676670, y40.06957946.
Therefore, using the fourth-order Runge-Kutta method, the approximate
solution of the initial value problem at x= 0.1 is y(0.1)0.06957946.
Question 31
Question
Consider the initial value problem for a first-order ordinary differential equation
given by:
y=ey, y(0) = 1
Use the classical fourth-order Runge-Kutta method with step size h= 1 to
estimate y(4).
Solution
Step 1: We will first compute the values of yat each step using the classical
fourth-order Runge-Kutta method:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)h
where
k1=f(xn, yn) = eyn
k2=f(xn+h
2, yn+1
2k1h) = e(yn+1
2k1h)
k3=f(xn+h
2, yn+1
2k2h) = e(yn+1
2k2h)
k4=f(xn+h, yn+k3h) = e(yn+k3h)
Step 2: Using the initial condition y(0) = 1, we start with x0= 0 and y0= 1.
Then we calculate:
k1=e1=e
k2=e(1+ 1
2e)e1.5e
k3=e(1+ 1
2e1.5e)e1.25e2
29
k4=e(1+e1.25e2)
Step 3: Now plug k1, k2, k3, k4back into the Runge-Kutta formula to find
y1:
y11 + 1
6(e+ 2e1.5e+ 2e1.25e2+e1+e1.25e2
)
Step 4: Repeat Steps 2 and 3 with new values of k1, k2, k3, k4to find y2, y3,
and y4.
Step 5: Finally, calculate y(4) y4.
Question 32
Question
Consider the initial value problem:
dy
dx =x2+y, y(0) = 1.
Use the fourth-order Runge-Kutta method to estimate y(0.2) using a step size
of h= 0.1.
Solution
To estimate y(0.2) using the fourth-order Runge-Kutta method, we will compute
the values of yat various points between x= 0 and x= 0.2 with a step size of
h= 0.1.
Given the initial value problem:
dy
dx =x2+y, y(0) = 1,
we can define:
f(x, y) = x2+y.
Step 1: Calculate the values of yat each step using the Runge-Kutta
method.
Step 2: With h= 0.1 and x0= 0, we have:
k1=h·f(0,1) = 0.1·(02+ 1) = 0.1,
k2=h·f(0 + 0.5h, 1+0.5k1)=0.1·(0.052+ 1 + 0.5·0.1) = 0.1025,
k3=h·f(0 + 0.5h, 1+0.5k2)=0.1·(0.052+ 1 + 0.5·0.1025) 0.105125,
k4=h·f(0 + h, 1 + k3)=0.1·(0.12+ 1 + 0.105125) 0.1105125.
30
Step 3: Compute the value of yat x= 0.1:
y(0.1) 1 + 1
6(k1+ 2k2+ 2k3+k4)
= 1 + 1
6(0.1+2·0.1025 + 2 ·0.105125 + 0.1105125)
1 + 1
6(0.1+0.205 + 0.21025 + 0.1105125)
1 + 1
6(0.6257625)
1.104294167.
Therefore, the estimate of y(0.2) using the fourth-order Runge-Kutta method
with a step size of h= 0.1 is approximately 1.104294167.
Question 33
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem y= 2xy2,y(0) = 1 at x= 0.2. Use a step size of h= 0.1.
Solution
Step 1: Define the function f(x, y) = 2xy2and the step size h= 0.1.
Step 2: Using the fourth-order Runge-Kutta method, we can iterate through
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.
Step 3: Start with the initial condition y0= 1 at x0= 0 and compute the
approximations for x= 0.1,0.2 using the Runge-Kutta method.
31
Step 4:
k1= 0.1×2×0×12= 0
k2= 0.1×2×0 + 0
22
= 0
k3= 0.1×2×0 + 0
22
= 0
k4= 0.1×2×(0 + 0) = 0
Step 5: Using the above values of k1, k2, k3, k4, we have:
y1= 1 + 1
6(0 + 2(0) + 2(0) + 0) = 1
Therefore, the approximation of the solution at x= 0.2 using the fourth-
order Runge-Kutta method with a step size of h= 0.1 is y(0.2) 1.
Question 34
Question
Consider the initial value problem y=x2+y,y(0) = 1, and suppose we want
to approximate y(0.2) using the second-order Runge-Kutta method with one
step. Given y0= 1, h= 0.2, and the Runge-Kutta formula:
yn+1 =yn+h
2(k1+k2)
where
k1=f(xn, yn), k2=f(xn+h, yn+hk1)
Determine the approximation using the Runge-Kutta method.
Solution
Step 1: Calculate k1and k2Given f(x, y) = x2+y, we have:
k1=f(x0, y0) = x2
0+y0= 02+ 1 = 1
To find k2, we need to evaluate x1=x0+hand y1=y0+hk1. Using h= 0.2,
we get:
x1= 0 + 0.2=0.2
y1= 1 + 0.2(1) = 1.2
Now, plug these values into f(x, y):
k2=f(x0+h, y0+hk1) = (0.2)2+ 1.2=1.24
32
Step 2: Calculate the approximation using the Runge-Kutta method Now
we can use the Runge-Kutta formula to approximate the solution:
y1=y0+h
2(k1+k2) = 1 + 0.2
2(1 + 1.24) = 1 + 0.1(2.24) = 1.224
Therefore, the approximation of y(0.2) using the second-order Runge-Kutta
method with one step is y(0.2) 1.224.
Question 35
Question
Consider the initial value problem:
(y= 2xy,
y(0) = 1.
Use the fourth-order Runge-Kutta method with step size h= 0.1 to approximate
the value of y(0.2).
Solution
Step 1: We will use the fourth-order Runge-Kutta method to approximate the
value of y(0.2). 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 2: First, we need to evaluate the values of k1, k2, k3, k4. Let f(x, y) =
2xy. Using the given initial condition y(0) = 1, we have y0= 1. Now, we can
calculate as follows:
k1= 0.1×2×0×1=0,
k2= 0.1×2×0 + 0
2×(1 + 0
2) = 0,
k3= 0.1×2×0 + 0
2×(1 + 0
2) = 0,
k4= 0.1×2×0.1×1=0.02.
33
Step 4: Compute the final approximation.
y(0.4) 1 + 1
6(k1+ 2k2+ 2k3+k4)
= 1 + 1
6(0.12(0.09475) 2(0.0895075) 0.0845569)
= 1 0.10.1895 0.179015 0.0845569
= 0.5469281.
Therefore, the approximation of y(0.4) using the classical fourth-order Runge-
Kutta method is 0.5469281.
Question 2
Question
Consider the initial value problem given by the differential equation y= 2x+y
with the initial condition y(0) = 1. Use the second-order Runge-Kutta method
to approximate y(0.2) using a step size of h= 0.1.
Solution
We will use the second-order Runge-Kutta method to approximate y(0.2) by
taking steps of size h= 0.1.
Given differential equation: y= 2x+yStep size: h= 0.1 Initial condition:
y(0) = 1
Step 1: Calculate k1and k2values using the Runge-Kutta formulas:
k1=h(2x0+y0) = 0.1 (2(0) + 1) = 0.1
k2=h2(x0+h
2)+(y0+k1
2)
= 0.12(0 + 0.1
2) + (1 + 0.1
2)
= 0.1(1.1) = 0.11
Step 2: Update the approximation using the weighted average of k1and k2:
y1=y0+k1+k2
2
= 1 + 0.1+0.11
2= 1.055
Therefore, the second-order Runge-Kutta approximation for y(0.2) using a
step size of h= 0.1 is y(0.2) 1.055.
2
Question 3
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 approx-
imate the solution of the differential equation at x= 0.4.
Solution
To apply the fourth-order Runge-Kutta method, we first need to set up the
following system of equations:
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 1: Evaluate k1, k2, k3, k4, and then find the new approximation yn+1
using the given initial condition y(0) = 1.
k1= 0.1·(02+ 1) = 0.1
k2= 0.1·0 + 1 + 0.1
2= 0.105
k3= 0.1·0 + 1 + 0.105
2= 0.11025
k4= 0.1·(0.1+1.0525) = 0.11525
y1= 1 + 1
6(0.1+2·0.105 + 2 ·0.11025 + 0.11525)
= 1.0551875
Therefore, the approximate solution of the differential equation at x= 0.1
is y(0.4) 1.0551875.
3
Question 4
Question
Consider the initial value problem:
dy
dx = 2xy, y(0) = 1.
Use the fourth-order Runge-Kutta method with step size 0.1 to approximate
the value of yat x= 0.4.
Solution
To solve this initial value problem using the fourth-order Runge-Kutta method,
we need to follow these steps:
Step 1: Define the function f(x, y) = 2xy.
Step 2: Initialize the values with x0= 0, y0= 1, and h= 0.1, where his
the step size.
Step 3: Calculate the next approximations:
k1=h·f(x0, y0)=0.1·(2(0) 1) = 0.1,
k2=h·f(x0+h
2, y0+k1
2)=0.1·f0 + 0.1
2,1 + 0.1
2= 0.1·f(0.05,0.95),
k3=h·f(x0+h
2, y0+k2
2)=0.1·f0 + 0.1
2,1 + k2
2,
k4=h·f(x0+h, y0+k3)=0.1·f(0.1,1 + k3).
Step 4: Update the values of xand y:
x1=x0+h= 0 + 0.1=0.1,
y1=y0+1
6(k1+ 2k2+ 2k3+k4).
Step 5: Repeat Steps 3 and 4 to find yat x= 0.4:
x2= 0.2, y2
x3= 0.3, y3
x4= 0.4, y4.
After performing the necessary calculations, the approximate value of yat
x= 0.4 obtained using the fourth-order Runge-Kutta method with step size 0.1
is the value of y4.
4
Question 5
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem dy
dt =t2y, y(0) = 1,
at t= 0.2 using a step size of h= 0.1.
Solution
Step 1: Define the increment function f(t, y) = t2y.
Step 2: Use the fourth-order Runge-Kutta method to compute the approxi-
mate value of yat t= 0.2. Let h= 0.1.
k1=h·f(0,1) = 0.1·(021) = 0.1,
k2=h·f(0 + 0.5h, 1+0.5k1)=0.1·(0.0520.1) 0.09975,
k3=h·f(0 + 0.5h, 1+0.5k2)=0.1·(0.0520.09975) 0.0995001,
k4=h·f(0 + h, 1 + k3)=0.1·(0.120.0995001) 0.00049999.
Step 3: Compute the new value of yusing the weighted average of the four
slopes:
y(0.1) 1 + 1
6(k1+ 2k2+ 2k3+k4)
1 + 1
6(0.1 + 2(0.09975) + 2(0.0995001) + 0.00049999)
0.98084.
Therefore, the approximate solution to the initial value problem at t= 0.2
is y(0.2) 0.98084.
Question 6
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem dy
dx =x2+y, y(0) = 1
over the interval [0,1] with a step size of h= 0.1.
5
Solution
We will use the fourth-order Runge-Kutta method to approximate the solution
to the given initial value problem.
Given the initial value problem:
dy
dx =x2+y, y(0) = 1
we can rewrite the equation in the form y=f(x, y) as follows:
y=x2+y
Using the fourth-order Runge-Kutta method with step size h= 0.1, we will
find the approximate values of yat x= 0.1,0.2, ..., 1.
Step 1: Calculate y1using the formula:
k1=hf(xn, yn)=0.1·f(0,1) = 0.1·(02+ 1) = 0.1
k2=hf(xn+h
2, yn+k1
2)=0.1·f(0.05,1+0.05·0.1/2) = 0.1·(0.052+1+0.05·0.1/2) 0.1025
k3=hf(xn+h
2, yn+k2
2)=0.1·f(0.05,1+0.05·0.1025/2) = 0.1·(0.052+1+0.1025·0.1/2) 0.1051
k4=hf(xn+h, yn+k3)=0.1·f(0.1,1+0.1051) = 0.1·(0.12+1.1051) 0.1151
y1=y0+1
6(k1+2k2+2k3+k4) = 1+ 1
6(0.1+2·0.1025+2·0.1051+0.1151) 1.0939
Now we repeat the process at x= 0.2.
Step 2: Calculate y2using the formula: Repeat the above process with
x= 0.2.
Continue this process until x= 1 to find the approximate values of yat
x= 0.1,0.2, ..., 1.
Question 7
Question
Consider the initial value problem
dy
dx =x2y, y(0) = 1.
Use the fourth-order Runge-Kutta method to approximate the value of y(0.1)
with step size h= 0.05.
6
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: Calculate the intermediate values using the given formula.
k1= 0.05(021) = 0.05,
k2= 0.05 0 + 0.05(0.05)
2=0.049375,
k3= 0.05 0 + 0.049375
2=0.04881875,
k4= 0.05(0.0521 + 0.04881875) = 0.02390078125.
Step 2: Compute the new value of y.
yn+1 = 1 + 1
6(0.05 + 2(0.049375) + 2(0.04881875) 0.02390078125)
= 1 0.02448976042
= 0.9755102396.
Therefore, the approximate value of y(0.1) using the fourth-order Runge-
Kutta method with step size 0.05 is y(0.1) 0.9755.
Question 8
Question
Consider the initial value problem dy
dx =x2+y2,y(0) = 1. Use the fourth-order
Runge-Kutta method to estimate y(1) with a step size of h= 0.1.
Solution
Step 1: Define the function f(x, y) = x2+y2.
Step 2: Using the fourth-order Runge-Kutta method, we can calculate the
next approximation yi+1 based on the current approximation yiusing the for-
mula:
k1=h·f(xi, yi)
7
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)
Step 3: Calculate the values of y1using the above formula and iterate until
x= 1.
Let’s proceed with the calculations:
k1= 0.1·(02+ 12)=0.1
k2= 0.1·0 + 0.1
22
+1 + 0.1
22
= 0.10125
k3= 0.1·0 + 0.1
22
+1 + 0.10125
22
= 0.1025040625
k4= 0.1·(0 + 0.1)2+ (1 + 0.1025040625)2= 0.103765923
y1= 1 + 1
6(0.1 + 2(0.10125) + 2(0.1025040625) + 0.103765923)
y1= 1.105366903
Therefore, the estimate of y(1) using the fourth-order Runge-Kutta method
with a step size of h= 0.1 is approximately 1.1054.
Question 9
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem: dy
dx =x2y, y(0) = 1
Find an approximation to y(0.2) using a step size of h= 0.1.
8
Solution
Step 1: Define the function f(x, y) based on the given initial value problem.
f(x, y) = x2y
Step 2: Implement the fourth-order Runge-Kutta method with the given
step size h= 0.1 until x= 0.2.
k1=hf(xn, yn)=0.1·f(0,1) = 0.1·(021) = 0.1
k2=hf(xn+h
2, yn+k1
2)=0.1·f0 + 0.1
2,1 + 0.1
2= 0.1·f(0.05,0.9)
= 0.1·(0.0520.9) = 0.09475
k3=hf(xn+h
2, yn+k2
2)=0.1·f0 + 0.1
2,1 + 0.09475
2= 0.1·f(0.05,0.852625)
= 0.1·(0.0520.852625) = 0.09062875
k4=hf(xn+h, yn+k3)=0.1·f(0 + 0.1,1+(0.09062875)) = 0.1·f(0.1,0.90937125)
= 0.1·(0.120.90937125) = 0.087312875
Now, find ynat x= 0.2:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 3: Calculate y(0.2) using the values of k1,k2,k3, and k4calculated
above.
yn+1 = 1 + 1
6(0.1 + 2(0.09475) + 2(0.09062875) 0.087312875)
= 1 + 0.5(0.09475 0.1812575) = 1 + 0.5(0.2760075) = 1 0.13800375
= 0.86199625
Therefore, the approximate solution to y(0.2) using the fourth-order Runge-
Kutta method with step size h= 0.1 is 0.862.
Question 10
Question
Consider the initial value problem given by the differential equation:
y=x2+y, y(0) = 1.
Approximate the value of y(0.1) using the fourth-order Runge-Kutta method
with a step size of h= 0.05.
9
Solution
Step 1: Define the increment functions 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).
Step 2: Compute the approximations Applying the Runge-Kutta formulas
with h= 0.05, we perform the following calculations:
k1= 0.05 (0)2+ 1= 0.05,
k2= 0.05 0 + 0.05
22
+ (1 + 0.05
2)!= 0.0525,
k3= 0.05 0 + 0.05
22
+ (1 + 0.0525
2)!= 0.0528125,
k4= 0.05 (0 + 0.05)2+ (1 + 0.0528125)= 0.0681219.
Step 3: Update the value of yFinally, we update the value of yusing the
formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Substitute the computed values into the formula to find y(0.1):
y(0.1) = 1 + 1
6(0.05 + 2 ·0.0525 + 2 ·0.0528125 + 0.0681219) 1.017333.
Therefore, the approximate value of y(0.1) using the fourth-order Runge-
Kutta method with a step size of h= 0.05 is y(0.1) 1.017333.
Question 11
Question
Use a fourth-order Runge-Kutta method to approximate the solution of the
initial value problem dy
dx =x2y, y(0) = 0
from x= 0 to x= 1 using a step size of h= 0.1.
10
Solution
The fourth-order Runge-Kutta method can be implemented as follows:
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) = x2y.
Step 1: First, calculate the values of k1,k2,k3, and k4at each step.
k1= 0.1·((0)20) = 0
k2= 0.1·(0 + 0.1
2)2(0 + 0
2)= 0.0005
k3= 0.1·(0 + 0.1
2)2(0 + 0.0005
2)= 0.00049975
k4= 0.1·0.12(0.00049975)= 0.00100025
Step 2: Next, calculate the value of yn+1.
yn+1 = 0 + 1
6(0 + 2(0.0005) + 2(0.00049975) + 0.00100025)
= 0.0002
Therefore, the approximate solution of the initial value problem at x= 1
using a step size of h= 0.1 is y(1) 0.0002.
Question 12
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem given by:
dy
dx =x2y, y(0) = 1
Evaluate y(0.1) using a step size of h= 0.1.
11
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) as x2y.
Step 2: Use the fourth-order Runge-Kutta 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).
Step 3: Update yn+1 using the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Step 4: Apply the above formulas iteratively to compute y(0.1).
By following these steps, we can approximate y(0.1) using the fourth-order
Runge-Kutta method.
Question 13
Question
Consider the initial value problem given by the differential equation:
y=2x
y, y(0) = 1
Use the fourth-order Runge-Kutta method to estimate the value of y(1) using
a step size of h= 0.1.
Solution
Let’s denote f(x, y) as f(x, y) = 2x
y. We will use the fourth-order Runge-Kutta
method with step size h= 0.1 to estimate the value of y(1).
Step 1: Define the Runge-Kutta 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)
12
Step 2: Calculate the approximate value of yat xn+1 =xn+h:
yn+1 =yn+1
6(k1+2k2+2k3 + k4)
Step 3: Substitute the given values into the formulas and calculate y(1)
using the fourth-order Runge-Kutta method:
k1=0.1·2·0
1= 0
k2=0.1·2·(0 + 0.05)
1= 0.1
k3=0.1·2·(0 + 0.05)
1= 0.1
k4=0.1·2·0.1
1= 0.02
y1= 1 + 1
6(0 + 2 ·0.1+2·0.1+0.02) = 1.0533
Therefore, the estimated value of y(1) using the fourth-order Runge-Kutta
method with a step size of h= 0.1 is approximately 1.0533.
Question 14
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem with step size h= 0.1:
dy
dx =x2+y, y(0) = 1
Solution
Step 1: Define the function f(x, y) = x2+yand the step size h= 0.1.
Step 2: Initialize x0= 0, y0= 1, and define the number of steps n= 5 (as
we are given h= 0.1).
Step 3: Implement the fourth-order Runge-Kutta method to approximate
yi+1 for i= 0,1,2,3,4:
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).
13
Step 4: Calculate yi+1 for each step i= 0,1,2,3,4.
Step 5: Tabulate the results:
i xiyiyi+1
0 0 1 0.5073
1 0.10.5073 0.7575
2 0.20.7575 0.9019
3 0.30.9019 0.9830
4 0.40.9830 1.0324
Therefore, the fourth-order Runge-Kutta method approximates the solution
at x= 0.4 to be y(0.4) 1.0324.
Note: This process can be repeated with smaller step sizes for increased
accuracy.
Question 15
Question
Consider the initial value problem given by the differential equation y= 2yx
with the initial condition 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 approximate the value of y(0.1) using the fourth-order Runge-Kutta method
with step size h= 0.05, we will follow these steps:
Step 1: Define the function f(x, y) = 2yx.
Step 2: Define the initial condition y0= 1 and the step size h= 0.05.
Step 3: Apply the fourth-order Runge-Kutta method iteratively:
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 xnand ynare the current values of xand y, respectively.
Step 4: Perform the iterative calculations:
14
n= 0:
k1= 0.05f(0,1) = 0.05(2(1) 0) = 0.1
k2= 0.05f0 + 0.05
2,1 + 0.1
2= 0.05(2(1 + 0.05/2) 0.025) = 0.10125
k3= 0.05f0 + 0.05
2,1 + 0.10125
2= 0.05(2(1 + 0.10125/2) 0.025) = 0.10200625
k4= 0.05f(0 + 0.05,1+0.10200625) = 0.05(2(1 + 0.10200625) 0.05) = 0.10402501
y1= 1 + 1
6(0.1 + 2(0.10125) + 2(0.10200625) + 0.10402501) = 1.10800520833
Therefore, using the fourth-order Runge-Kutta method, the approximate
value of y(0.1) is y11.108.
Question 16
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem: dy
dx =x2+y, y(0) = 1
over the interval [0, 1] using a step size of 0.2.
Solution
Step 1: Define the function f(x, y) = x2+y.
Step 2: Calculate the increments k1,k2,k3, and k4using the formulas:
k1=f(xi, yi),
k2=f(xi+h
2, yi+h
2k1),
k3=f(xi+h
2, yi+h
2k2),
k4=f(xi+h, yi+hk3),
where h= 0.2, xi= 0, and yi= 1.
Step 3: Update the values of xand yusing the formula:
yi+1 =yi+h
6(k1+ 2k2+ 2k3+k4).
Step 4: Repeat the process for each iteration until x= 1.
Step 5: The approximated solution at x= 1 is the final value of y.
15
Question 17
Question
Use the fourth-order Runge-Kutta method to approximate the solution to the
initial value problem:
(y= 2y2x
y(0) = 1
on the interval [0,0.4] with a step size of h= 0.1.
Solution
Step 1: Define the function f(x, y) = 2y2xand the step size h= 0.1.
Step 2: Initialize x0= 0 and y0= 1.
Step 3: Calculate the approximations using the fourth-order Runge-Kutta
method:
k1=h·f(x0, y0)=0.1·(2 ·12·0) = 0.2
k2=h·f(x0+h
2, y0+k1
2)=0.1·f(0.05,1+0.1·0.2
2)=0.1·f(0.05,1.01) = 0.1·(2 ·1.01 0.1) = 0.2002
k3=h·f(x0+h
2, y0+k2
2)=0.1·f(0.05,1+0.1·0.2002
2)=0.1·f(0.05,1.01 + 0.01001) = 0.1·(2 ·1.0201 0.1) = 0.20198
k4=h·f(x0+h, y0+k3)=0.1·f(0.1,1+0.20198) = 0.1·f(0.1,1.20198) = 0.1·(2 ·1.20198 0.2) = 0.240396
y1=y0+1
6(k1+ 2k2+ 2k3+k4) = 1 + 1
6(0.2 + 2(0.2002) + 2(0.20198) + 0.240396) 1.02379
Therefore, the approximation of yat x= 0.1 is y11.02379.
Repeat the above steps to find the approximations at x= 0.2, x= 0.3, and
x= 0.4 to complete the solution.
Question 18
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem
(y=yt2+ 1
y(0) = 0
over the interval 0 t1 using four equally spaced steps.
16
Solution
The fourth-order Runge-Kutta method is given by the following formula:
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),
where his the step size given by 10
4= 0.25.
Step 1: Initialize the values with t0= 0 and y0= 0.
Step 2: Calculate k1,k2,k3, and k4using the given formula.
k1= 0.25(0 02+ 1) = 0.25,
k2= 0.25(0.25 (0 + 0.0625) + 1) = 0.25(1.1875) = 0.296875,
k3= 0.25(0.25 (0 + 0.1484375) + 1) = 0.25(1.1015625) = 0.275390625,
k4= 0.25(0.5(0 + 0.1376953125) + 1) = 0.25(1.362304687) = 0.3405761719.
Step 3: Calculate the next approximation value using the formula yn+1 =
yn+1
6(k1+ 2k2+ 2k3+k4).
y1= 0 + 1
6(0.25 + 2(0.296875) + 2(0.275390625) + 0.3405761719)
= 0 + 0.5830078125
= 0.5830078125.
Therefore, the approximation of the solution at t= 0.25 is y(0.25)
0.5830078125.
Question 19
Question
Consider the initial value problem for a first-order ordinary differential equation:
dy
dx =x2y, y(0) = 1.
Apply the classical fourth-order Runge-Kutta method to approximate y(0.1)
using a step size of h= 0.1.
17
Solution
Step 1: Define the Runge-Kutta method. We have the following equations:
k1=hf(xn, yn)
k2=hf(xn+ 0.5h, yn+ 0.5k1)
k3=hf(xn+ 0.5h, yn+ 0.5k2)
k4=hf(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
Step 2: Calculate the values of k: With f(x, y) = x2y, we have
k1= 0.1×(021) = 0.1,
k2= 0.1×(0.0520.9) = 0.09625,
k3= 0.1×(0.0520.9) = 0.09625,
k4= 0.1×(0.120.904375) 0.0905625.
Step 3: Update y:
y(0.1) 1 + 1
6(0.1 + 2(0.09625) + 2(0.09625) 0.0905625)
0.90229.
Therefore, the approximate value of y(0.1) using the classical fourth-order
Runge-Kutta method with h= 0.1 is 0.90229.
Question 20
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,1] with 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 differential equation and the initial condition.
The given initial value problem is:
dy
dx =x2+y, y(0) = 1
18
Step 2: Determine the step size h.
Given that the interval is [0,1] and the step size is h= 0.2, we have n=10
0.2= 5
subintervals.
Step 3: Set up the fourth-order Runge-Kutta formulas.
The fourth-order Runge-Kutta formulas are given by:
k1=h·f(xn, yn),
k2=h·fxn+h
2, yn+k1
2,
k3=h·fxn+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 4: Perform the iterations using the Runge-Kutta method.
Let’s perform the iterations:
n xnynk1k2k3
k4yn+1
0 0 1 ...
. .
1 0.2. . . .
. .
2 0.4. . . .
. .
3 0.6. . . .
. .
4 0.8. . . .
. .
5 1 . . . .
. .
Step 5: Calculate the approximate solution.
Now, we substitute the values of xn,yn,k1,k2,k3, and k4into the formulas to
calculate yn+1 at each step.
After performing the calculations, we find the approximate solution for y(1)
using the fourth-order Runge-Kutta method with the given step size.
Therefore, the approximate solution of the initial value problem dy
dx =x2+
y, y(0) = 1 at x= 1 is ... (fill in the final value after completing the calculations).
19
Question 21
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.
Solution
To approximate the value of y(1) using the fourth-order Runge-Kutta method,
we will follow these steps: Let h= 0.2, x0= 0, and y0= 1.
Step 1: Calculate k1,k2,k3, and k4according to the fourth-order Runge-
Kutta method:
k1=hf(x0, y0) = 0.2(02+ 1) = 0.2,
k2=hf x0+h
2, y0+k1
2= 0.2 0
22
+1
2!= 0.1,
k3=hf x0+h
2, y0+k2
2= 0.2 0
22
+1
2!= 0.1,
k4=hf(x0+h, y0+k3) = 0.212+ 1 + 0.1= 0.42.
Step 2: Calculate the next approximation y1using the formula:
y1=y0+1
6(k1+ 2k2+ 2k3+k4).
Substitute the values of k1,k2,k3, and k4to find y1:
y1= 1 + 1
6(0.2 + 2(0.1) + 2(0.1) + 0.42) = 1 + 1
6(0.2 + 0.2 + 0.2 + 0.42) = 1.1183.
Therefore, the approximate value of y(1) using the fourth-order Runge-Kutta
method with a step size of h= 0.2 is y(1) 1.1183.
Question 22
Question
Consider the initial value problem:
dy
dx =x2+y2, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate y(1) with a step size
of h= 0.1.
20
Solution
Step 1: We start by setting up the fourth-order Runge-Kutta method, which 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)
Step 2: We apply the method to approximate the value of y(1):
k1= 0.1(02+ 12) = 0.1
k2= 0.1 0
22
+1 + 0.1
22!= 0.1025
k3= 0.1 0
22
+1 + 0.1025
22!0.1049
k4= 0.1 (1 + 0.1049)20.2233
y11 + 1
6(0.1 + 2(0.1025) + 2(0.1049) + 0.2233) 1.1256
Therefore, the approximate value of y(1) using the fourth-order Runge-Kutta
method with a step size of h= 0.1 is y(1) 1.1256.
Question 23
Question
Consider the initial value problem given by the differential equation dy
dx =x2+y2
with the initial condition y(0) = 1. Use the 4th-order Runge-Kutta method to
approximate the value of yat x= 1 using a step size of x= 0.2.
Solution
Step 1: Define the increment function f(x, y) = x2+y2.
Step 2: Calculate the values of yat each step using the 4th-order Runge-
21
Kutta method:
k1= x·f(x, y)=0.2·(02+ 12)=0.2
k2= x·f(x+1
2x, y +1
2k1)=0.2·(0.12+ 1.12)=0.242
k3= x·f(x+1
2x, y +1
2k2)=0.2·(0.12+ 1.212)=0.2862
k4= x·f(x+ x, y +k3)=0.2·(0.22+ 1.38842)=0.332288
y(x+ x) = y+1
6(k1+ 2k2+ 2k3+k4) = 1 + 1
6(0.2+2×0.242 + 2 ×0.2862 + 0.332288) = 1.190474
Therefore, the approximate value of yat x= 1 using the 4th-order Runge-
Kutta method with a step size of x= 0.2 is 1.190474.
Question 24
Question
Consider the initial value problem:
dy
dx =x2y, y(0) = 1
Use the fourth-order Runge-Kutta method to approximate y(1) with a step size
of h= 0.2. Show all your computations up to the required number of decimal
places.
Solution
To approximate y(1) using the fourth-order Runge-Kutta method, we first need
to compute the values of yat each step using the following formula:
k1=h·f(xn, yn)
k2=h·f(xn+ 0.5h, yn+ 0.5k1)
k3=h·f(xn+ 0.5h, yn+ 0.5k2)
k4=h·f(xn+h, yn+k3)
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)
where f(x, y) = x2y.
Step 1: Calculate yat each step using the Runge-Kutta method.
k1= 0.2[(0)21] = 0.2
k2= 0.2[(0.2)2(1 + 0.1(0.2))] = 0.185
k3= 0.2[(0.2)2(1 + 0.1(0.185))] = 0.1711
k4= 0.2[(0.4)2(1 + 0.1(0.1711))] = 0.1572
y1= 1 + 1
6(0.2 + 2(0.185) + 2(0.1711) 0.1572) 0.8569
22
Step 2: Repeat the process until x= 1.
At x= 0.2, y10.8569
At x= 0.4, y20.7286
At x= 0.6, y30.6074
At x= 0.8, y40.4920
At x= 1.0, y(1) 0.3822
Therefore, the fourth-order Runge-Kutta method gives the approximate
value of y(1) as 0.3822.
Question 25
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
estimate the value of yat x= 0.1. Use a step size of h= 0.05.
Solution
The fourth-order Runge-Kutta method uses the following formulas to approxi-
mate the next value of y:
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+yand (xn, yn) are the previous values.
Step 1: Initialize the values.
Using the initial condition y(0) = 1 and h= 0.05, we have x0= 0, y0= 1.
Step 2: Compute k1, k2, k3, k4.
k1= 0.05 ·f(0,1) = 0.05 ·(02+ 1) = 0.05
k2= 0.05 ·f(0 + 0.025,1+0.025 ·0.5) = 0.05 ·(0.0252+ 1.0125) = 0.05125
k3= 0.05 ·f(0 + 0.025,1+0.025 ·0.5125) = 0.05 ·(0.0252+ 1.025625) = 0.05128125
k4= 0.05 ·f(0 + 0.05,1+0.05128125) = 0.05 ·(0.052+ 1.05128125) = 0.05134641
23
Step 3: Compute y1
y1= 1 + 1
6(0.05 + 2 ·0.05125 + 2 ·0.05128125 + 0.05134641)
= 1 + 1
6(0.05 + 0.1025 + 0.1025625 + 0.05134641)
= 1 + 1
6(0.30640991)
= 1.05106832
Therefore, the estimated value of yat x= 0.1 using the fourth-order Runge-
Kutta method with a step size of 0.05 is approximately 1.0511.
Question 26
Question
Consider the following initial value problem:
dy
dx =x2+y, y(0) = 1
Apply the fourth-order Runge-Kutta method to estimate y(1) using a step
size of h= 0.2.
Solution
Step 1: Define the function f(x, y) = x2+y.
Step 2: Calculate the approximations using the fourth-order Runge-Kutta
method:
k1=h·f(0,1) = 0.2·(02+ 1) = 0.2
k2=h·f(0 + h
2,1 + k1
2)=0.2·(0.12+ 1 + 0.1·0.2/2) = 0.227
k3=h·f(0 + h
2,1 + k2
2)=0.2·(0.12+ 1 + 0.227 ·0.2/2) = 0.254
k4=h·f(0 + h, 1 + k3)=0.2·(0.22+ 1 + 0.254) = 0.314
Step 3: Compute the next approximation using the weighted average of k1,
k2,k3, and k4:
y(0.2) = 1 + 1
6(0.2+2·0.227 + 2 ·0.254 + 0.314)
= 1 + 1
6(0.2+0.454 + 0.508 + 0.314)
= 1 + 1
6(1.476)
1.246
24
Therefore, the estimated value of y(1) using the fourth-order Runge-Kutta
method with a step size of 0.2 is approximately 1.246.
Question 27
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, 1] with a step size of 0.1.
Solution
To apply the fourth-order Runge-Kutta method, we will use the following for-
mulas: 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+y,h= 0.1, and x0= 0, y0= 1.
Step 1: First, we calculate k1, k2, k3,and k4at each step.
k1= 0.1×(02+ 1) = 0.1,
k2= 0.1×0 + 0.1
22
+ (1 + 0.1
2) = 0.10525,
k3= 0.1×0 + 0.1
22
+ (1 + 0.10525
2)=0.11061,
k4= 0.1×(0 + 0.1)2+ (1 + 0.11061) = 0.12161.
Step 2: Using the values of k1, k2, k3,and k4, we can calculate the next
value of y
y1= 1 + 1
6(0.1+2×0.10525 + 2 ×0.11061 + 0.12161)
= 1.1139.
Therefore, the approximate solution of the initial value problem at x= 0.1
is y1.1139.
25
Question 28
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem: dy
dx =exy, y(0) = 1
over the interval [0,1]. Use a step size of h= 0.2.
Solution
Let’s denote f(x, y) = exyand h= 0.2. We will use the fourth-order
Runge-Kutta method to approximate the solution.
Step 1: Initialize variables and set up the iteration.
Given that y(0) = 1 and h= 0.2, we have:
x0= 0, y0= 1, h = 0.2
Now, the iteration for 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)
Step 2: Perform the iteration.
We will perform the iteration for the given initial value problem over the
interval [0,1] with step size h= 0.2.
Iteration 1 (n= 0):
k1= 0.2[f(0,1)] = 0.2(e01) = 0.2,
k2= 0.2[f(0.1,1+0.1/2)] = 0.2(e0.11.05) 0.020184,
k3= 0.2[f(0.1,10.020184/2)] = 0.2(e0.11.030092) 0.045624,
k4= 0.2[f(0.2,10.045624)] = 0.2(e0.21.045624) 0.22046,
y1= 1 + 1
6(0.2 + 2(0.020184) + 2(0.045624) 0.22046) 0.904429
26
Iteration 2 (n= 1):
k1= 0.2[f(0.2,0.904429)] 0.2(e0.20.904429) 0.235155,
k2= 0.2[f(0.3,0.904429 0.235155/2)] 0.2(e0.30.8213525) 0.315559,
k3= 0.2[f(0.3,0.904429 0.315559/2)] 0.2(e0.30.771670) 0.365248,
k4= 0.2[f(0.4,0.904429 0.365248)] 0.2(e0.40.739180) 0.430985,
y2= 0.904429 + 1
6(0.235155 + 2(0.315559) + 2(0.365248) 0.430985) 0.796036
Continue this process until x= 1 to generate more iterations and approxi-
mate the solution.
Question 29
Question
Consider the initial value problem:
dy
dx =x2y, y(0) = 1.
Use the fourth-order Runge-Kutta method with step size h= 0.1 to approximate
y(0.4).
Solution
To apply the fourth-order Runge-Kutta method to approximate y(0.4), we first
need to compute the intermediate values of yat each step.
Step 1: Calculate k1, k2, k3, k4at each step using the formula:
k1=h·f(xn, yn),
k2=h·fxn+h
2, yn+k1
2,
k3=h·fxn+h
2, yn+k2
2,
k4=h·f(xn+h, yn+k3),
where f(x, y) = x2y.
Step 2: Update yusing the formula:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4).
Let’s start the computations:
27
Step 1:
k1= 0.1·(021) = 0.1,
k2= 0.1·0 + 0.1
21 + 0.1
2=0.09575,
k3= 0.1·0 + 0.1
21 + 0.09575
2=0.09158,
k4= 0.1·(0 + 0.11+(0.09158)) = 0.081842.
Step 2:
y1= 1 + 1
6(0.1 + 2(0.09575) + 2(0.09158) 0.081842)
= 0.970624.
Therefore, using the fourth-order Runge-Kutta method with step size h=
0.1, the approximate value of y(0.4) is 0.970624.
Question 30
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem
y= 2yx2+ 1, y(0) = 0
at x= 0.1. Perform four iterations with a step size of h= 0.025.
Solution
Given the initial value problem, we will use the fourth-order Runge-Kutta
method to approximate the solution at x= 0.1 with a step size of h= 0.025.
The general formula for the fourth-order Runge-Kutta method is:
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 k1, k2, k3, k4,and yn+1 for the first iteration:
k1= 0.025 ·f(0,0) = 0.025(2 ·002+ 1) = 0.025,
28
k2= 0.025 ·f(0.0125,0.0125) = 0.025(2 ·0.0125 0.01252+ 1) = 0.02621875,
k3= 0.025·f(0.0125,0.01260937) = 0.025(2·0.012609370.01252+1) = 0.02618312,
k4= 0.025·f(0.025,0.01279281) = 0.025(2·0.012792810.0252+1) = 0.02719776,
y1= 0 + 1
6(0.025 + 2(0.02621875) + 2(0.02618312) + 0.02719776)0.01283281.
Step 2: Repeat the process for the next three iterations to find y2, y3, and
y4:
y20.02856707, y30.04676670, y40.06957946.
Therefore, using the fourth-order Runge-Kutta method, the approximate
solution of the initial value problem at x= 0.1 is y(0.1)0.06957946.
Question 31
Question
Consider the initial value problem for a first-order ordinary differential equation
given by:
y=ey, y(0) = 1
Use the classical fourth-order Runge-Kutta method with step size h= 1 to
estimate y(4).
Solution
Step 1: We will first compute the values of yat each step using the classical
fourth-order Runge-Kutta method:
yn+1 =yn+1
6(k1+ 2k2+ 2k3+k4)h
where
k1=f(xn, yn) = eyn
k2=f(xn+h
2, yn+1
2k1h) = e(yn+1
2k1h)
k3=f(xn+h
2, yn+1
2k2h) = e(yn+1
2k2h)
k4=f(xn+h, yn+k3h) = e(yn+k3h)
Step 2: Using the initial condition y(0) = 1, we start with x0= 0 and y0= 1.
Then we calculate:
k1=e1=e
k2=e(1+ 1
2e)e1.5e
k3=e(1+ 1
2e1.5e)e1.25e2
29
k4=e(1+e1.25e2)
Step 3: Now plug k1, k2, k3, k4back into the Runge-Kutta formula to find
y1:
y11 + 1
6(e+ 2e1.5e+ 2e1.25e2+e1+e1.25e2
)
Step 4: Repeat Steps 2 and 3 with new values of k1, k2, k3, k4to find y2, y3,
and y4.
Step 5: Finally, calculate y(4) y4.
Question 32
Question
Consider the initial value problem:
dy
dx =x2+y, y(0) = 1.
Use the fourth-order Runge-Kutta method to estimate y(0.2) using a step size
of h= 0.1.
Solution
To estimate y(0.2) using the fourth-order Runge-Kutta method, we will compute
the values of yat various points between x= 0 and x= 0.2 with a step size of
h= 0.1.
Given the initial value problem:
dy
dx =x2+y, y(0) = 1,
we can define:
f(x, y) = x2+y.
Step 1: Calculate the values of yat each step using the Runge-Kutta
method.
Step 2: With h= 0.1 and x0= 0, we have:
k1=h·f(0,1) = 0.1·(02+ 1) = 0.1,
k2=h·f(0 + 0.5h, 1+0.5k1)=0.1·(0.052+ 1 + 0.5·0.1) = 0.1025,
k3=h·f(0 + 0.5h, 1+0.5k2)=0.1·(0.052+ 1 + 0.5·0.1025) 0.105125,
k4=h·f(0 + h, 1 + k3)=0.1·(0.12+ 1 + 0.105125) 0.1105125.
30
Step 3: Compute the value of yat x= 0.1:
y(0.1) 1 + 1
6(k1+ 2k2+ 2k3+k4)
= 1 + 1
6(0.1+2·0.1025 + 2 ·0.105125 + 0.1105125)
1 + 1
6(0.1+0.205 + 0.21025 + 0.1105125)
1 + 1
6(0.6257625)
1.104294167.
Therefore, the estimate of y(0.2) using the fourth-order Runge-Kutta method
with a step size of h= 0.1 is approximately 1.104294167.
Question 33
Question
Use the fourth-order Runge-Kutta method to approximate the solution of the
initial value problem y= 2xy2,y(0) = 1 at x= 0.2. Use a step size of h= 0.1.
Solution
Step 1: Define the function f(x, y) = 2xy2and the step size h= 0.1.
Step 2: Using the fourth-order Runge-Kutta method, we can iterate through
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.
Step 3: Start with the initial condition y0= 1 at x0= 0 and compute the
approximations for x= 0.1,0.2 using the Runge-Kutta method.
31
Step 4:
k1= 0.1×2×0×12= 0
k2= 0.1×2×0 + 0
22
= 0
k3= 0.1×2×0 + 0
22
= 0
k4= 0.1×2×(0 + 0) = 0
Step 5: Using the above values of k1, k2, k3, k4, we have:
y1= 1 + 1
6(0 + 2(0) + 2(0) + 0) = 1
Therefore, the approximation of the solution at x= 0.2 using the fourth-
order Runge-Kutta method with a step size of h= 0.1 is y(0.2) 1.
Question 34
Question
Consider the initial value problem y=x2+y,y(0) = 1, and suppose we want
to approximate y(0.2) using the second-order Runge-Kutta method with one
step. Given y0= 1, h= 0.2, and the Runge-Kutta formula:
yn+1 =yn+h
2(k1+k2)
where
k1=f(xn, yn), k2=f(xn+h, yn+hk1)
Determine the approximation using the Runge-Kutta method.
Solution
Step 1: Calculate k1and k2Given f(x, y) = x2+y, we have:
k1=f(x0, y0) = x2
0+y0= 02+ 1 = 1
To find k2, we need to evaluate x1=x0+hand y1=y0+hk1. Using h= 0.2,
we get:
x1= 0 + 0.2=0.2
y1= 1 + 0.2(1) = 1.2
Now, plug these values into f(x, y):
k2=f(x0+h, y0+hk1) = (0.2)2+ 1.2=1.24
32
Step 2: Calculate the approximation using the Runge-Kutta method Now
we can use the Runge-Kutta formula to approximate the solution:
y1=y0+h
2(k1+k2) = 1 + 0.2
2(1 + 1.24) = 1 + 0.1(2.24) = 1.224
Therefore, the approximation of y(0.2) using the second-order Runge-Kutta
method with one step is y(0.2) 1.224.
Question 35
Question
Consider the initial value problem:
(y= 2xy,
y(0) = 1.
Use the fourth-order Runge-Kutta method with step size h= 0.1 to approximate
the value of y(0.2).
Solution
Step 1: We will use the fourth-order Runge-Kutta method to approximate the
value of y(0.2). 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 2: First, we need to evaluate the values of k1, k2, k3, k4. Let f(x, y) =
2xy. Using the given initial condition y(0) = 1, we have y0= 1. Now, we can
calculate as follows:
k1= 0.1×2×0×1=0,
k2= 0.1×2×0 + 0
2×(1 + 0
2) = 0,
k3= 0.1×2×0 + 0
2×(1 + 0
2) = 0,
k4= 0.1×2×0.1×1=0.02.
33
Step 3: Now, we can calculate the next approximation y1using the formula:
y1= 1 + 1
6(0 + 2 ×0+2×0+0.02) = 1 + 0.00333 = 1.00333.
Therefore, the approximate value of y(0.2) using the fourth-order Runge-
Kutta method with step size h= 0.1 is y(0.2) 1.00333.
34
Students also viewed