(*^ ::[ 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, ""; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = input, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, 12, "Courier"; fontset = output, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-4, 12, "Courier"; fontset = message, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier"; fontset = print, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier"; fontset = info, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Times"; fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, ""; fontset = leftheader, inactive, L2, 12, "Times"; fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, 12, ""; fontset = leftfooter, inactive, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, ""; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Courier"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 14, "Times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, ""; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, ""; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, ""; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, ""; paletteColors = 128; automaticGrouping; currentKernel; ] :[font = title; inactive; preserveAspect; startGroup] Example 13 Matrices Applied to the Moment of Inertia Tensor :[font = subsubtitle; inactive; preserveAspect] Copyright ã 1993 by Bill Titus, Carleton College, Department of Physics and Astronomy, Northfield, MN 55057-4025 September 6, 1993 ;[s] 3:0,0;10,1;12,0;133,-1; 2:2,16,12,Times,2,14,0,0,0;1,16,12,Symbol,0,14,0,0,0; :[font = section; inactive; preserveAspect; startGroup] Topics and Skills :[font = special1; inactive; preserveAspect; endGroup] 1. Creating symbolic matrices using Array[]. 2. Using line sequences of equal input to compact code. 3. Factor[]. 4. Eigenvalues[] and Eigenvectors[]. ;[s] 9:0,0;38,1;45,0;108,1;116,0;122,1;135,0;143,1;157,0;159,-1; 2:5,16,12,Times,0,14,0,0,0;4,15,11,Courier,0,14,0,0,0; :[font = section; inactive; preserveAspect; startGroup] Problem :[font = special1; inactive; preserveAspect] Consider a uniform square lamina of side a and mass m lying in the x-y plane with the origin of the cartesian coordinate system at the bottom-left corner of the square, as viewed from above. :[font = special1; inactive; preserveAspect] a. Find the moment of inertia tensor for this object. Recall that for a plane lamina where z = 0, the only non-vanishing elements in the inertia tensor are :[font = special1; inactive; preserveAspect] Ixx = ò ry2 dxdy Ixy = Iyx = -ò rxy dxdy Iyy = ò rx2 dxdy Izz = ò r(x2 + y2) dxdy ;[s] 18:0,0;8,1;14,2;17,1;18,3;19,1;42,2;45,1;63,2;66,1;67,3;68,1;84,2;87,1;89,3;90,1;94,3;95,1;102,-1; 4:1,16,12,Times,0,14,0,0,0;9,15,11,Courier,0,14,0,0,0;4,16,12,Symbol,0,14,0,0,0;4,23,15,Courier,32,14,0,0,0; :[font = special1; inactive; preserveAspect] Here r is the density, and the integrals are taken over the square area. ;[s] 3:0,0;6,1;7,0;75,-1; 2:2,16,12,Times,0,14,0,0,0;1,16,12,Symbol,0,14,0,0,0; :[font = special1; inactive; preserveAspect; endGroup] b. Find the eigenvalues and eigenvectors for the moment of inertia tensor. Recall that these quantities correspond to the principle moments of inertia and the principle axes. :[font = section; inactive; preserveAspect; startGroup] Solution - Part 1 :[font = subsection; inactive; preserveAspect] Step 1 - Generate a symbolic 3 x 3 inertia tensor iTensor using the MMA command Array[]. Denote the symbolic elements of iTensor by iT. ;[s] 11:0,0;31,1;32,0;51,2;58,0;83,2;90,0;126,2;133,0;139,2;141,0;145,-1; 3:6,16,12,Times,1,14,0,0,0;1,15,11,Helvetica,1,14,0,0,0;4,15,11,Courier,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Step 2 - Evaluate the nine elements of the inertia tensor for this particular problem. Do the necessary 2D integrations symbolically using Integrate[]. Display the results in matrix form. You should find that iTensor equals ;[s] 5:0,0;142,1;153,0;215,1;222,0;231,-1; 2:3,16,12,Times,1,14,0,0,0;2,15,11,Courier,1,14,0,0,0; :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{(a^2*m)/3, -(a^2*m)/4, 0}, {-(a^2*m)/4, (a^2*m)/3, 0}, {0, 0, (2*a^2*m)/3}}] ;[o] 2 2 a m -(a m) ---- ------- 3 4 0 2 2 -(a m) a m ------- ---- 4 3 0 2 2 a m ------ 0 0 3 :[font = subsection; inactive; preserveAspect; startGroup] Comment 2 :[font = special1; inactive; preserveAspect; endGroup; endGroup] 1. MMA allows a sequence of inputs of the form z1 = z2 = ... = b on a single line. This shorthand notation can help compact your code, and yet still make it readable. Try it out on your code in Step 2. ;[s] 3:0,0;49,1;66,0;207,-1; 2:2,16,12,Times,0,14,0,0,0;1,15,11,Courier,0,14,0,0,0; :[font = section; inactive; preserveAspect; startGroup] Solution - Part b :[font = subsection; inactive; preserveAspect] Step 1 - One can determine the eigenvalues e of the inertia tensor by finding the roots of the characteristic polynomial, det(iTensor - eI), where I is the identify matrix. First find the characteristic polynomial as a function of e and call it charPoly. The identity matrix in MMA is generated by the function IdentityMatrix[]. How do you think one calculates the determinant of a matrix within MMA? ;[s] 5:0,0;255,1;263,0;323,1;339,0;414,-1; 2:3,16,12,Times,1,14,0,0,0;2,15,11,Courier,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 2 - Your polynomial probably looks a bit ugly. Try factoring it using MMA's function Factor[]. ;[s] 3:0,0;92,1;100,0;102,-1; 2:2,16,12,Times,1,14,0,0,0;1,15,11,Courier,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 3 - Find the three roots of your polynomial equation using Solve[]. Call the result eigenValues. ;[s] 5:0,0;65,1;72,0;92,1;103,0;105,-1; 2:3,16,12,Times,1,14,0,0,0;2,15,11,Courier,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Step 4 - The eigenvector vj corrresponding to the eigenvalue ej satisfies the matrix equation (iTensor - ej I) vj = 0 and corresonds to one of the principle axes of rotation. Because these equations are homogeneous, there will be one arbitrary component in each eigenvector; this component is sometimes fixed by requiring that the eigenvector be normalized. The following code determines the unnormalized components of the eigenvector corresponding to the first eigenvalue. Look it over and then activate the cell. Finally modify the code to find the other two eigenvectors. :[font = input; preserveAspect; endGroup] Clear[vVector, v, myEqu] vVector = {v[1], v[2], v[3]}; myEqu = (iTensor - eigenValues[[1,1,2]] * IdentityMatrix[3]) . vVector; Solve[myEqu[[1]] == 0, v[1]] Solve[myEqu[[2]] == 0, v[1]] Solve[myEqu[[3]] == 0, v[3]] :[font = subsection; inactive; preserveAspect; startGroup] Comment 4 :[font = special1; inactive; preserveAspect; endGroup] 1. You should find that (1, 1, 0) is the eigenvector for (1/12)ma2, (1, -1, 0) is the eigenvector for (7/12)ma2, and (1, -1, 0) is the eigenvector for (2/3)ma2. ;[s] 7:0,0;69,1;70,0;116,1;117,0;168,1;169,0;171,-1; 2:4,16,12,Times,0,14,0,0,0;3,24,16,Times,32,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 5 - There's an easier way to find the eigenvalues and eigenvectors, and that's by letting MMA to it for you. Find the MMA functions which determine eigenvalues and eigenvectors and apply them to your problem. :[font = subsection; inactive; preserveAspect; startGroup] Comment 5 :[font = special1; inactive; preserveAspect; endGroup] 1. Do the results agree with what you found before? 2. MMA doesn't normalize its eigenvectors. :[font = subsection; inactive; preserveAspect; endGroup] Step 5 - Since the inertia tensor is real and symmetric, its eigenvectors should be orthogonal. Use MMA to prove that your eigenvectors are indeed orthogonal. :[font = section; inactive; preserveAspect; startGroup] Save Your Notebook :[font = special1; inactive; preserveAspect; endGroup; endGroup] Remove any output cells from this notebook and then use Save As to store your notebook under the name myEx13. ;[s] 5:0,0;57,1;64,0;106,1;112,0;114,-1; 2:3,16,12,Times,0,14,0,0,0;2,15,11,Helvetica,0,14,0,0,0; ^*)