(*^ ::[ 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, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 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; automaticGrouping; currentKernel; ] :[font = special1; inactive; preserveAspect] From Three Dimensions to Two and Back The cell below shows how Mathematica may be used to find the location of the shadow produced by an object located at the point P = (2, 1, 1) illuminated by a light source located at the point S = (1, -2, 8) Evaluate it now. ;[s] 10:0,1;67,0;94,2;105,0;269,1;282,0;408,1;422,0;424,3;439,0;441,-1; 4:5,13,9,Times,0,12,0,0,0;3,13,9,Times,1,12,0,0,0;1,13,9,Times,2,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect] Clear[P, S, t] P = {2, 1, 1}; S = {1, -2, 8}; Solve[S + t (P - S) == {x, y, 0}, {t, x, y}] {x, y} /. % :[font = special1; inactive; preserveAspect] The next cell packages the computations above as a function, so that they can easily be applied to a sequence of points. Evaluate it now. ;[s] 3:0,0;123,1;139,0;140,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect] Clear[P, S] Shadow[P_, S_] := ({x, y} /. Solve[S + t (P - S) == {x, y, 0}, {t, x, y}])[[1]] Shadow[{2, 1, 1}, {1, -2, 8}] :[font = special1; inactive; preserveAspect] The next cell defines the cube used in the first set of exercises in the textbook and then solves the first exercise using the function defined above. Notice that it gives numeric results and it draws the shadow of the cube. Evaluate it now. ;[s] 2:0,0;227,1;244,-1; 2:1,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect] Cube = {{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}, {0, 0, 1}, {0, 1, 1}, {1, 1, 1}, {1, 0, 1}}; P = {0, 0, 2}; Ground := Table[Shadow[Cube[[i]], P], {i, 1, 8}] Vertices := Table[{PointSize[0.03], Point[Ground[[i]]]}, {i, 1, 8}] Base := { {RGBColor[1, 0, 0], Line[{Ground[[1]], Ground[[2]], Ground[[3]], Ground[[4]], Ground[[1]]}]} } Topp := { {RGBColor[0, 0, 1], Line[{Ground[[5]], Ground[[6]], Ground[[7]], Ground[[8]], Ground[[5]]}]} } Sides := Table[{RGBColor[0, 0, 0], Line[{Ground[[i]], Ground[[i + 4]]}]}, {i, 1, 4}] Show[Graphics[Join[Vertices, Base, Topp, Sides]], PlotRange -> {{-1, 3}, {-1, 3}}, AspectRatio -> Automatic, Axes -> False] ^*)