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 2:  Projectile in a Uniform Gravitational Field

Part (a)

eq1  = 
       {m  x''[t] ==  0,  m  z''[t] == -m  g}

\(initial1 = {x[0] == 0, \ x[tf] == xf, 

        		\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ z[0] == 0, \ z[tf] == zf}
        \)

dsol1  = 
      DSolve[Join[eq1, initial1], {x[t], z[t]}, t] // Flatten // Simplify

Part (b)

values1  =  {xf -> 300,  zf -> 0,  g -> 9.81}

coord1[tf_]  =  {x[t], z[t]} /. dsol1 /. values1

\(Clear[plot1]; 

    plot1[tf_] := \ 
      ListPlot[
		Evaluate[Table[coord1[tf], {t, 0, tf, 0.5}]]
	, 
        PlotStyle -> PointSize[0.02]
	, \ GridLines -> Automatic
	, 
        DisplayFunction -> Identity]\)

plotarray2  =  Table[plot1[tf], {tf, 5, 15, 5}];

\(\(Show[plotarray2
			, DisplayFunction -> $DisplayFunction]; \)\)

Part (c)

\(\(initial2\  = 
      \ {x[0] == 0, \ \(x'\)[0] == vo\ Cos[alpha], 

        		\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ z[0] == 0, \ 
        \(z'\)[0] == vo\ Sin[alpha]}; \)\)

\(dsol2\  = 
      \(DSolve[Join[eq1, initial2], {x[t], z[t]}, t]

          \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  // Flatten\) // Simplify\)

eq2  =  D[z[t]  /.  dsol2,  t] == 0

tsol  =  Solve[eq2, t] // Flatten

pmax  =  {x[t], z[t]} /. dsol2 /. tsol

Part (d)  Plot trajectories with α = {π/8, 2π/8, 3π/8}

values2  =  {g -> 9.81,  vo -> 100};

coord2[alpha_]  =  {x[t], z[t]}  /.  dsol2  /.  values2

\(Clear[plot2]; 

    plot2[alpha_]\  := 
	
      ListPlot[Evaluate[
			Table[coord2[alpha], {t, 0, 20, 1}]]

        	\ \ \ \ \ \ \ \ , PlotStyle -> PointSize[0.02]
		\ \ \ \ \ \ , 
        Frame -> True
		\ \ \ \ \ \ , 
        PlotLabel -> \((" Same Initial and Final Positions ")\)

        	\ \ \ \ \ \ \ \ , GridLines -> Automatic
		\ \ \ \ \ \ , 
        FrameLabel -> {"x[t]", "z[t]", "Distance", "Height"}

        	, DisplayFunction -> Identity]\)

plotarray2  =  Table[plot2[alpha], {alpha, Pi/8, 3  Pi/8, Pi/8}];

\(\(Show[plotarray2
	, PlotRange -> {{0, 1000}, {0, 500}}
	, 
      RotateLabel -> False
	, DisplayFunction -> $DisplayFunction]; \)\)