(*^ ::[ 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, 12, "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, l36, o74, w336, h151, 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; initialization; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981] Your Assignment: 1) Execute the entire notebook. Experiment if you like. 2) Do Problem 21 & Problem 51 as best you can. 3) Hand in Prob.21 and Prob.51 ;[s] 2:0,0;16,1;154,-1; 2:1,19,14,Times,1,18,0,0,0;1,16,12,Times,1,14,0,0,0; :[font = section; inactive; initialization; Cclosed; preserveAspect; startGroup] Initialization: (Don't read this; just execute it) (Click on the outer bracket--far right--and hit the ENTER key. ;[s] 2:0,0;17,1;115,-1; 2:1,19,14,Times,1,18,0,0,0;1,16,12,Times,1,14,0,0,0; :[font = text; inactive; initialization; preserveAspect] Define the cross product: :[font = input; initialization; preserveAspect] *) Needs["LinearAlgebra`CrossProduct`"] (* :[font = input; initialization; preserveAspect] *) Off[ General::spell ]; Off[ General::spell1]; (* :[font = input; initialization; preserveAspect; startGroup] *) Clear["Global`*"]; VectorPlot[list__List?VectorQ]:= VectorPlot[{list}]; VectorPlot[list_List?MatrixQ]:= Module[{xlist,length,totList}, xlist=Join[{{0,0}},list]; length=Length[xlist]; totList=Table[ Sum[ xlist[[i]] ,{i,1,j}],{j,1,length}]; Return[ Show[Graphics[{Thickness[0.015],Line[totList]} ,{GridLines->Automatic ,Axes->True}]] ] ]; (* :[font = message; inactive; preserveAspect; startGroup] SetDelayed::write: Tag VectorPlot in VectorPlot[(list__List)?VectorQ] is Protected. :[font = message; inactive; preserveAspect; endGroup; endGroup] SetDelayed::write: Tag VectorPlot in VectorPlot[(list_List)?MatrixQ] is Protected. :[font = input; initialization; preserveAspect; startGroup] *) VectorPlot3D[list__List?VectorQ]:= VectorPlot3D[{list}]; VectorPlot3D[list_List?MatrixQ]:= Module[{xlist,length,totList}, xlist=Join[{{0,0,0}},list]; length=Length[xlist]; totList=Table[ Sum[ xlist[[i]] ,{i,1,j}],{j,1,length}]; Return[ Show[Graphics3D[{Thickness[0.015],Line[totList]} ,{ FaceGrids->{{0,0,-1},{0,1,0},{-1,0,0}} ,BoxRatios->{1,1,1} ,Axes->True}]] ] ]; (* :[font = message; inactive; preserveAspect; startGroup] SetDelayed::write: Tag VectorPlot3D in VectorPlot3D[(list__List)?VectorQ] is Protected. :[font = message; inactive; preserveAspect; endGroup; endGroup] SetDelayed::write: Tag VectorPlot3D in VectorPlot3D[(list_List)?MatrixQ] is Protected. :[font = input; initialization; preserveAspect; startGroup] *) VectorLength[vector_List?VectorQ]:=Sqrt[vector.vector] (* :[font = message; inactive; preserveAspect; startGroup] SetDelayed::write: Tag VectorLength in VectorLength[(vector_List)?VectorQ] is Protected. :[font = output; output; inactive; preserveAspect; endGroup; endGroup] $Failed ;[o] $Failed :[font = input; initialization; preserveAspect; endGroup] *) Protect[{VectorPlot,VectorPlot3D,VectorLength}]; Off[Clear::wrsym]; (* :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] 2-Dimensional Vectors: Warmup :[font = text; inactive; preserveAspect] Define three 2-Dimensional vectors: :[font = input; preserveAspect] Clear["Global`*"]; v1={1,0}; v2={1,1}; v3={-3,1}; :[font = input; preserveAspect] VectorPlot[v1,v2,v3]; :[font = text; inactive; preserveAspect] Find the length of the sum. Does this match the plot??? :[font = input; preserveAspect] VectorLength[v1+v2+v3] :[font = text; inactive; preserveAspect; endGroup] Define 3 2-Dimensional vectors: :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] 3-Dimensional Vectors: Warmup :[font = input; preserveAspect] Clear["Global`*"]; VectorPlot3D[{1,1,1},{1,-1,-1},{1,2,3}]; :[font = text; inactive; preserveAspect] Find the length of the sum. Does this match the plot??? :[font = input; preserveAspect; endGroup] VectorLength[{1,1,1}+{1,-1,-1}+{1,2,3}] :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Ch 3: Problem 5 :[font = text; inactive; preserveAspect] Let us define the 3 vectors needed. We have to work a little bit for v3. Note how I convert from Radians to Degrees. Sorry, but the natural unit for trigonometric functions is Radians. :[font = input; preserveAspect] Clear["Global`*"]; v1={50,0}; v2={0,30}; v3={25 Cos[60/Degree], 25 Sin[60/Degree]} //N :[font = text; inactive; preserveAspect] Let us look at the path that the car took. Can you estimate from the figure the length of the final displacement vector??? :[font = input; preserveAspect] VectorPlot[v1,v2,v3]; :[font = text; inactive; preserveAspect] Let 's compute the total length. Does it match the figure??? :[font = input; preserveAspect] v4=v1+v2+v3; {v4x,v4y}=v4 :[font = input; preserveAspect] VectorLength[v1+v2+v3] :[font = text; inactive; preserveAspect] Let 's compute the angle. Note I have to convert from Radians to Degrees. :[font = input; preserveAspect; endGroup] theta=ArcTan[v4y/v4x] /Degree //N :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Ch 3: Problem 9 :[font = text; inactive; preserveAspect] Here, we get the magnitude and direction. Again, I have to convert :[font = input; preserveAspect] Clear["Global`*"]; r=7.3; theta=250 Degree :[font = input; preserveAspect] a={r Cos[theta], r Sin[theta]} //N :[font = input; preserveAspect; endGroup] {ax,ay}=a :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Ch 3: Problem 21 :[font = text; inactive; preserveAspect; endGroup] This is easy with Mathematica. Give it a try. Find the vector sum of c={7.4, -3.8, -6.1} and d={4.4, -2.0, 3.3} where r=c+d ;[s] 3:0,0;47,1;125,0;126,-1; 2:2,13,9,Times,0,12,0,0,0;1,16,12,Times,0,14,0,0,0; :[font = section; inactive; pageBreak; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Ch 3: Problem 22 :[font = text; inactive; preserveAspect] Let's define the necessary vectors. :[font = input; preserveAspect] Clear["Global`*"]; a={4,3}; b={-13,7}; c=a+b :[font = text; inactive; preserveAspect] Let's see what they look like. Can you guess at the angle and magnitude of the total vector c??? :[font = input; preserveAspect] VectorPlot[a,b]; :[font = text; inactive; preserveAspect] Let's calculate the length. :[font = input; preserveAspect] VectorLength[c] //N :[font = text; inactive; preserveAspect] To find the angle, we need the x and y components of c. Here is an easy way to do it. :[font = input; preserveAspect] {cx,cy}=c :[font = text; inactive; preserveAspect] The Tangent is the ratio of y/x. :[font = input; preserveAspect] tanTheta=cy/cx :[font = text; inactive; preserveAspect] Now we take the ArcTan (Inverse Tangent) and convert to degrees. :[font = input; preserveAspect] theta=ArcTan[tanTheta] /Degree //N :[font = text; inactive; preserveAspect] Note that we get the wrong Quadrant by using the math. Use the figure to see that the correct answer is: :[font = input; preserveAspect; endGroup] theta+180 :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Ch 3: Problem 48 :[font = text; inactive; preserveAspect] Let's define the necessary vectors. :[font = input; preserveAspect] Clear["Global`*"]; a={3,3,3}; b={2,1,3}; :[font = text; inactive; preserveAspect] Let's calculate the length. :[font = input; preserveAspect] alength=VectorLength[a] :[font = text; inactive; preserveAspect] Let's calculate the length. :[font = input; preserveAspect] blength=VectorLength[b] :[font = text; inactive; preserveAspect] The cosine is given by: (Note the DOT product between the vectors a and b.) :[font = input; preserveAspect] cosTheta=a.b/(VectorLength[a] VectorLength[b]) :[font = text; inactive; preserveAspect] Now we take the ArcCos (Inverse Cosine) and convert to degrees. :[font = input; preserveAspect] theta=ArcCos[cosTheta] /Degree //N :[font = input; preserveAspect; endGroup] Show[ VectorPlot3D[a],VectorPlot3D[b] ]; :[font = section; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Ch 3: Problem 51 :[font = text; inactive; preserveAspect] Let's define the necessary vectors. Note that I make both a and b 3-dimensinal vectors by including a zero term for the z component. We only know how to compute a cross product in 3-dimensions. :[font = input; preserveAspect] Clear["Global`*"]; a={3,5,0}; b={2,4,0}; :[font = subsection; inactive; preserveAspect] Part a) :[font = text; inactive; preserveAspect] The Cross product for vectors was defined by loading in the package LinearAlgebra`CrossProduct with the command Needs["LinearAlgebra`CrossProduct`"]. Let us see what Mathematica knows about Cross. ;[s] 3:0,0;167,1;178,0;198,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,2,12,0,0,0; :[font = input; preserveAspect; startGroup] ?Cross :[font = info; inactive; preserveAspect; endGroup] Cross[vec1, vec2] gives the vector product of the 3-vectors vec1 and vec2. :[font = text; inactive; preserveAspect] Let us compute axb. :[font = input; preserveAspect] Cross[a,b] :[font = text; inactive; preserveAspect] axb should be the negative of bxa. Is this true??? :[font = input; preserveAspect] Cross[b,a] :[font = text; inactive; preserveAspect] If I had to do it by hand, I would first define the matrix: :[font = input; preserveAspect] matrix= {{vx,vy,vz},a,b}; matrix //MatrixForm :[font = text; inactive; preserveAspect] and then take the Det (determinant) of this matrix. :[font = input; preserveAspect] Det[matrix] :[font = text; inactive; preserveAspect] We get the same answer. :[font = subsection; inactive; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] You do part b) and c). (They are very easy.) :[font = text; inactive; preserveAspect; fontSize = 14] Two vectors are given by: a={3,5,0} and b={2,4,0} Find: a.b (the dot product) (a+b).b Note, we use the period "." for the dot product. Or you can use Dot[a,b] ;[s] 5:0,0;61,1;67,0;102,1;109,0;183,-1; 2:3,16,12,Times,0,14,0,0,0;2,16,12,Times,1,14,0,0,0; :[font = input; preserveAspect; startGroup] ?. :[font = info; inactive; preserveAspect; endGroup; endGroup; endGroup] a.b.c or Dot[a, b, c] gives products of vectors, matrices and tensors. ^*)