Math 450 Homework 2 - Spring 2009

Click here for Math450 homework page

HOMEWORK #2 due Monday Feb 16

Text references are to
   Introduction to partial differential equations with MATLAB
   Jeffrey Cooper (1998) (Birkhauser)

NOTE: In the following, ^ means superscript, _ (underscore) means subscript, and Sum(i=1,9) means the sum for i=1 to 9.

1.  Find the characteristic x(t) of the nonlinear equation

u_t + u^2 u_x = 0
u(x,0) = 0 (x<0),     u(x,0) = min (10, 2x^2) (x>0)

that has the initial value x(0)=2. What is the value of the solution u(x,t) along this characteristic?


The new few questions refer to the MATLAB textbook program file cl.m on the Math450 Web site (under MATLAB textbook files then Chap 02) and the supporting function files flux.m, f5.m, and f6.m. To run cl.m with initial conditions u(x,0)=f5(x) (from f5.m) or f6(x) from f6.m, you will need to download these four M-files to a computer that can run MATLAB.

2.  (i) Consider numerical schemes for approximating the solution of Burger's equation with the initial condition

u_t + u u_x = 0
u(x,0) = f5(x)

where f5(x) is the function in f5.m. Consider the CFL condition in the form

max_{x, t} |u(x,t)|   le   Delta X/Delta T   =   rho

for nonnegative t; see Section 2.6.4 in the text. Show that the CFL condition is satisfied for Delta X=Delta T for u(x,0)=f5(x). This means that, under these conditions, the ``upwind'' numerical scheme discussed in the text and implemented in cl.m should be stable and should converge to the correct solution.

    (ii) Answer the same question for u(x,0)=f6(x) from the function file f6.m.

    WARNING: f5(x) and f6(x) on the textbook author's and Math450 Web sites are NOT THE SAME as the functions f5(x) and f6(x) discussed on page 62 of the text.


3.  Run the MATLAB program cl.m with initial condition u(x,0)=f5(x) and Delta X=Delta T=h for the three cases (a) h=0.1 (b) h=0.01 and (c) h=0.001. In each case, enter the stepping numbers of iterations [n1 n2 n3 n4] in such a way that the resulting times [t1 t2 t3 t4] = [2 4 6 8]. In each case, a graph will appear with plots of numerical approximations of the five functions u(x,0), u(x,2), u(x,4), u(x,6), and u(x,8).

    (Hints and Warnings: For example, enter [20 20 20 20] for case (a) (h=0.1) and [200 200 200 200] for case (b) (h=0.01). The program cl.m requires that you enter n1 n2 n3 n4 as an explicit 1x4 row vector, so don't forget to include the square brackets. As a check, MAKE SURE that cl.m tells you explicitly that t1=2, t2=4, t3=6, and t4=8.)

    (i) Estimating accuracy of the numerical approximation by how well-defined the shock wave is that develops by time t=4, are the accuracies of the three numerical schemes about the same (that is, for cases a-b-c)? Or does the accuracy noticeably improve as h decreases? Or else does it improve from (a) to (b) but degrade from (b) to (c), consistent with (for example) higher roundoff error being more important than the smaller step size?

    (ii) From the graphs, estimate the position of the shock wave at t=4, t=6, and t=8. (Warnings: You will need h=0.01 or smaller to do this with any accuracy. Note that you will need additional information from the displayed graph in Problem 4.)


4.  The Rankine-Hugoniot (RH) equation for the speed of a shock wave is

speed(t) = (F(u_l) - F(u_r))/(u_l - u_r)

Here u_l,u_r are the values of u(x,t) immediately to the left and right of the shock wave and F(u) is the flux. Using your answers to Problem 3 and visual estimates of u_l,u_r from the graphs in Problem 3, use the RH equation to estimate the speed of the shock wave at times t=4, t=6, and t=8. How does this compare with the speeds estimated by the changes of position of the shock wave that you found in Problem 3 part (ii) for t=4 to t=6 and from t=6 to t=8? (Note that these intervals have Delta t=2, not 1.) Does the RH equation seem approximately correct in this example or, instead, is it highly misleading in this case?


5.  Add a line to your local copy of cl.m to display the tabled values of u(x,t) on the X-grid for times t=0,2,4,6,8. This will be a 20x6 table for h=0.1 and a 200x6 table for h=0.01. Re-run (your copy of) cl.m for case (b) in Problem 3 (h=0.01), generating a 200x6 table in the MATLAB command window. By scrolling back and looking at columns 4-6 of this table, you should be able to estimate the locations of the shock wave at times 4,6,8, as well as the values u_l,u_r at those times. Are these values close to the values that you estimated from the displayed graph in Problem 3?

(Hints: Looking at the MATLAB code for cl.m shows that cl.m defines a row vector x for the X grid points for -1 le x le 6, a second row vector snap0 for the values of u(x,0)=f5(x) on this grid, snap1 for u(x,t1), up to snap4 for u(x,t4). These row vectors must be rotated and displayed side-by-side for a standard table. This can be done by entering the line

Table = [x' snap0' snap1' snap2' snap3' snap4']

immediately before the first plot command in cl.m. You could also enter this command at the MATLAB command line, as in Problem 10(c) of Section 2.6 on page 64 of the text, but adding this command to your copy of cl.m will guarantee that the table is produced whenever you run cl.m.)


OPTIONAL, WILL NOT COUNT TOWARDS GRADE: 6.  Do Exercise 1 of Section 2.7 (page 69 of text).

  • Top of this page