Homework 7, due November 2, 2016.

Due Wednesday, November 2, 2016
Post Reply
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Homework 7, due November 2, 2016.

Post by goodwine »

Reading: sections 12.1-12.3 of the course text. Also, if you have not read it, section 1.6 has background information including Matlab examples.

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, i.e., keep reducing dt until the answer does not change significantly. Also, unless otherwise indicated, you must use a compiled language, such as FORTRAN, C, or 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. 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).
  4. Do the first stage of the project, as described on the project page.
Bill Goodwine, 376 Fitzpatrick
rlema

Re: Homework 7, due November 2, 2016.

Post by rlema »

When we are comparing the exact and approximate solutions in problem 1, is the exact going to have the same time step as the approximation? or can we use a small time-step for the exact and compare how the approximation converges at a given point?
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Homework 7, due November 2, 2016.

Post by goodwine »

rlema wrote:When we are comparing the exact and approximate solutions in problem 1, is the exact going to have the same time step as the approximation? or can we use a small time-step for the exact and compare how the approximation converges at a given point?
Compare the exact and numerical solutions at the same point(s). If you choose to evaluate the exact solution at other times, that's ok.
Bill Goodwine, 376 Fitzpatrick
Kelly Pacifico

Re: Homework 7, due November 2, 2016.

Post by Kelly Pacifico »

To clarify for number 2 on homework 7, it says "plot the error versus different time steps. Indicate whether the error is decreasing in a manner consistent with the order of the method." do you want us to have three separate graphs (one for Eulers, second order, and fourth order) that have error versus t for various dt?
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Homework 7, due November 2, 2016.

Post by goodwine »

Kelly Pacifico wrote:To clarify for number 2 on homework 7, it says "plot the error versus different time steps. Indicate whether the error is decreasing in a manner consistent with the order of the method." do you want us to have three separate graphs (one for Eulers, second order, and fourth order) that have error versus t for various dt?
Whatever method of plotting them that most clearly communicates the nature of the relationship among the time steps and methods is what I want you to submit.
Bill Goodwine, 376 Fitzpatrick
jscholz

Re: Homework 7, due November 2, 2016.

Post by jscholz »

just to be clear, in question 3 is the differential equation 40 times (1-x) or is it 40 times x times (1-x)?
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Homework 7, due November 2, 2016.

Post by goodwine »

jscholz wrote:just to be clear, in question 3 is the differential equation 40 times (1-x) or is it 40 times x times (1-x)?
It is the latter:

x' = 40*x(t)*(1 - x(t))
Bill Goodwine, 376 Fitzpatrick
pkrog2

Re: Homework 7, due November 2, 2016.

Post by pkrog2 »

How should we present the answers for 1; do you want the code, graph, an analysis of the problem based on the results from our code, or some combination of those?
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Homework 7, due November 2, 2016.

Post by goodwine »

pkrog2 wrote:How should we present the answers for 1; do you want the code, graph, an analysis of the problem based on the results from our code, or some combination of those?
Submit all codes except 1) simple matlab plot commands and 2) if all you did was change something like dt you don't have to submit the code for each time for those. The analysis should be your attempt to most clearly communicate the nature of the relationship among the method, time step size and error.
Bill Goodwine, 376 Fitzpatrick
Post Reply

Return to “AME 30314, Homework 7”