(due: Wednesday, May 18, in class)

**No late submissions will be accepted!**

**This project will count 20% of your final grade ! **

**Consider the following set of coupled ODE's:**

dn/dt = 1 - R*n*N - 2*R*n^{2}

dN/dt = R*n^{2}

n(0) = 0

N(0) = 0

This problem has actually some significance in the research that is currently done here in the Applied Math group
at UCLA. It can briefly be described as follows (you don't need to understand the following paragraph to work on
this problem):

In a process called epitaxial growth, atoms are deposited onto a surface, where they have the density n(t). They are deposited with a flux that has been normalized to 1 in the above equation. These atoms can move around (diffuse), with a mobility R. When 2 atoms meet, they form an imobile cluster, which is also called an island. The density of these islands is given by N(t). This explains the gain term in the lower equation. The 2 loss terms in the upper equation reflect the fact that atoms can diffuse toward an island (where they stick; second term), or two atoms disappear because they form an island (third term).

This problem can not be solved analytically. Thus, we want to solve it numerically. Take R=10^{6}.

Use t_{min} = 0.0, and t_{max} = 0.2 .

**Do the following:**

1) Write the problem in vector form **dx**/dt = f(**x**,t)

2) Solve this problem with a fixed timestep h=0.0001 using a fourth order Runge Kutta Fehlberg method.

3) Calculate the local truncation error for both variables n and N as defined by tau_{i} = 1/h*|(w_{i}
- v_{i})|, where w_{i} and v_{i} are a fourth and fifth order approximation (calculated
with the Runge Kutta Fehlberg parameters).

4) What value for the timestep do you have to choose to ensure that the local truncation error (for both variables)
never exceeds 10^{-6} ? (For this part, you need to "experiment" with the timestep).

5) Implement a Runge Kutta scheme with adaptive timesteps. Use the following criteria to choose the timestep: Calculate
the local truncation error as described in 3). Then, calculate a value q defined by

q=0.84*(tolerance/tau)^{1/4}

(Hint: since there are two variables, you want to choose the error tau_{max} of the variable that produced
the largest error !). Choose a tolerance of 10^{-6}.

6) Compare the number of timesteps it took with (part 5) and without (part 4) adaptive timesteps to achieve an
accuracy of 10^{-6} at every timestep.

**Hints**

When you are programming and debugging, you might want to choose a smaller value for R (10^{4}) and a larger
timestep (0.001), so that the problem runs faster.

Do not start a couple of days before this project is due !!

**What you should turn in:**

The Codes you used for parts 2), 3) and 5)

Plots of n and N as a function of T for part 2)

plots of the errors as a function of time for part 3)

Your answer to 1), 4), 6).