Example 08
Series, Limits, Numerical Determination of Roots of Equations, and Numerical Integration

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

Topics and Skills

1.  Finding limits using  Limit[].
2.  Determining Taylor Series expansions with  Series[]  and  Normal[].
3.  Using  FindRoot[]  to determine the roots of an equation numerically.
4.  Other MMA "root" commands.
5.  Numerical integration with  NIntegrate[].

Problem

Sarah, the rocketeer, is in free fall but is controlling her downward acceleration so that   a[t] = - g e-ct , where  c  is a positive constant.  Assume that Sarah starts at a height  x[0]  above the ground with zero initial velocity.

a.  Set up equations for  v[t]  and  x[t]  as functions of  c  and  t  using  MMA's Integrate[]  function.

b.  Show that these equations reduce to the appropriate free fall results when  c  is zero.

c.  Find the value of the time  to  at which Sarah strikes the ground.

d.  Now suppose  a[t] = -g cos[sin[ct]].   Set up equations for  v[t]  and  x[t]  as functions of  c  and  t  using  MMA's   NIntegrate[]  function.  Then plot  v[t]  and  x[t]  from  t = 0.0  to  t = 8.0  using  x[0] = 100,  g = 9.8, and  c = 0.5.

Solution - Part a

Step 1 - Using  Integrate[], complete the following code that defines  a,  v,  and  x  as functions of  c  and  t.

Clear[c, g, xo, a, v, x, t, s]
a[c_, t_] = -g Exp[-c t]
v[c_, t_] =
x[c_, t_] = xo +

Comment 1

1.  Do your results look reasonable?

Solution - Part b

Step 1 - Try to evaluate your functions at  c = 0.  Describe what happens.

Comment 1

1.  Infinities and indeterminate results occur for  v  and  x.
     a.  Infinity  is a positive real infinite quantity.
     b.  -Infinity  is a negative real infinite quantity.
     c.  ComplexInfinity  is a quantity with infinite magnitude, but 
         undetermined complex phase.
     d.  Indeterminate  is a numerical quantity whose magnitude can't be 
         determined.

Step 2 - You can find the limiting results using a MMA function.  Any guess what it's called?  Use Appendix 8 in Wolfram to find out about this command and then apply the command to determine the three desired limits.

Step 3 - Some physicists would find these limits by doing Taylor Series expansions on the functions about  c = 0.   Find out information about the MMA command  Series[]  and apply it to determine the Taylor Series expansion of  x[c, t] to third order.  Name the latter expression  xSeries  so you can refer to it later.

Comment 3

1.  What's the error message telling you?
2.  What's the meaning of the term   O[c]4?

Step 4 - For  c = 0.5,   xo = 100,  and  g = 9.8,  plot the third order approximation to  x[c, t]  and the corresponding exact result on the same graph.  To convert  xSeries  into a function, you must first remove the order term.  To do so, use the MMA command  Normal[].  Find out about this command and use it to produce a function  xApprox[c, t] which gives the desired third order approximation.  Then create the plot over the time interval between  t = 0.0  and  t = 8.0.

Comment 4

1.  What  Plot[]  options did you used? 
2.  How might you effectively use color in your plot?

Solution - Part c

Step 1 - Try to use  Solve[]  to find the time  to  at which Sarah strikes the ground.  Be sure to use  Clear[g, xo, c, to]  before you invoke  Solve[].  Why?   What do you find?

Comment 1

1.  Did you use double equal signs for the equation?
2.  Remember, if MMA can't valuate something, it will echo what you typed back to the screen.
3.  Why can't this equation to solved symbolically.
4.  What are two possible ways you might solve it?

Step 2 - Assume c = 0.5,  xo = 100,  and  g = 9.8.  First make a plot of  x[c, t]  to estimate the time  to  where  x[to]  is zero.  What do you find?

Comment 2

1.  You should find that  to  is about  7.1.  Remember, you can press the  <Command>  key and move the mouse to read off coordinates from a graph.

Step 3 -  You can improve your estimation by numerically determining the root of the equation  x[0.5, t] == 0.  The MMA command to do this numerical calculation is  FindRoot[].  Find out information about this command and use it to determine  to.  Call the result  myRoot.  Then find the values for  x[to]  and  v[to]  using replacement rules.

Comment 3

1.  The  FindRoot[]  algorithm uses Newton's method, so the derivatives can't be too small.  If there are multiple zeros, you may not get the root you want -- that's why a graph is very helpful.
2.  There are other MMA functions that find roots of equations:  Roots[],  NRoot[],  and  NSolve[].  You may want to explore these commands later.

Solution - Part d

Step 1 - Suppose Sarah's acceleration is given by  -g cos[sin[c t]]  with  c = 0.5,  xo = 100, and  g = 9.8.  Cut and paste the equations from Step 1 of Part a.  Change the expression for the acceleration to the desired form and activate the cell.  What the output implying?

Comment 1

1.  If you can't integrate something symbolically, what might you try?

Step 2 - Get information of the MMA command  NIntegrate[].  What do you find?  Apply this function to determine the following integrals

1/(1 + Exp[x])         from  0  to  Infinite
Exp[Cos[x]]            from  0  to  2 Pi
Sin[x] BesselJ[0, x]   from  0  to  1

Step 3 -  The following code defines  v  and  x  in terms of   NIntegrate[].  Look over the code and then activate the cell.

Clear[c, g, xo, a, v, x, t, s]
a[c_, t_] = -g Cos[Sin[c t]];
v[c_, t_] := NIntegrate[a[c, s], {s, 0, t}]
x[c_, t_] := xo + NIntegrate[v[c, s], {s, 0, t}]

Comment 3

1.  Why is  SetDelayed[]  used to define  v[]  and  x[]?
1.  Note that  SetDelayed[]  does not echo its results to the screen.

Step 4 -  Use these function to plot Sarah's velocity and position from  t = 0.0  and  t = 8.0  for the parameters  g = 9.8,  xo = 100, and  c = 0.5.  Be sure to label the axes on your plot.

Comment 4

1.  Why did it take so long to do the plots?

Save Your Notebook

Remove any output cells from this notebook and then use  Save As  to store your notebook under the name  myEx08.