(*^ ::[ 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, w405, h197, 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; noPageBreak; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Setup: :[font = input; preserveAspect; endGroup] Needs["Graphics`Graphics3D`"] Needs["Graphics`Graphics`"] Needs["Graphics`ParametricPlot3D`"] :[font = section; inactive; Cclosed; noPageBreak; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Example 1: Representation of Complex Numbers: (Simple warm-up) :[font = input; noPageBreak; preserveAspect] Clear["Global`*"]; :[font = text; inactive; preserveAspect] Express the following quantities in the form "a + I b" where a and b are real numbers. (You might try and remember how you would do these by hand.) ;[s] 3:0,0;88,1;148,0;149,-1; 2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = text; inactive; preserveAspect] 1/(2 + 3 I) :[font = input; noPageBreak; preserveAspect] 1/(2 + 3 I) :[font = text; inactive; preserveAspect] 1/(4 - 5 I) :[font = input; noPageBreak; preserveAspect] 1/(4 - 5 I) :[font = text; inactive; preserveAspect] Sqrt[2 + 3 I] :[font = input; noPageBreak; preserveAspect] Sqrt[2 + 3 I] //N :[font = text; inactive; preserveAspect] Sqrt[2 + 3 I]: If you did it by hand, the answer would be: :[font = input; noPageBreak; preserveAspect] ( Sqrt[Sqrt[13]] Cos[ArcTan[2,3]/2] + I Sqrt[Sqrt[13]] Sin[ArcTan[2,3]/2] ) :[font = text; inactive; preserveAspect] Log[2 + 3 I] ;[s] 2:0,0;13,1;14,-1; 2:1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; noPageBreak; preserveAspect] Log[2 + 3 I] //N :[font = text; inactive; preserveAspect] Log[2 + 3 I]: Again, doing it the long way we get: :[font = input; noPageBreak; preserveAspect] Log[Sqrt[13]] + I ArcTan[2,3] //N :[font = text; inactive; preserveAspect] 2 E^(-I Pi/3) ;[s] 2:0,0;13,1;14,-1; 2:1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; noPageBreak; preserveAspect] 1/( 2 E^(I Pi/3) ) //N :[font = text; inactive; preserveAspect] 2 E^(-I Pi/3): Again, doing it the long way we get: :[font = input; noPageBreak; preserveAspect] (1/2) Cos[-Pi/3] + I (1/2) Sin[-Pi/3] //N :[font = text; inactive; preserveAspect] Sqrt[2 E^(I Pi/3) ] ;[s] 2:0,0;19,1;20,-1; 2:1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; noPageBreak; preserveAspect] Sqrt[2 E^(I Pi/3) ] //N :[font = text; inactive; preserveAspect] Sqrt[2 E^(I Pi/3) ]: Again, doing it the long way we get: :[font = input; noPageBreak; preserveAspect; endGroup] Sqrt[2] Cos[Pi/3/2] + I Sqrt[2] Sin[Pi/3/2] //N :[font = section; inactive; Cclosed; noPageBreak; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Problem 2: Branch cuts and discontinuties :[font = input; noPageBreak; preserveAspect] Clear["Global`*"]; :[font = subsection; inactive; Cclosed; noPageBreak; preserveAspect; startGroup] Part a) Log[z] :[font = text; inactive; preserveAspect] Let's consider the function f[z]= Log[z], where z=r Exp[I th]. We use CylindricalPlot3D to display the Re and Im part of this function in the complex plane. Here is the real part: :[font = input; noPageBreak; preserveAspect] CylindricalPlot3D[ Log[ r E^(I th) ] //Re ,{r,0,2} ,{th,-Pi ,+Pi} ,BoxRatios->{1,1,1} ]; :[font = text; inactive; preserveAspect] Here is the Im part. Note, we have a branch cut starting at the origin, and running along the negative real axis. :[font = input; noPageBreak; preserveAspect] CylindricalPlot3D[ Log[ r E^(I th) ] //Im ,{r,0,2} ,{th,-Pi * 0.99,+Pi * 0.99} ,BoxRatios->{1,1,1} ]; :[font = text; inactive; preserveAspect] Here, we compute the discontinuity across the branch cut. In this particular case, the discontinuity is independent of r. :[font = input; noPageBreak; preserveAspect] (( ( Log[ r E^( I Pi *a) ] - Log[ r E^(-I Pi *a) ] ) //Im //PowerExpand ) /.{a->1} ) :[font = text; inactive; preserveAspect] Here is a plot of the discontinuity vs. r. This is a profile of our 3-D curve above. :[font = input; noPageBreak; preserveAspect; endGroup] Plot[ {Log[ r E^(I Pi *0.999) ] ,Log[ r E^(-I Pi *0.999) ] } //Im //Evaluate ,{r,0.001,5}]; :[font = text; inactive; preserveAspect; cellOutline] Repeat for the following functions: :[font = subsection; inactive; noPageBreak; preserveAspect] Part b) Sqrt[z] :[font = subsection; inactive; noPageBreak; preserveAspect] Part c) ArcSin[z] :[font = subsection; inactive; noPageBreak; preserveAspect] Part d) Sqrt[1-z^2] :[font = subsection; inactive; noPageBreak; preserveAspect; endGroup] Part e) ArcCos[z] :[font = section; inactive; Cclosed; noPageBreak; preserveAspect; cellOutline; backColorRed = 58981; backColorGreen = 58981; backColorBlue = 58981; startGroup] Problem 3: Visualization of different coordinate systems :[font = text; inactive; preserveAspect] Mathematica has a large number of built-in coordinate systems. A common problem is how to help the students visualize them. We present one method below. ;[s] 2:0,1;11,0;155,-1; 2:1,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; cellOutline; startGroup] Load Package: :[font = input; preserveAspect] Clear["Global`*"] :[font = text; inactive; preserveAspect] We'll use the package: Calculus`VectorAnalysis` ;[s] 2:0,0;23,1;48,-1; 2:1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; preserveAspect] Needs["Calculus`VectorAnalysis`"] :[font = text; inactive; preserveAspect] Let's take a look at the built-in functions in Calculus`VectorAnalysis` ;[s] 2:0,0;48,1;73,-1; 2:1,16,12,Times,0,14,0,0,0;1,13,10,Courier,1,12,0,0,0; :[font = input; Cclosed; preserveAspect; startGroup] ?Calculus`VectorAnalysis`* :[font = info; inactive; preserveAspect; endGroup; endGroup] ArcLengthFactor Div phi Biharmonic DotProduct ProlateSpheroidal Bipolar EllipticCylindrical r Bispherical eta ScalarTripleProduct Cartesian Grad ScaleFactors ConfocalEllipsoidal JacobianDeterminant SetCoordinates ConfocalParaboloidal JacobianMatrix Spherical Conical lambda theta CoordinateRanges Laplacian Toroidal Coordinates mu u CoordinatesFromCartesian nu v CoordinatesToCartesian OblateSpheroidal x CoordinateSystem ParabolicCylindrical xi CrossProduct Paraboloidal y Curl ParameterRanges z Cylindrical Parameters :[font = text; inactive; preserveAspect] To get started correctly, we'll begin with a coordinate system where we know the correct answer. :[font = section; inactive; Cclosed; preserveAspect; cellOutline; startGroup] Cartesian: :[font = input; preserveAspect] SetCoordinates[Cartesian] :[font = input; preserveAspect] Coordinates[Cartesian] :[font = input; preserveAspect] CoordinateRanges[Cartesian] :[font = text; inactive; preserveAspect] We begin with a ContourPlot of the x coordinate in the {x,y} plane. We are restricted to taking 2-D slices, so we will have to use three separate 2-D slices to get the full picture. :[font = input; preserveAspect] p1= ContourPlot[x,{x,-3,3},{y,-3,3} ,ContourShading->False ,ContourStyle->{{RGBColor[1,0,0]}} ]; :[font = text; inactive; preserveAspect] Same as above, but this shows the y-variable in the {x,y} plane. (Note, we skip the z-variable in the {x,y} plane as this is uninteresting--try it.) ;[s] 3:0,0;66,1;149,0;150,-1; 2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = input; preserveAspect] p2= ContourPlot[y,{x,-3,3},{y,-3,3} ,ContourShading->False ,ContourStyle->{{RGBColor[0,1,0]}} ]; :[font = text; inactive; preserveAspect] Putting these together, we obtain (not suprisingly), a Cartesian grid. :[font = input; preserveAspect] Show[{p1,p2}]; :[font = text; inactive; preserveAspect] We can now continue working in different 2-D planes. :[font = input; preserveAspect] p1= ContourPlot[y,{y,-3,3},{z,-3,3} ,ContourShading->False ,ContourStyle->{{RGBColor[0,1,0]}} ,DisplayFunction->Identity ]; :[font = input; preserveAspect] p2= ContourPlot[z,{y,-3,3},{z,-3,3} ,ContourShading->False ,ContourStyle->{{RGBColor[0,0,1]}} ,DisplayFunction->Identity ]; :[font = text; inactive; preserveAspect] and the output (not shown) is again a Cartesian grid. :[font = input; preserveAspect; endGroup] Show[{p1,p2},DisplayFunction->$DisplayFunction]; :[font = text; inactive; preserveAspect] Let's try something not so trivial: :[font = input; preserveAspect] coordSys=Spherical; :[font = section; inactive; Cclosed; preserveAspect; cellOutline; startGroup] Spherical: :[font = input; preserveAspect] SetCoordinates[coordSys] :[font = input; preserveAspect] CoordinateRanges[] :[font = input; preserveAspect] coords= CoordinatesFromCartesian[{x,y,z}] :[font = input; preserveAspect] color={RGBColor[1,0,0],RGBColor[0,1,0],RGBColor[0,0,1]}; :[font = input; preserveAspect] Do[ p[i]= ContourPlot[coords[[i]] /.{z->0} //Evaluate ,{x,-3,3},{y,-3,3} ,ContourShading->False ,ContourStyle->{{ color[[i]] }} ,DisplayFunction->Identity ]; ,{i,1,3}]; Show[{p[1],p[2],p[3]},DisplayFunction->$DisplayFunction]; :[font = input; preserveAspect] Do[ p[i]= ContourPlot[coords[[i]] /.{x->0} //Evaluate ,{y,-3,3},{z,-3,3} ,ContourShading->False ,ContourStyle->{{ color[[i]] }} ,DisplayFunction->Identity ]; ,{i,1,3}]; Show[{p[1],p[2],p[3]},DisplayFunction->$DisplayFunction]; :[font = input; preserveAspect; endGroup] Do[ p[i]= ContourPlot[coords[[i]] /.{y->0} //Evaluate ,{x,-3,3},{z,-3,3} ,ContourShading->False ,ContourStyle->{{ color[[i]] }} ,DisplayFunction->Identity ]; ,{i,1,3}]; Show[{p[1],p[2],p[3]},DisplayFunction->$DisplayFunction]; :[font = input; preserveAspect] coordSys=Bispherical; :[font = section; inactive; Cclosed; preserveAspect; cellOutline; startGroup] Bispherical: :[font = input; preserveAspect] SetCoordinates[coordSys] :[font = input; preserveAspect] CoordinateRanges[] :[font = input; preserveAspect] coords= CoordinatesFromCartesian[{x,y,z}] :[font = input; preserveAspect] color={RGBColor[1,0,0],RGBColor[0,1,0],RGBColor[0,0,1]}; :[font = input; preserveAspect] Do[ p[i]= ContourPlot[coords[[i]] /.{z->0} //Evaluate ,{x,-3,3},{y,-3,3} ,ContourShading->False ,ContourStyle->{{ color[[i]] }} ,DisplayFunction->Identity ]; ,{i,1,3}]; Show[{p[1],p[2],p[3]},DisplayFunction->$DisplayFunction]; :[font = input; preserveAspect] Do[ p[i]= ContourPlot[coords[[i]] /.{x->0} //Evaluate ,{y,-3,3},{z,-3,3} ,ContourShading->False ,ContourStyle->{{ color[[i]] }} ,DisplayFunction->Identity ]; ,{i,1,3}]; Show[{p[1],p[2],p[3]},DisplayFunction->$DisplayFunction]; :[font = input; preserveAspect; endGroup] Do[ p[i]= ContourPlot[coords[[i]] /.{y->0} //Evaluate ,{x,-3,3},{z,-3,3} ,ContourShading->False ,ContourStyle->{{ color[[i]] }} ,DisplayFunction->Identity ]; ,{i,1,3}]; Show[{p[1],p[2],p[3]},DisplayFunction->$DisplayFunction]; :[font = input; preserveAspect] coordSys=ConfocalParaboloidal; :[font = section; inactive; preserveAspect; cellOutline] ConfocalParaboloidal: :[font = text; inactive; preserveAspect; fontColorRed = 65535] Copy from above and repeat. :[font = input; preserveAspect] coordSys=ConfocalEllipsoidal; :[font = section; inactive; preserveAspect; cellOutline] ConfocalEllipsoidal: :[font = text; inactive; preserveAspect; fontColorRed = 65535] Copy from above and repeat. :[font = section; inactive; preserveAspect; cellOutline] You try your own here: .... :[font = text; inactive; preserveAspect; fontColorRed = 65535; endGroup] Copy from above and repeat. ^*)