The given differential equation is:
di/dt + 4i = cos(t)
You can use Euler's method to find the value of i after 0.5 seconds with At = 0.1 seconds. The formula for Euler's method is:
i[n+1] = i[n] + At * [di/dt]
where i[n] is the current at the nth time step. First find di/dt:
di/dt = cos(t) - 4i
Now youcan use Euler's method with At = 0.1 seconds and i[0] = 0 to find i[5]:
i[1] = i[0] + 0.1 * [cos(0) - 4(0)] = 0.1
i[2] = i[1] + 0.1 * [cos(0.1) - 4(0.1)] = 0.154
i[3] = i[2] + 0.1 * [cos(0.2) - 4(0.154)] = 0.2046
i[4] = i[3] + 0.1 * [cos(0.3) - 4(0.2046)] = 0.2521
i[5] = i[4] + 0.1 * [cos(0.4) - 4(0.2521)] = 0.2974
Therefore, i after 0.5 seconds using Euler's method is approximately 0.2974.
Now, solve the differential equation exactly. The homogeneous equation is:
di/dt + 4i = 0
The solution to this equation is:
i(t) = Ae^(-4t)
where A is a constant. To find the particular solution, you can assume a solution of the form:
i(t) = Bcos(t) + Csin(t)
Substituting this into the differential equation, you get:
-Bsin(t) + Ccos(t) + 4Bcos(t) + 4Csin(t) = cos(t)
Matching the coefficients of cos(t) and sin(t), you get:
4B = 0 and C - B = 1
Solving for B and C, you get:
B = 0 and C = 1
Therefore, the particular solution is:
i(t) = sin(t)
The general solution is the sum of the homogeneous solution and the particular solution:
i(t) = Ae^(-4t) + sin(t)
To find A, you use the initial condition i(0) = 0:
0 = Ae^(0) + sin(0)
A = -sin(0) = 0
Therefore, the solution to the differential equation is:
i(t) = sin(t)
Using this, you can find i after 0.5 seconds:
i(0.5) = sin(0.5) ≈ 0.4794
Comparing this with the value obtained using Euler's method, you can see that the exact solution is larger.
Hope I helped you...