## Mathematics & Science Learning Center Computer Laboratory

### Mathematica Implementation

(continued from last page...)

We will test our heun program by having it create numerical solutions to the same differential equations that we solved using our Euler program in the last lab. Recall that the command-syntax used with your Euler program for this task was:

euler[f,{x,x0,xn},{y,y0},steps]

so for your new program, (since we made no changes to the input format when we adapted it to the Heun method, other than its name,) you would use a command of the form:

heun[f,{x,x0,xn},{y,y0},steps]

Of course, for such a command to work you must have evaluated your heun program during your current session with the Mathematica kernel! Use it to solve each of the initial value problems given in the table below. For each exercise, do the following:

1. Find the numerical solution, in the form of a list, on the x-interval spanning from the initial condition point up to the specified x-value.

2. Read this solution list into the solution name specified for the exercise.

3. Use the number of steps specified.

4. Redisplay your solution in tidy columns with a command of the form MatrixForm[Solution Name], inserting the appropriate name for the exercise inside the brackets.

5. Plot your solution using a command of the form ListPlot[Solution Name], inserting the appropriate name for the exercise inside the brackets.

6. Check your solution and its graph by clicking on the Mathematica Answer button provided. (Only do this once you've tried the problem yourself.)