## Homework 4, due 11 October 2005.

Due Tuesday, 11 October 2005
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Homework 4, due 11 October 2005.

Unless otherwise indicated, all computer programs must be written in C, C++, FORTRAN or any other programming language that the course instructor explicitly allows. You may not use Matlab to compute any numerical approximation of the solution to any of the differential equations in this homework; however, you may use Matlab to create any plots that you need to submit. You also may use Matlab to check your the results from your code.
1. Section 8.2, number 14.
2. Consider
• 1. Write and submit a listing of a computer program to compute a numerical approximation to the solution of this equation using
• Euler's method;
• 2nd order Runge-Kutta method (improved Euler); and,
• 4th order Runge-Kutta method.
You may choose on your own whether to write three separate programs or to include all three approaches in one program.
2. For each of the following time steps
• 0.5;
• 0.25;
• 0.125; and
• 0.01,
submit a plot of the exact solution and the three numerical approximations corresponding to the three methods for the time interval t=0 to t=10. Thus there should be 4 plots total, and each plot should have 4 curves.
3. Submit a plot illustrating the difference between the exact solution and the numerically computed solutions for the same time steps and time interval as in part b above. In each case indicate the factor by which the global error changes as the time step changes and indicate whether such a factor would be expected for the global truncation error for the corresponding method.
4. What is the difference between the exact solution and the numerically computed solutions after the first time step for each method and time step size above? Determine the factor by which this error (the local truncation error) changes as the time step changes and indicate whether such a factor corresponds to what is theoretically expected.
3. Consider
• 1. Submit a plot illustrating the exact solution and the three numerically computed solutions for the case where the time step is equal to
• 0.5;
• 0.25;
• 0.125; and
• 0.01.
2. Compare the local truncation error after the first time step for Euler's method with the local truncation error for Euler's method in problem 1 for the case where the time step is 0.5. Explain the cause of any difference.
3. Explain any dramatic changes in the results that you observe.
4. Consider
• Using one of Euler, 2nd order Runge-Kutta (improved Euler) or 4th order Runge-Kutta, plot an approximate solution for this equation. By reducing the time step size and comparing the result with the next larger step size, determine a step size that provides an accurate approximation of the solution. Submit your code and plots to justify your result.
5. For the system given by the equation at the top of the page in homework 3
1. determine the solution when m=1, b=0.25, k=2, x(0)=2, dx/dt(0)=0 and F(t)=0; and,
2. write a computer program to solve it using Euler's method and submit plots of the numerical solution and the exact solution for the same time interval.