18.03 Problem Set 1

Due by 1:00 P.M., Friday, February 12, 1999, in the boxes at 2-106, next to the Undergraduate Mathematics Office.

Part I of each problem set will consist of problems which are either rather routine, or for which solutions are available in the back of the book or in the Notes, or both. (The problems in the Notes are grouped into sections with letter labels such as I.) They are good exercise for exams. They will be graded quickly and contribute less than one third of the grade on the problem set.

Part II contains more challenging and novel problems. They will be graded with care (complain if they are not) and contribute the bulk of the Homework grade.

Problems in both parts are keyed closely to the lectures. Try the problems as soon as you can after the indicated lecture.

Policy on joint work on homework: I encourage it. But you must clearly state who you worked with, on your solution to each problem you worked on with others. In defense of your own interests, you should feel that you have contributed to the understanding and solution of each problem.

Your recitation leader will not explicitly do problems from Part II for you, but he can give you advice and suggestions, and talk about analogous problems. Another resource to keep in mind is the Tutoring room, open M–Θ, 3:00–5:00 and 7:30–9:30 PM, Room 2-102.

Syllabus

1. (W 3 Feb) Separable equations: EP 1.1, 1.4.

2. (F 5 Feb) Direction fields and solutions: EP 1.3, Notes G.1–2; Matlab: Polking 1–14.

3. (M 8 Feb) Linear first order equations: EP 1.5.

4. (W 10 Feb) More linear equations; homogeneous equations: EP 1.6.

5. (F 12 Feb) Autonomous equations; the phase line: EP 1.8, 7.1.

Part I.

1. (W 3 Feb) EP 1.4: 1 (Be careful about eliminating the absolute value in the last step!), 2; then sketch the graphs of the families of functions obtained in these two problems; 23. Notes I: 26c.

2. (F 5 Feb) EP 1.3: 11, 12, 13, 15, 19. In each case, draw a few solutions, as well, using a different color than you use for the isoclines. You may wish to check your answer or gain insight by using Matlab’s dfield5 as described in the Part II problem.

3. (M 7 Feb) I: 10a, 27abc.

Part II.

1. (W 3 Feb) (a) Write down a first order differential equation for which the ellipses x^{2} + 2y^{2} = c, c > 0, are solution curves. Then write down the equation solved by the orthogonal family of curves, and solve it. Be sure you include all the solutions! Sketch both families, to be sure that they do look orthogonal.

(b) Now do the same thing with the family of conics x^{2} + ay^{2} = c, where c varies but a is some fixed number. (Notice that you get hyperbolas if a < 0, and pairs of lines if a = 0.) Sketch both families of curves in the cases a = 1, a = 0, a = −1.

2. (F 5 Feb) This exercise will introduce you to Matlab and get you used to using the first tool accompanying the manual by Polking, namely dfield. (If you are using the Student Edition of Matlab on a PC, you can download this and the other programs described in the manual from John Polking’s website, http://math.rice.edu/∼polking/.)

First, read the first chapter of the manual, sitting at a terminal with Matlab running, verifying that things work the way he claims they do. Many Matlab users begin their session by typing a number, like 2, followed by <enter>, just to begin the interaction; it’s a form of “Hi.” When you’ve finished this chapter, try the following: type solve('x^3-x-1=0'). (From now on I won’t remind you to end a command by <enter>—but remember, if you don’t want ans printed out on the screen—maybe because it’s a list of 1000 numbers—follow the command by a semicolon before the <enter>.) You should get some horrific looking expressions. They can be made a little prettier using pretty(ans): pretty tries to rewrite an expression more the way a human being might, but it usually doesn’t do a very good job. Anyway, next try double(ans). The double converts the symbolic expression given by the solve command to a numeric expression (accurate to “double precision,” i.e. about 16 decimal digits). Now you realize that in fact there were three expressions, giving the three roots of the original equation. You see that two of them involve the symbol i. This is Matlab’s rendering of the complex number i, a square root of −1. Two of the roots are nonreal complex numbers—they occur in a complex conjugate pair, as they must since the original equation was real.

Now push the up-arrow key a few times to return the expression solve('x^3-x-1=0') to the screen and then hit <enter>, and try typing double ans; say you forgot to type the parentheses. (Most Matlab commands return an error signal if you neglect to enclose the arguments in parentheses.) My system returns the value “97 110 115.” I myself had no idea where Matlab got these numbers; they certainly have nothing to do with what double(ans) returned, given the same value of ans. (Remember, ans is exactly the previous answer, so if you type double(ans) at this point you’ll get “97 110 115” back.) Eventually a friend pointed out to me that they are the ASCII equivalents for the letters “a,” “n,” and “s.”

This is an illustration of what I regard as the main pitfall of Matlab as a teaching device. It is very powerful, and very narrowly tuned to specific applications, mostly in Applied Mathematics and Engineering. As a result there are many defaults built into the program. Often a command will give a result which has no relation to what you want, as we just saw double do, and unless you have some idea of what to expect you might accept the output as a reasonable answer. Of course the roots of x^{3} − x − 1 = 0 can’t possibly be 97, 110, and 115, so you know something is amiss, but when we are doing more complex calculations it will be harder to detect nonsense. Be careful.

At this point I’d like to point out to you the several sources of web-based help available for Matlab linked to on the 18.03 webpage http://www-math.mit.edu/18.03/.

OK, now it’s time to move on to dfield5. Type this expression. dfield5 is an updated version of the program called dfield in Polking’s manual. (So if you are using another installation of Matlab which is not version 5.2 and have installed the older program dfield, type dfield instead). A control panel appears which is almost but not exactly like the picture on p 10. Read the first few pages of Chapter II of the manual and get used to the controls. Notice the defaults: t is the independent variable, x is the dependent variable, the “Riccati equation” x′ = x^{2} − t (where x′ is the derivative of x with respect to t) is the differential equation, and minimum and maximum values of the dependent and independent variables are selected. The following exercise will change all that.

You will investigate the differential equation

\frac{dy}{dx} = y^{3} − 3y − x.

You could rewrite this using t as an independent variable and x as dependent—dx/dt = x^{3} − 3x − t—but let’s make Matlab do our bidding instead of the other way around. Position the cursor at the window to the left of the equals sign, delete or backspace out the x there, and replace it with y. Then either using the tab key or with the mouse, position the cursor in the next window and replace it with y^3-3*y-x. Finally, replace “t” by “x” in the window next to “The independent variable is.” Hit the proceed key. Another window opens, containing, one hopes, a portion of the direction field of this differential equation. (This window again is slightly different from the window pictured on p 11 of the manual.) Admire it!

But it’s not very well centered. To fix this, return to the DFIELD Setup window and position the cursor at the window labeled “The min value of x =.” (You may not have noticed it, but the “t” that was there before changed to an “x” because you declared x to be the independent variable.) Replace the minimum x value by -5, and the maximum x value by 7. Then hit proceed again. The picture in the DFIELD Display window should move. Hit the print key and collect the printed output.

Take the picture you have generated and sketch the solution curve through the point (−2, 1). Then position the cursor at this point on the window and hit the left mouse button. A curve should appear on the display. Does it look like what you drew? Do the same process starting with the points (−2, −2) and (4, 1). Each curve is part of a solutoin to the differential equation. Now pick a dozen other points on the screen at random and plot the solution through each. Print out the result, which should look like a curved ridge running across a field. It’s a representation of the general solution of the differential equation.

Now we can use this wonderful graphic tool to make some guesses about how this differential equation behaves. Observe that each solution curve decides at some point (as we follow it from left to right) to head either steeply up or steeply down. (We’ll see later that it actually “blows up in finite time”—it cannot be extended past a certain value of x (which value depends upon which solution we are considering). The plane is divided into two regions, separated by a curve. The top region consists of points (x, y) such that the solution curve passing through that point eventually heads sharply towards infinity. The bottom region consists of points (x, y) such that the solution curve passing through that point eventually heads towards minus infinity. These two regions are separated by a curve, consisting of a single solution which heads to infinity but rather slowly. This curve, separating solutions exhibiting radically different behavior, is called a separatrix. Trace the separatrix on your second printout, and label it. Sketch the isocline for slope zero. Describe what you observe about the relationship between these two curves. Can you expain this, in words?

Hand in both printouts.

3. (M 8 Feb) This problem concerns a retirement program for which I received an advertisement recently. It postulated that I want to accumulate one million dollars over the next twenty years. For the purposes of discussion, it assumed that any investment would earn 10% per year interest (compounded continuously). It gave three options: (a) Invest a lump sum now and let in accumulate interest, which is automatically reinvested;

(b) Invest a fixed amount per month; (c) Invest an amount each month which is a fixed amount less than the previous month’s contribution, ending with a zero dollar contribution after 20 years.

I was suspicious of the monthly payments the advertisement assigned to these three plans, so I applied the methods of 18.03. The first step was to approximate the monthly contributions by a continuous contribution. I decided to solve a slightly more general problem, replacing the 20 year maturity by a general time T (number of years), the interest rate of 10%=.10 by a general interest rate I, and the goal of $1M by a general number N (of dollars). I wrote x(t) for the amount of money saved at time t, where t = 0 is the starting time, and in plans (b) and (c) I wrote k for the initial rate of payment into the plan (in dollars per year). (Thus in plan (b), the rate remains k dollars per year, while it declines to 0 dollars per year along a straight line over a period of T years in plan (c).) Then I set up the differential equation corresponding to each plan (starting with an expression for x(t + Δt)), found the general solution, and substituted initial and final values for x(t) to solve for the constant of integration and the unknown value of k. Finally, I substituted in the given values for T, I, and N. Here is what I computed: The lump sum in (a) is $135335.28. The contribution in (b) is $1304.31 per month (paid continuously, remember), and in (c) it begins at the rate of $1986.72 per month and declines in a straight line to $0.00 per month in 20 years.

Carry out these steps (using my notation, please!) and check my answers. You should also compute the useful ratio ρ of final savings to total contributions in each case. You’ll get three numbers, ρ_{a}, ρ_{b}, ρ_{c}. Note that each depends only on the product IT, and not on I and T separately! (It more or less had to come out that way, because ρ is a dimensionless quantity and the only way to make a dimensionless quantity out of T (measured in years) and I (measured in years^{−1}) is to take their product.) As a check of your work, I’ll tell you that with IT = 2 these ratios are

ρ_{a} = e^{2} ≃ 7.38905609893065, ρ_{b} = \frac{e^{2} − 1}{2} ≃ 3.19452804946533,

ρ_{c} = \frac{e^{2} + 1}{2} ≃ 4.19452804946533.

(These values are computed using Matlab, needless to say; I typed format long first to get double precision readouts.) Explain why the observed relative sizes of these ratios is reasonable.

4. (W 10 Feb) At least in the 1:00 class, I displayed the direction field for the ODE

\frac{dy}{dx} = y^{2} − x^{2} − 1,  (1)

and discovered that y = −x is a solution. Check that it is indeed a solution. Next, find the general solution by the following trick: look for solutions of the form

y = \frac{1}{z} − x,

where z is some new function of x. Substitute this into (1) and find that z satisfies the linear ODE

\frac{dz}{dx} − 2xz = −1.

Use the standard method to solve this in terms of the function

erf(x) = \frac{2}{\sqrt{π}} ∫_{0}^{x} e^{−t^{2}}dt.

(This is the error function. It is a useful component in expressing solutions to many linear first-order ODEs, and in other fields of mathematics as well. The funny factor in front is there so that

lim_{x→∞} erf(x) = 1

holds—by a calculation you may have seen in 18.02.)

Then substitute back in and express the general solution to (1) in terms of erf(x). (Actually your expression will miss the original one, y = −x, unless you allow c = ∞.)

Mortgages

The loan amount l(t) of a mortgage with (possibly variable) interest rate I per year and continuous (and also possibly variable) payment rate a dollars per year obeys the linear first order equation

l′(t) − I(t)l(t) = −a(t).

If we assume I and a are constant, then by separation of variables we find that the general solution is

l(t) = \frac{a}{I} + ce^{It}.

Determining the constant of integration c is not done by the usual initial condition method in this case. In fact, there are two undetermined constants here: c and a. We are given an initial loan amount, L = l(0), and a number of years T, at which time the loan amount should be reduced to 0; so we have the pair of equations

L = \frac{a}{I} + c, 0 = l(T) = \frac{a}{I} + ce^{IT} .

The first shows that c = −\frac{a}{I}e^{−IT}, and the second then shows that

a = \frac{I}{1 − e^{−IT}} L.

The total payout is aT, which is the initial loan amount L times the ratio

ρ = \frac{IT}{1 − e^{−IT}} .

Thus for example for a 30 year mortgage at 7%, the total payout comes to about ρ ≃ 2.393, and consequently the monthly payments on a $100,000 mortgage are $664.73. This is very close to actual bank charges.

Some Matlab graphics

Here is a sequence of Matlab commands which will create nice plots of flight trajectories.

x=linspace(0,1);  % create a vector of default length 100,
  %  equally spaced between 0 and 1
k=linspace(0,1,20);  % create a vector of length 20,
  %  equally spaced between 0 and 1
for i=1:20,   % note the comma
for j=1:100,
y(i,j)=(x(j)^(1-k(i))-x(j)^(1+k(i)))/2; % create a matrix or
%   a list of 20 lists of y-values
end
end
hold on   % prepare to plot several things on the same diagram
for i=1:20,
plot(x,y(i,:))   % plot the values of the i-th list of y-values
  %  against the x-values
end
hold off   % end the plotting session