## Homework Assignment #3

(due: April 29 in class)

### Theory Part

Problem 1 (40%):
Consider an initial value problem of the form

dy/dt = F(y)
y(t0) = y0

This is called an autonomous differential equation, because F(y) does not depend explicitly on t. Give an expression for the leading term of the truncation error for the Runge-Kutta method

y* = yk + h*F(yk)
yk+1 = yk + h/2 * F(yk) + h/2 * F(y*)

Useful hints for doing this problem :

i) Do a Taylor expansion for yk+1 about yk
ii) dy/dt = F(y(t)) Þ d2y/dt2 = (dF/dy)*(dy/dt) Þ d2y/dt2 = (dF/dy) * F

iii) F( yn + dt F( yn)) = F( yn) + (dt F( yn))*(dF/dy) + 1/2*(dt F( yn))2*(d2F/dy2) + O(dt3)

Fact (iii) comes from expanding F( yn + s) about s = dt F( yn).

### Numerics Part

Problem 2 (60%):
Consider the following initial value problem:

dy/dt = cos(2*t) + sin(3*t)
0 <= t <= 1
y(0) = 1

a) Solve this problem numerically using a standard fourth order Runge Kutta method. Use h=0.2 and h=0.1.
b) Estimate the total error at each time step you are making with h=0.1. Do this by using the method called step-doubling. The total error is defined as the sum of the local truncation errors multiplied by the step size (because of the definition of the local truncation error).
c) Compare the total estimated errors with the actual errors of the method. Do this at each time step. For this, you need to compare your numerical solution to the exact solution, which is of the form
y(t) = 1/2 * sin(2*t) - 1/3 cos(3*t) +4/3
d) Repeat b) and c) using the Runge-Kutta-Fehlberg Method.
e) How do the two different ways to estimate the error compare?

You should turn in the following:

- the scripts you are using for the two different methods.
- One plot that shows the two different solutions (and the exact result) as a function of t (only for h=0.1).
- A plot that compares the error and the estimated total error at each timestep. This plot for each method, and for each h.