Problem 3. Consider the same IVP as in Problem 1.
(a) Develop Taylor’s method of order 3 to solve the IVP (1).
Hint: Here is what I obtained for the second derivative of f(t,y(t)):
d2 d2 ✓ 2 1◆ 4 8y2(t) 4y(t) 8
dt2f(t,y(t))=dt2 y(t) +t2 =6y(t)+ t2 t3 +t4 .
- (b) Write a program that solves IVPs for ODEs by using Taylor’s method of order 3. Perhaps the easiest way to do this will be to take the program you developed in Problem 2 for the Taylor method of order 2, and to modify it (the modification will be really minor). Attach a printout of your codes to your homework.
- (c) Run the program you developed in (b) to solve the IVP (1) with N = 10, 100, 1000, and 10000. Record the numerical values of y(2) obtained by using di↵erent N in a table.
- (d) Plot the logarithm of the error, ln |y(2)exact y(2)approx|, versus the logarithm of the step size h. Find the slope of the straight line through the points on your graph, and discuss how this value compares with the theoretical prediction. The exact solution of the IVP is given in (2).
Problem 4. Consider the same IVP as in Problem 1.
- (a) Develop the Runge-Kutta method of order 4 (RK4) to solve the IVP (1).
- (b) Write a program that solves IVPs for ODEs by using RK4. Attach a printout of your codes to your homework.
- (c) Run the program you developed in (b) to solve the IVP (1) with N = 10, 100, 1000, and 10000. Record the numerical values of y(2) obtained by using di↵erent N in a table.
- (d) Plot the logarithm of the error, ln |y(2)exact y(2)approx|, versus the logarithm of the step size h. Find the slope of the straight line through the points on your graph. The exact solution of the IVP is given in (2).
2