Homework 3, due September 15, 2004.

Due Wednesday, September 15, 2004. Grader: Williams R. Calderon-Munoz (wcaldero@nd.edu).
Post Reply
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Homework 3, due September 15, 2004.

Post by goodwine »

Unless otherwise indicated, all computer programs must be written in C, C++, FORTRAN or any other programming language that the course instructor explicitly allows. You may not use Matlab to compute any numerical approximation of the solution to any of the differential equations in this homework; however, you may use Matlab to create any plots that you need to submit. You also may use Matlab to check your the results from your code.
  1. Section 8.2, number 14.
  2. Consider
    • Image
    1. Write and submit a listing of a computer program to compute a numerical approximation to the solution of this equation using
      • Euler's method;
      • 2nd order Runge-Kutta method (improved Euler); and,
      • 4th order Runge-Kutta method.
      You may choose on your own whether to write three separate programs or to include all three approaches in one program.
    2. For each of the following time steps
      • 0.5;
      • 0.25;
      • 0.125; and
      • 0.01,
      submit a plot of the exact solution and the three numerical approximations corresponding to the three methods for the time interval t=0 to t=10. Thus there should be 4 plots total, and each plot should have 4 curves.
    3. Submit a plot illustrating the difference between the exact solution and the numerically computed solutions for the same time steps and time interval as in part b above. In each case indicate the factor by which the global error changes as the time step changes and indicate whether such a factor would be expected for the global truncation error for the corresponding method.
    4. What is the difference between the exact solution and the numerically computed solutions after the first time step for each method and time step size above? Determine the factor by which this error (the local truncation error) changes as the time step changes and indicate whether such a factor corresponds to what is theoretically expected.
  3. Consider
    • Image
    1. Submit a plot illustrating the exact solution and the three numerically computed solutions for the case where the time step is equal to
      • 0.5;
      • 0.25;
      • 0.125; and
      • 0.01.
    2. Compare the local truncation error after the first time step for Euler's method with the local truncation error for Euler's method in problem 1 for the case where the time step is 0.5. Explain the cause of any difference.
    3. Explain any dramatic changes in the results that you observe.
  4. Consider
    • Image
    Using one of Euler, 2nd order Runge-Kutta (improved Euler) or 4th order Runge-Kutta, plot an approximate solution for this equation. By reducing the time step size and comparing the result with the next larger step size, determine a step size that provides an accurate approximation of the solution. Submit your code and plots to justify your result.
  5. In the case of an ordinary, second order, linear, constant coefficient nonhomogeneous differential equation where the course text and the course "decision tree" indicates that the method of undetermined coefficients is the appropriate solution technique, would the method of variation of parameters also provide the correct particular solution? Justify your answer and also provide either an example or counter-example as an illustration.
  6. In the case of an ordinary, first order, linear, constant coefficient nonhomogeneous differential equation where the nonhomogeneous term, i.e., g(t), is of the type that would work for undetermined coefficients if the equation were second order, would the method of undetermined coefficients provide the correct solution? Justify your answer and also provide either an example or counter-example as an illustration.
Last edited by goodwine on Thu Jun 15, 2006 4:41 pm, edited 3 times in total.
Zero

Section 8.2 Problem # 14

Post by Zero »

Section 8.2 Problem # 14

After much head scratching I have decided that I have no clue how to do this problem. In fact, I'm not even sure what the book is asking for in any of the parts.

Any hints or translations would be much appreciated.


Thanks.
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: Section 8.2 Problem # 14

Post by goodwine »

Zero wrote:Section 8.2 Problem # 14

After much head scratching I have decided that I have no clue how to do this problem. In fact, I'm not even sure what the book is asking for in any of the parts.

Any hints or translations would be much appreciated.
To do part (a) you take the expansion for phi (which is given) and just subtract the improved Euler formula for y_{n+1} from it to get e_{n+1}.

To do part (b), you use the given Taylor series for two variable to expand the first "f" term in the answer to part (a) and the given formula for phi''. If you substitute into the answer for part (a) you should find the lowest order term is proportional to h^3.

The hint in part (c) helps you simplify the problem if f(t,y) is linear. A bunch of terms go to zero.

Hope this helps. If you need further clarification, please let me know.
Bill Goodwine, 376 Fitzpatrick
cshane

#2 part c

Post by cshane »

for #2 part c, what are you looking for us to calculate as far as error, I dont quite understand what is being asked in the question
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: #2 part c

Post by goodwine »

cshane wrote:for #2 part c, what are you looking for us to calculate as far as error, I dont quite understand what is being asked in the question
The error is the difference between the exact solution and the ones you computed using the different numerical approximations with different time steps.

By "global" error, I mean to plot the error over the whole time domain (t=0 to t=10). By just inspecting the graph, does the error generally decrease by a factor of 2, 4, 8, 16 or what when dt is cut in half?

This is in contrast to the "local truncation error" which is best determined only after the first time step.
Last edited by goodwine on Tue Sep 14, 2004 8:52 am, edited 2 times in total.
Bill Goodwine, 376 Fitzpatrick
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

emailed question

Post by goodwine »

I spent 4 hours in the lab tonight and didn't even complete one problem.
Bummer!
I think i'm a lot ahead of the other students thus far but I am very confused as to what the questions are actaully asking for. They're very wordy and i can't figure out what they really want.
Actually, they are quite precise (in my opinion!). They state exactly what you are supposed to do. If you can tell me what you think they are asking for, I can tell you whether or not you are right. The last thing I want is for people to spend a lot of time "doing" a problem and having it turn out that they did something that the problem did not ask for.
Could you maybe clarify. For instance, i Have the graphs for parts a, b, and c of problem 2 but don't have a clue what to do for d. Thanks for your help.
"What is the difference between the exact solution and the numerically computed solutions after the first time step..."

After the first time step compute the difference between the exact solution and the numerically computed ones.

"...for each method and time step size above"

Do this for each combination of method and time step. For example, using 2nd order R-K the error after the first time step when dt=0.5 was x, and when dt=0.25 it was y.

"Determine the factor by which this error (the local truncation error) changes as the time step changes and indicate whether such a factor corresponds to what is theoretically expected. "

When the time step was cut, say, in half, how much does the error decrease? From the example above, is x/y approximately 2, 4, 8, 16 or what? Is it what is theoretically expected for each method? For example, the local truncation error for 2nd order R-K is proporational to dt^3. If I cut dt in half, the error should decrease by a factor of z. Did it do this, or did it not for your numerically computed solutions?
Bill Goodwine, 376 Fitzpatrick
student

Post by student »

I have been trying to read all the internet references you gave us, but there is ALOT of information. Is there anything I should really focus on?
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

References

Post by goodwine »

student wrote:I have been trying to read all the internet references you gave us, but there is ALOT of information. Is there anything I should really focus on?
I just added a link to the programming help links page called "An Engineer's Introduction to C Programming." I think it will be the best and most useful. Try to give that a read and please give me feedback as to whether or not it's useful.
Bill Goodwine, 376 Fitzpatrick
kp316

Post by kp316 »

Professor, can you elaborate on what you mean by. . . "determine a step size that provides an accurate approximation of the solution" for problem 4.
thanks
acrutchf

submit online?

Post by acrutchf »

Are we just supposed to hand in our code printed out in a text editor, or submit the files to the I drive?
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Post by goodwine »

kp316 wrote:Professor, can you elaborate on what you mean by. . . "determine a step size that provides an accurate approximation of the solution" for problem 4.
thanks
"By reducing the time step size and comparing the result with the next larger step size, determine a step size that provides an accurate approximation of the solution."

In other words if you decrease the step size and the solution appears exactly the same, reducing it any more probably won't make any difference. Normally since you don't have an analytical solution to compare a numerical one to (if you did, what's the point to resorting to a numerical approximation) you have to fiddle around with the step size. By determining the point after which the solution apparently stays fixed even after further reducing the step size, you are pretty much assured that the approximate solution has convered to close to the real solution.
Last edited by goodwine on Tue Sep 14, 2004 9:11 pm, edited 1 time in total.
Bill Goodwine, 376 Fitzpatrick
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Re: submit online?

Post by goodwine »

acrutchf wrote:Are we just supposed to hand in our code printed out in a text editor, or submit the files to the I drive?
Just print it and staple it to the rest of the homework. If all you change between two programs is the step size, you don't have to print it again just to show such a minor alteration in the program.
Bill Goodwine, 376 Fitzpatrick
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

out of touch

Post by goodwine »

Normally I'll try to keep in touch with this forum the night before homeworks are due, but circumstances prevent me from doing so after this point (8:00pm) this evening. I'll respond to any subsequent posts early tomorrow morning.
Bill Goodwine, 376 Fitzpatrick
Post Reply

Return to “AME 301 Homework 3”