03 Nov 11

Here are the marching orders for the day.  There are a couple of plots to print out and hand in with the homework.
I recommend that you create another blank notebook, in which you'll create the cells you want to keep and print.  You can always cut and paste expressions from here.  Or just evaluate them here and cut and paste afterward.

remember DSolve[] from last time ...

One of the skills we worked on last week was the use of DSolve[].  Try it out on a couple of differential equations which appear on this week's homework, starting with the basic rocket equation:

de1 = v'[t] == -b u / (m0 - b t)

bc1= v[0] ==0

Your job: DSolve these for v[t].  I’ll get you going:

soln1 = DSolve[ (you fill this in!) ][[1]]

Here is how we define a function of a generic argument (note the use of the underscore, which we use only when defining the function).

v1[t_] = (v[t] /. soln1)

Similarly, if we define the mass, momentum and kinetic energy as a function of time

m1[t_] = m0 - b t
p1[t_] = m1[t]*v1[t]
k1[t_] = (1/2) m1[t]*(v1[t])^2

Then you can (a) Plot these functions for some choice of numerical parameters,  and (b) ask Mathematica to
Solve[] for the time when e.g. p1’[t]==0, i.e. where the momentum is largest.

By the way, here is another differential equations which appears this week (in the boxcar problem):

de2 = F== (m0 + b t) v'[t] + b v[t]

bc2 = v[0]==0

You may want to copy the solutions to your notebook for printing later---that way you'll have it to consult when doing the homework, where you'll explain where this differential equation came from.

BTM problems

Consider the function defined in Shankar:

f[x_,y_] = x^2 - x y + y^2

To visualize, try plotting the surface in 3 D.
Notice you can rotate the figure with your mouse (hold down the left mouse button as you do so)

p1=Plot3D[f[x,y],{x,-6,6},{y,-6,6}]

Or to get the topographical map representation :

p2=ContourPlot[f[x,y],{x,-6,6},{y,-6,6}]

Your first assignment : add more contours to the plot.  (?? ContourPlot will give you all the options.)

Next, draw a circle of radius 5 centered at the origin:

x[t_] = 5 Cos[2 π t]
y[t_] = 5 Sin[2 π t]

p3 = ParametricPlot[{x[t],y[t]},{t,0,1},PlotStyle->{Thick,Red}]

Your next task: make the line thicker and turn it red.  (Check out the PlotStyle option.)
And then show both of your plots together with:

Show[p2,p3]

Hopefully it will look like this:

Next task: add a 3D curve (hmmm, maybe there is a 3D version of ParametricPlot) the Plot3D to get a figure like this one:

In the homework you are finding the extrema of f[x,y] when {x,y} is constrained to lie on the curve.
One method: change variables to make it a one dimensional problem:

h[t_] = f[x[t],y[t]]

Plot[h[t],{t,0,1}]

Your assignment: find the extrema of h[t], and then armed with those special values of t,
 find the extremal points x[t],y[t]

The Lagrange multiplier method ends up at the same place by defining the functions

g[x_,y_]= x^2 + y^2-25;
F[x_,y_,λ_] = f[x,y] + λ g[x,y]

Then we extremize F by solving some equations:

eqnx = D[F[x,y,λ],x]==0

Your task: construct eqny and eqnλ and then Solve[] for the critical points, hopefully confirming the result above.

HOMEWORK TASK

Your task: reproduce figure 3.1 on page 59 of BTM, where Shankar plots contours of the function f(x,y)=x^2 + 2 xy together with the circle x^2+y^2==2^2.  Please decorate your plot with a ListPlot of the critical points, i.e. extrema of f(x,y) when constrained to the circle.
PRINT THE RESULTING CELL and hand in as part of the homework.
(More precisely, maybe wait to print; maybe you will want to keep some other results.)


As an example, here is our ContourPlot above together with a couple of points added:  (note that your points will be different; part of your job is to find them)

p4 = ListPlot[{{1,-1},{-1,1}}5/Sqrt[2],PlotStyle->{PointSize[.03],Hue[0.4]}]

Show[p2,p3,p4]

Cycloid

Nothing to hand in from here, but you may find some of the plots useful.  Morin asks about the path of a pebble in a tire.  For a tire of radius R moving at speed v0 we have:

point[t_] = {v0 t, R} + R {Sin[v0 t/ R],Cos[v0 t/R]}

Notice how we are adding vectors here.  The first vector is the location of the center of the circle, and the 2nd one is the displacement from the center to the rim.
Having defined a vector-valued function, let's use it to draw the curve for some specific choice of parameters:c

p = {R->1,v0->1}

cycloid=ParametricPlot[point[t]/.p,{t,0,4π},PlotStyle->{Red,Thick},PlotRange->{{0,4π},{-1,3}}]

Notice that we can get the velocity and acceleration vectors really easily as:

point''[t]

point''[0]

point'[0]

The book asks you to find the "radius of curvature" at a particular point (the peak, to be precise).  What does “radius of curvature” mean?!  Well suppose that at a given moment of time our velocity vector and acceleration vector happen to be perpendicular.  Then for that moment in time at least, our motion is just like uniform circular motion with a radius we can find from the usual relationship that  a=v^2/R, or R=v^2/a.

Optional task

Draw a circle of appropriate radius and center on top of the cycloid parametric plot.
Here is a tool which can help: the knobs adjust the position and size of the circle:

Manipulate[Show[cycloid,Graphics[Circle[{x,y},r]]],{{x,4},0,10},{{y,0},-3,3},{{r,1},0,5}]

Feel free to print this and hand in with the homework, but it is not required.

Extras

Vector fields

The function VectorPlot can draw vector fields:

VectorPlot[{2x y , - y^2},{x,-3,3},{y,-3,3}]

You could take the gradient of your function f(x,y) and add it to your contour plot from above.

Animate!

Finally, if you have reached here with time to spare and want a challenge, Animate[] the motion of the pebble.
First make a ListPlot to draw a dot, and display it together with the cycloid.  Then add the wheel.