(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 14, "Times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, groupLikeGraphics, M7, l34, w402, h167, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = leftheader, inactive, L2, 12, "Times"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; fontset = leftfooter, inactive, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; paletteColors = 128; currentKernel; ] :[font = section; inactive; Cclosed; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Example 1: Visualize Relation Between {x,v,a} Things to do: 1) Try different function x[t] ;[s] 5:0,0;51,1;52,3;53,4;97,2;98,-1; 5:1,19,14,Times,1,18,0,0,0;1,16,12,Times,1,14,0,0,0;1,13,9,Times,1,12,0,0,0;1,13,9,Times,1,12,65535,0,0;1,16,12,Times,1,14,65535,0,0; :[font = input; preserveAspect] Clear["Global`*"] :[font = text; inactive; preserveAspect] Let's pick a simple function to investigate the relation between {x,v,a}. Later we can make other choices such as x = x0 + v0 t + 1/2 a x. Note how we can use the short-hand notation for derivatives. :[font = input; preserveAspect] x[t_]= Sin[t]; v[t_]= x'[ t]; a[t_]= x''[t]; :[font = text; inactive; preserveAspect] This is rather simple to do in Mathematica, but many students have not had the tools to easily plot functions. ;[s] 3:0,0;31,1;42,0;112,-1; 2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = input; preserveAspect] Plot[x[t],{t,0,10}]; :[font = input; preserveAspect] Plot[v[t],{t,0,10}]; :[font = input; preserveAspect] Plot[a[t],{t,0,10}]; :[font = text; inactive; preserveAspect] We can arrange them side-by-side, :[font = input; preserveAspect] Show[ GraphicsArray[ {Plot[x[t],{t,0,10}] ,Plot[v[t],{t,0,10}] ,Plot[a[t],{t,0,10}] } ] ]; :[font = text; inactive; preserveAspect] or overlay them with colors. :[font = input; preserveAspect] Plot[{x[t],v[t],a[t]} ,{t,0,10} ,PlotStyle->{{Thickness[0.012],RGBColor[1,0,0]} ,{Thickness[0.008],RGBColor[0,1,0]} ,{Thickness[0.004],RGBColor[0,0,1]} } ]; :[font = text; inactive; preserveAspect] We can also make a table of {t,x} coordinates points :[font = input; preserveAspect] tab1= Table[ {t,x[t]},{t,0,10,1}] //N :[font = text; inactive; preserveAspect] and plot these with ListPlot. :[font = input; preserveAspect] ListPlot[ tab1 ,PlotStyle->{PointSize[0.05]}]; :[font = text; inactive; preserveAspect; endGroup] Note how the points are more closely spaced at the top and bottom. :[font = section; inactive; Cclosed; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Problem 2: 2-Dimensional Projectile Motion: Things to do: 1) Anaytically and Numerically, find the time when the projectile returns to the ground (x=0). Find the final velocity at this point. 2) Anaytically and Numerically, find the time when the projectile reaches the maximum height. Find the final velocity at this point. 3) Can you generate different trajectories, as a function of {v0, theta}, that yield idential final positions. 4) Can you find a formula for the range of a projectile as a function of {v0, theta}. ;[s] 4:0,0;47,1;48,2;532,1;533,-1; 3:1,19,14,Times,1,18,0,0,0;2,13,9,Times,1,12,0,0,0;1,16,12,Times,1,14,65535,0,0; :[font = input; preserveAspect] Clear["Global`*"] :[font = text; inactive; preserveAspect] Let's now consider 2-Dimensional motion. We'll take y as vertical, with gravity acting in the negative y direction, and x as horizontal. Therefore, we set the y-acceleration to -g, and the x-acceleration to 0. :[font = input; preserveAspect] ax= 0; ay=-g; :[font = text; inactive; preserveAspect] Let's assume that this object is shot from a cannon with an initial velocity v0, and an initial angle. :[font = input; preserveAspect] vy0= v0 Sin[theta]; vx0= v0 Cos[theta]; :[font = text; inactive; preserveAspect] Now we can define the horizontal quantities, :[font = input; preserveAspect] x[t_]= x0 + vx0 t + (1/2) ax t^2 vx[t_]= x'[ t] ax[t_]= x''[t] :[font = text; inactive; preserveAspect] and the vertical quantities, :[font = input; preserveAspect] y[t_]= y0 + vy0 t + (1/2) ay t^2 vy[t_]= y'[ t] ay[t_]= y''[t] :[font = text; inactive; preserveAspect] Let's pick some specific values for plotting purposes, :[font = input; preserveAspect] values={v0->100, theta->Pi/3, x0->0, y0->0, g->10}; :[font = text; inactive; preserveAspect] and check that these yield numeric results (before we put them in a plotting function and get an error). :[font = input; preserveAspect] {x[t],y[t]} /.values /.{t->5} //N :[font = text; inactive; preserveAspect] Let's look: :[font = input; preserveAspect] ParametricPlot[ {x[t],y[t]} /.values ,{t,0,15}]; :[font = section; inactive; preserveAspect; cellOutline; endGroup] Things to do: 1) Anaytically and Numerically, find the time when the projectile returns to the ground (x=0). Find the final velocity at this point. 2) Anaytically and Numerically, find the time when the projectile reaches the maximum height. Find the final velocity at this point. 3) Can you generate different trajectories, as a function of {v0, theta}, that yield idential final positions. 4) Can you find a formula for the range of a projectile as a function of {v0, theta}. ;[s] 2:0,0;15,1;485,-1; 2:1,19,14,Times,1,18,0,0,0;1,16,12,Times,1,14,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Example 3: Falling Object: Numeric Solution: No Air Resistance: :[font = input; preserveAspect] Clear["Global`*"] :[font = text; inactive; preserveAspect] We start with Newton's 2nd equation, and balance F = m a. The gravitational force is given by -mg (taking up as positive), and the air resistance force is opposite the direction of the velocity (hence the negative sign) - b x'[t]. ;[s] 7:0,0;49,1;56,0;95,1;99,0;222,1;231,0;234,-1; 2:4,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = input; preserveAspect] eq1= -m g - b x'[t] == m x''[t] :[font = text; inactive; preserveAspect] We specify the initial conditions for the postition and velocity: :[font = input; preserveAspect] initial={x[0]==x0,x'[0]==v0}; :[font = text; inactive; preserveAspect] We choose some specific numerical values so we can solve the equations numerically. :[font = input; preserveAspect] values={x0->0, v0->100, g->10, m-> 10}; :[font = text; inactive; preserveAspect] The complete set of equations is: (Note, I've set b=0 to eliminate the air resistance.) :[font = input; preserveAspect] equations= Join[{eq1},initial] /.values /.{b->0} :[font = text; inactive; preserveAspect] Mathematica has a very powerful numeric differential equation solver. ;[s] 2:0,1;11,0;71,-1; 2:1,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = input; preserveAspect] dsol1= NDSolve[equations , x, {t,0,20}][[1]] :[font = text; inactive; preserveAspect] Note how I can take derivatives even though this is a numeric function. Each function is an InterpolatingFunction, and the allowed range for the argument is specified by the first pair of arguments. ;[s] 3:0,0;93,1;114,0;201,-1; 2:2,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; preserveAspect] x[t_]= x[t] /.dsol1 /.values v[t_]= D[ x[t] ,t] a[t_]= D[ v[t] ,t] :[font = text; inactive; preserveAspect] We plot {x,v,a}: :[font = input; preserveAspect] Plot[x[t],{t,0,20}]; :[font = input; preserveAspect] Plot[v[t],{t,0,20}]; :[font = input; preserveAspect] Plot[a[t],{t,0,20}]; :[font = text; inactive; preserveAspect] Here we overlay the plots (with some numerical factors) so we can see the relation between the curves. (Note, we are plotting apples and oranges since {x,v,a} have different units.) :[font = input; preserveAspect; endGroup] Plot[{x[t], 5 v[t], 25 a[t]} ,{t,0,20} ,PlotStyle->{{Thickness[0.012],RGBColor[1,0,0]} ,{Thickness[0.008],RGBColor[0,1,0]} ,{Thickness[0.004],RGBColor[0,0,1]} } ]; :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Problem 4: Falling Object: Numeric Solution: With Air Resistance: Things to do: 1) Regenerate with finite b. 2) Compare {x,v,a} for large and small b. ;[s] 4:0,0;72,1;73,2;158,1;159,-1; 3:1,19,14,Times,1,18,0,0,0;2,16,12,Times,1,14,0,0,0;1,16,12,Times,1,14,65535,0,0; :[font = text; inactive; preserveAspect; fontColorRed = 65535; endGroup] Copy and modify from above. :[font = section; inactive; Cclosed; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Example 5: Falling Object: Analytical Solution: No Air Resistance: :[font = input; preserveAspect] Clear["Global`*"] :[font = text; inactive; preserveAspect] We start with Newton's 2nd equation, and balance F = m a. The gravitational force is given by -mg (taking up as positive), and the air resistance force is opposite the direction of the velocity (hence the negative sign) - b x'[t]. ;[s] 7:0,0;49,1;56,0;95,1;99,0;222,1;231,0;234,-1; 2:4,16,12,Times,0,14,0,0,0;3,13,10,Courier,1,12,0,0,0; :[font = input; preserveAspect] eq1= -m g - b x'[t] == m x''[t] /.{b->0} :[font = text; inactive; preserveAspect] We specify the initial conditions for the postition and velocity: :[font = input; preserveAspect] initial={x[0]==x0,x'[0]==v0}; :[font = text; inactive; preserveAspect] We can solve the equations analytically. :[font = input; preserveAspect] dsol1= DSolve[Join[{eq1},initial], x, t][[1]] :[font = text; inactive; preserveAspect] We choose some numeric values for plotting purposes. :[font = input; preserveAspect] values={x0->0, v0->100, g->10, m-> 10}; :[font = text; inactive; preserveAspect] We define {x,v,a} as a function of time, and the damping coefficient b. :[font = input; preserveAspect] x[t_,b_]= x[t] /.dsol1 /.values v[t_,b_]= D[ x[t,b] ,t] a[t_,b_]= D[ v[t,b] ,t] :[font = text; inactive; preserveAspect] We plot {x,v,a} as a function of time. :[font = input; preserveAspect] Plot[x[t,1],{t,0,20}]; :[font = input; preserveAspect] Plot[v[t,1],{t,0,20}]; :[font = input; preserveAspect] Plot[a[t,1],{t,0,20}]; :[font = text; inactive; preserveAspect] Here we overlay the plots (with some numerical factors) so we can see the relation between the curves. (Note, we are plotting apples and oranges since {x,v,a} have different units.) :[font = input; preserveAspect] Plot[{x[t,1], 5 v[t,1], 25 a[t,1]} ,{t,0,20} ,PlotStyle->{{Thickness[0.012],RGBColor[1,0,0]} ,{Thickness[0.008],RGBColor[0,1,0]} ,{Thickness[0.004],RGBColor[0,0,1]} } ]; :[font = text; inactive; preserveAspect] Let's compare the effect of b on the x trajectory. (In this example, there is none because I set b=0. In your example, you will restore the b dependence.) :[font = input; preserveAspect; endGroup] Plot[{x[t,0.1],x[t,1]} ,{t,0,20} ,PlotStyle->{{Thickness[0.012],RGBColor[1,0,0]} ,{Thickness[0.008],RGBColor[0,1,0]} ,{Thickness[0.004],RGBColor[0,0,1]} } ]; :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Problem 6: Falling Object: Analytical Solution: With Air Resistance: Things to do: 1) Regenerate with finite b. 2) Verify that Limit[ x[t], b->0] matches standard result. 3) Compare {x,v,a} for large and small b. 4) Find terminal velocity. ;[s] 3:0,0;74,1;75,2;249,-1; 3:1,19,14,Times,1,18,0,0,0;1,16,12,Times,1,14,0,0,0;1,16,12,Times,1,14,65535,0,0; :[font = text; inactive; preserveAspect; fontColorRed = 65535; endGroup] Copy and modify from above. ^*)