2. General Physics

Setup

\(Clear["Global`*`"]; 
Off[General::spell]; 
Off[General::spell1]; 
    \)

Get["D:\Mma\Inits\ch1init.m"]

Get["D:\Mma\Inits\ch2init.m"]

2.4 Problems

2.4.1  Projectile Motion in a Constant Gravitational Field

Problem 3:  Projectile with Air Resistance

Part (a)  Solve for position and velocity;
              find terminal velocity.

\(eq1\  = 
      \ {\ m\ \(v'\)[t]\  == \ \(-m\)\ g\  - b\ \(z'\)[t], 

        		\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
        \(z'\)[t]\  == \ 
          v[t]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\)

initial  =  {z[0] == z0,  z'[0]  ==  v0};

\(dsol\  = \ 
      \((\(DSolve[Join[eq1, initial], \ {v, z}, t]
	 // Flatten\)
		 // 
          Simplify\ )\)\)

{v[t], z[t]} /. dsol

vLimit  =  v[t] /. dsol /. {t ->  large m/b} // ExpandAll

vInf  =  Limit[vLimit,  large  ->  Infinity]

{zo[t], vo[t]}  =  Limit[{z[t], v[t]} /. dsol,  b -> 0]

Part (b)  Plot position for b={0, 1/2, 1}.

values1  =  {g -> 9.81,  m -> 1,  z0 -> 0,  v0 -> 0};

coordinates1[b_] =  {t, z[t]} /. dsol /. values1 // Simplify

coordinates1[0] =  {t, zo[t]} /. values1

\(Clear[plot1]; 

    plot1[b_]\  := \ 
      ParametricPlot[Evaluate[coordinates1[b]]
		\ \ , \ {t, 0, 10}

        			, DisplayFunction -> Identity]\)

plotarray1 = Table[plot1[b], {b, 0, 1, 1/2}];

\(\(Show[plotarray1
	, 
      Graphics[{
          Text[FontForm["b=0  ", {"Courier", 10}], {6, \(-200\)}]

          		\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ , 
          Text[FontForm["b=1/2", {"Courier", 10}], {8, \(-150\)}]

          			\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ , 
          Text[FontForm["b=1  ", {"Courier", 10}], {9, \(-50\)}]

          			\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }]
\ \ , 
      Frame -> True
	, GridLines -> Automatic
	, 
      FrameLabel -> {"t", "z"

          				\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ , 
          "Effect of Air Resistance", "z"}
	, 
      DisplayFunction -> $DisplayFunction]; \)\)

Part (c)  Plot speed for b={0, 1/2, 1}.

coordinates2[b_] =  {t, v[t]} /. dsol /. values1 // Simplify

coordinates2[0] =  {t, vo[t]} /. values1

coordinates3[b_] =  {t, vInf} /. dsol /. values1 // Simplify

coordinates3[0] =  {t, 0} /. values1

\(Clear[plot2]; 

    plot2[b_]\  := \ 
      ParametricPlot[Evaluate[{coordinates2[b], coordinates3[b]}], 
        \ {t, 0, 10}
			, DisplayFunction -> Identity]\)

plotarray2 = Table[plot2[b], {b, 0, 1, 1/2}];

\(\(Show[plotarray2
	, 
      Graphics[{
          Text[FontForm["b=0  ", {"Courier", 10}], {4, \(-25\)}]

          		\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ , 
          Text[FontForm["b=1/2", {"Courier", 10}], {7, \(-15\)}]

          			\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ , 
          Text[FontForm["b=1  ", {"Courier", 10}], {8, \(-5\)}]

          			\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }]
	, 
      PlotRange -> {0, \(-30\)}
\ \ , Frame -> True
	, GridLines -> None

      	, RotateLabel -> False
	, 
      FrameLabel -> {"t", "v"

          				\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ , 
          "Effect of Air Resistance", "v"}
	, 
      DisplayFunction -> $DisplayFunction\ ]; \)\)

Part (d)  Fit data points

dataPoint[t_] :=  
      ({t, z[t] (1.0 + Random[Real, {-0.1, 0.1}])} //. 
            Join[dsol, values1] // N);

dataTable[b_] = Table[dataPoint[t], {t, 0, 20, 1}];

\(b0 = 0.5; 
data = dataTable[b0]\)

fit[t_] = 
      Rationalize[Fit[data, Table[t^i, {i, 2, 5}], t], 10^-4]

exact[t_, b_] =  z[t] /. dsol /. values1

\(\(dataPlot = 
      ListPlot[dataTable[0.5]
	, PlotStyle -> PointSize[0.02]
	, 
        DisplayFunction -> Identity]; \)\)

\(\(fitPlot = Plot[fit[t], {t, 0, 20}
	, DisplayFunction -> Identity]; 
    \)\)

\(\(exactPlot = 
      Plot[exact[t, 0.5], {t, 0, 20}
	, DisplayFunction -> Identity]; 
    \)\)

\(\(Show[dataPlot, fitPlot, exactPlot
	, Frame -> True
	, 
      GridLines -> Automatic
	, 
      FrameLabel -> {"t", "z"
				, 
          "Experimantal Data & Air resistance", "z"}
			\ \ , 
      DisplayFunction -> $DisplayFunction\ ]; \)\)

Part (e)  Determine drag coefficient by fitting the analytic solution

trialfunction  =  z[t] /. dsol /. values1

fit2  =  leastSquares[data, trialfunction, t, {b, 1}]