Maple Display Worksheet for Quadratic Drag

 

>    restart;

The command above erases most of what Maple currently has in memory;

  the two commands below simply help to show the correct syntax for the commands we will use,

            and are therefore not really necessary, provided you already know the correct language.

>    ?dsolve

>    ?deplots

   The command below loads a "package" that Maple will use to make some graphs of numerical

          solutions of our differential equations.

>    with(DEtools):

    We next define, in the next 3 commands, the system of differential equations we desire to solve.

>    xdf:=diff(vx(t),t)+c*sqrt(vx(t)^2+vy(t)^2)*vx(t);

xdf := diff(vx(t),t)+c*(vx(t)^2+vy(t)^2)^(1/2)*vx(t)

>    ydf:=diff(vy(t),t)+g+c*sqrt(vx(t)^2+vy(t)^2)*vy(t);

ydf := diff(vy(t),t)+g+c*(vx(t)^2+vy(t)^2)^(1/2)*vy(t)

>    syst:={xdf,ydf};

syst := {diff(vx(t),t)+c*(vx(t)^2+vy(t)^2)^(1/2)*vx(t), diff(vy(t),t)+g+c*(vx(t)^2+vy(t)^2)^(1/2)*vy(t)}

   The next command sets up the initial conditions for this system of first-order ode's:

>    init:=[[vx(0)=vx0,vy(0)=vy0]];

init := [[vx(0) = vx0, vy(0) = vy0]]

   Next, we put in a choice of parameters for the problem at hand; other ones could easily be made, later,

            simply by repeating this command line with different numbers inserted on the right-hand sides.

 These numbers are adapted from the problem in the text, for a baseball initially thrown upward and allowed

           to fall over a cliff.

>    g:=9.8; c:=.001225; vx0:=19.3; vy0:=23;

g := 9.8

c := .1225e-2

vx0 := 19.3

vy0 := 23

   As can be seen this command integrates the system numerically, and then provides a plot of the objects named in "scene."

>    DEplot(syst,[vx(t),vy(t)],t=0..70,init,scene=[t,vx(t)],title=`vx versus t\n shows reduction to zero`);

[Maple Plot]

>    DEplot(syst,[vx(t),vy(t)],t=0..70,init,scene=[t,vy(t)], title=`vy versus t\n shows terminal velocity`);

[Maple Plot]

   The graphs above were for the components of the velocity vector;

   now we add more to the system to allow us to plot locations, and will ask for the trajectory to be shown.

>    xysys:={diff(x(t),t)=vx(t), diff(y(t),t)=vy(t)};

xysys := {diff(x(t),t) = vx(t), diff(y(t),t) = vy(t)}

>    fullsys:={op(xysys),op(syst)};

fullsys := {diff(vy(t),t)+9.8+.1225e-2*(vx(t)^2+vy(t)^2)^(1/2)*vy(t), diff(vx(t),t)+.1225e-2*(vx(t)^2+vy(t)^2)^(1/2)*vx(t), diff(x(t),t) = vx(t), diff(y(t),t) = vy(t)}

>    fullinit:=[[x(0)=0,y(0)=0,op(op(init))]];

fullinit := [[x(0) = 0, y(0) = 0, vx(0) = 19.3, vy(0) = 23]]

   The 3 plot commands given below show us the trajectory with quadratic drag for 3 different views, i.e., different ranges of the trajectory,

   chosen so that we may observe different parts with some care.

            It is definitely worth noting three options that are available:

                  1) if we do NOT give a name to the plot, and end its command with a semicolon, then we get a plot, below.

                  2) if we DO give a name to the plot, but still end its command with a semicolon, we will instead be shown a

                          complete list of the numerical values that it would have plotted.

                 3) if we DO give a name, but now end its command with a full colon, it will simply save all those numbers under

                          that name, so that we may then do something else with that set of numbers, as we do below, using "display."

>    quadr:=DEplot(fullsys,[x(t),y(t),vx(t),vy(t)],t=0..100,fullinit,x(t)=0..400,y(t)=-1500..+40,scene=[x(t),y(t)],stepsize=1/100,title=`quadratic drag`):

>    quadrsm:=DEplot(fullsys,[x(t),y(t),vx(t),vy(t)],t=0..100,fullinit,x(t)=0..150,y(t)=-100..+40,scene=[x(t),y(t)],stepsize=1/50,title=`quadratic drag\n close view`):

>    quadrlg:=DEplot(fullsys,[x(t),y(t),vx(t),vy(t)],t=0..100,fullinit,x(t)=0..350,y(t)=-5000..+40,scene=[x(t),y(t)],stepsize=1/100,title=`quadratic drag`):

   Below we will use the display command to show 2 different plots on the same axes.  

   It lives in the additional package included just below.

>    with(plots):

Warning, the name changecoords has been redefined

   The three plot commands below are with the same three sets of ranges as above, but are for

     the trajectory with zero drag.

>    non:=plot(vy0*x/vx0-g*x^2/(2*vx0^2),x=0..600,y=-1500..40):

>    nonsm:=plot(vy0*x/vx0-g*x^2/(2*vx0^2),x=0..150,y=-100..40):

>    nonlg:=plot(vy0*x/vx0-g*x^2/(2*vx0^2),x=0..500,y=-5000..40):

   The command below allows, as before, to view the syntax for this command.

>    ?display

   Now we will plot the quadratic drag and the zero drag together, to view the differences, in the

    three different pieces of the trajectory:

  In the display below, notice how the trajectory with drag does not rise quite as high, comes back to the

   ground at a lesser distance than without drag, and that that lesser distance continues to become smaller

    as it goes further and further down the side of the cliff.

  Nonetheless, the trajectories do not really look very different, except in these numerical details.

>    display({quadrsm,nonsm});

[Maple Plot]

  Now, we plot the two trajectories over a broader range, i.e., a much higher cliff.

   The differences above the top of the cliff are now too small to be noticed; however,

   it is clear that they are beginning to diverge more and more.

>    display({quadr,non});

[Maple Plot]

In this comparison of the two trajectories, we can see that x(t) has in fact come to some limiting value, and will

  NOT go any further, while the one without drag is continuing to go onward and onward.

>    display({quadrlg,nonlg});

[Maple Plot]

>