## Homework 10, due December 11, 2014

Due at 4:00pm on Thursday, December 11, 2014, in the AME Department Office.
goodwine
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

### Homework 10, due December 11, 2014

This homework must be submitted to Emily Hershberger in the AME Department office (365 Fitz) before 4:00pm, Thursday, December 11, 2014. I cannot grant any extensions.

Reading: Chapter 12, Sections 1 - 5.

Exercises: For all problems, be sure to run the program multiple times with a different time step sizes to ensure that your approximate answer has converged to the correct answer. Also, unless otherwise indicated, you must use a compiled language, such as FORTRAN, C, C++.

1) 12.1 (number 3 only and be sure to notice the paragraph at the end of the problem)

2) Choose your favorite ordinary differential equation for which you can find the exact solution. If you are working with others, you must choose a different equation than they do. The only other condition is that it must be of the form x'(t) = f(x,t) and f must depend on BOTH x and t. It can be a single first order equation, or a higher-order equation converted to a system of first order equations. Write a program (or separate programs) that use a) Euler's method, 2) 2nd order R-K and iii) 4th order R-K and plot the error versus different time steps. Indicate whether the error is decreasing in a manner consistent with the order of the method.

3) 12.6

4) Consider the differential equation, which does not look all that bad:

x' = 40 x (1 - x)

where

x(-1) = 1/(1 + exp(40)).

Note that the initial condition is at t=-1. Use matlab and ode45() to solve this. Compare it to the exact answer, which is

x(t) = 1/(1 + exp(-40 t))

by plotting the two on the same graph. Verify the given exact answer really is the answer by substituting it into the differential equation. On a different graph, plot the error. Does matlab give a good solution?

Write a program using 4th order Runge-Kutta to determine the solution. Plot the error versus different sized time steps.

Main point: can you always trust matlab to give a good answer? Look at the original equation. Does it look suspicious in any way that would lead you to believe that it is problematics? (My answer is no, unless you ponder it for a long time).
Bill Goodwine, 376 Fitzpatrick