Example 11
Symbolic and Numerical Solutions to 
Differential Equations II

Copyright © 1993 by Bill Titus, Carleton College, 
Department of Physics and Astronomy, Northfield, MN  55057-4025
September 6, 1993

Topics and Skills

Problem

Solution - Part a

Step 1 - Find the symbolic solution to the DEQ of the SHO without specifying any initial conditions.  Call your result  soln1.

Comment 1

Step 2 - Repeat Step 1, but now specify the initial conditions
x[0] == xo  and  x'[0] == vo  by placing these equations in DSolve[]'s equation list along with the DEQ.  Call the result   soln2.

Comment 2

Step 3 -  Load the package  "Algebra`Trigonometry`"  by placing this context as the argument in  Needs[].  You'll need to include the double quotes in the argument.  Then find out what you can about the function  ComplexToTrig[].

Comment 3

Step 4 - Find out what other functions exist in the package you just loaded by typing in  ?Algebra`Trigonometry`* .

Comment 4

Step 5 - Apply  ComplexToTrig[]  to both  soln1  and   soln2,  and then apply  Simplify[]  to your results to make them look nicer, using postfix notation.  Call your new results  soln3  and  soln4, respectively.

Step 6 - Now solve the SHO as a coupled set of first order DEQ

       dv[t]/dt == -w^2 x[t]
   dx[t]/dt == v[t] 

subject to the initial conditions  x[0] == xo  and  v[0] == vo.  Call the result   soln5.  Then convert your solutions to trig functions, simplify the expressions as much as possible, and call the final result  soln6.

Comment 6

Step 7 - Using the appropriate parts of  soln6  (like, for example,  soln6[[1,1,2]]), create position and velocity functions that depend on  t,  w,  xo,  and  vo.  Then use  Plot[]  to display  x[t] and  v[t]  as functions of time.  Finally, use  ParametricPlot[]  to draw a phase plot, i.e,  a plot of  x[t]  versus  v[t].   For plotting purposes, assume that  w = 1.0,   xo = 1.0,   vo = 0.0,  and  0.0 < t < 10.0.

Comment 7

Step 8 - Create an extended phase space plot by including a third axis that corresponds to time.  What command do you think would plot this type of three dimensional, parametric curve?  Find the command and create the plot.  However, to begin with, don't use any plot options.

Comment 8

Step 9 - Look at the options for  ParametricPlot3D[].  Find the one that will allow you to look at the plot from different view points.

Comment 9

Step 10 - Find out about  ViewPoint  and use it to look at your plot from different angles.  Also, label your axes using an appropriate plot option.

Comment 11

Step 12 - Position your curor in your ParametricPlot[]  command just before the final left bracket of the command.  Then select the menu item    Action \ PrepareInput \ 3D ViewPoint Selector   and rotate the 3D box until you get a view of the plot that appeals to you.   Press  Insert  or  Paste  and the corresponding  ViewPoint  option will be inserted into your  ParametricPlot[]  command.  Finally  <Enter>  your results.

Solution - Part b

Step 1 - Solve the damped SHO for the position and velocity as functions of time for initial conditions  x[0] = xo  and  v[0] = vo.  Do this by solving a set of two, first order coupled DEQ.  Call your result  soln7.

Comment 1

Step 2 - Solve the DSHO numerically using  NDSolve[].  Assume that  xo = 1.0,  vo = 0.0,  w = 1.0,   b = 0.3,  and  0.0 < t < 20.0.  Call your result  soln8.

Step 3 - Create velocity and position functions and use them to produce the same type of two dimensional plots as you did for the SHO.

Save Your Notebook