Page 1 of 1

Homework 8, due November 13, 2009.

Posted: Tue Nov 10, 2009 12:10 am
by goodwine
For each of the problems below, write a computer program in FORTRAN, C or C++ that determines an approximate numerical solution using the indicated method. Submit a plot of the solution(s) as well as a printout of your computer code. If two or more programs are nearly identical, it is permissible to submit one program and simply write on the code printout what the difference would be for another problem.
  1. Write a program that uses Euler's method with a time step of dt=0.1 to determine an approximate numerical solution to
    • Image
    Use single precision (real) variables. At t=1, compare the numerical solution to the exact solution. Continue to reduce the size of the time step until the error at t=1 starts to increase. What is the cause of this increase?
  2. Write a computer program that uses 4th order Runge-Kutta to determine an approximate numerical solution to
    • Image
    where
    • Image
    and
    • Image
    Plot the solution on a three dimensional plot with (x,y,z) as the three axes parameterized by t and for t from 0 to 50.
    Repeat the problem with
    • Image
  3. Write a computer program using 4th order Runge-Kutta to determine an approximate numerical solution to
    • Image
  4. Write a computer program using 4th order Runge-Kutta to determine an approximate numerical solution to
    • Image
    On the same plot, plot the solution and 2 cos(6 t). What feature of the problem would not be expected if the equation were linear?

Re: Homework 8, due November 13, 2009.

Posted: Tue Nov 10, 2009 9:28 pm
by mpetraglia
what time step should we be using for problem 2? when I try plotting in MATLAB, there are very drastic changes in my plot when i go from dt=0.01 to dt=0.001, or 0.001 to 0.0001, etc.

Re: Homework 8, due November 13, 2009.

Posted: Tue Nov 10, 2009 9:57 pm
by goodwine
mpetraglia wrote:what time step should we be using for problem 2? when I try plotting in MATLAB, there are very drastic changes in my plot when i go from dt=0.01 to dt=0.001, or 0.001 to 0.0001, etc.
I would decrease the time step until it takes too long to run or it seems to converge to a solution. This system is chaotic, so small changes can have large effects, but it should converge at some point.

Re: Homework 8, due November 13, 2009.

Posted: Thu Nov 12, 2009 1:16 am
by jdeoreo
How do you graph in 3-D in matlab? In addition, I added a u in addition to v and w, but I was still unable to load the data.d file.

Re: Homework 8, due November 13, 2009.

Posted: Thu Nov 12, 2009 9:54 am
by goodwine
jdeoreo wrote:How do you graph in 3-D in matlab? In addition, I added a u in addition to v and w, but I was still unable to load the data.d file.
I think that at this point in your career you can find the answer to plotting in 3-D in matlab.

Using a u,v and w is correct, but without more information I can't really help you.