(*^ ::[ 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 = "NeXT Mathematica Notebook Front End Version 2.2"; NeXTStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e8, 24, "Times"; ; fontset = subtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e6, 18, "Times"; ; fontset = subsubtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, L1, e6, 14, "Times"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, L1, a20, 18, "Times"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, L1, a15, 14, "Times"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, L1, a12, 12, "Times"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L1, 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, L1, 12, "Courier"; ; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, L1, 12, "Courier"; ; fontset = name, inactive, noPageBreakInGroup, nohscroll, preserveAspect, M7, italic, B65535, L1, 10, "Times"; ; fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, L1, 12, "Times"; ; fontset = leftheader, 12; fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, italic, L1, 12, "Times"; ; fontset = leftfooter, 12; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12, "Courier"; ; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; paletteColors = 128; currentKernel; ] :[font = title; inactive; Cclosed; preserveAspect; startGroup] Complex Numbers in Mathematica ;[s] 2:0,0;19,1;30,-1; 2:1,21,16,Times,1,24,0,0,0;1,22,17,Times,3,24,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] Arithmetic :[font = text; inactive; preserveAspect] Mathematica will automatically do complex arithmetic for you. The important point to remember is that the number "i" is denoted by "I" in Mathematica. For example, try the following cell: ;[s] 4:0,0;11,1;144,2;155,3;194,-1; 4:1,10,8,Times,3,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect] (2 + 3 I) - (7 - 6 I) :[font = text; inactive; preserveAspect] Now consider the following problem: Solve for the unknown z in the equation: (3 - 2 i) z = (2 + 4 i). Clearly, the answer is z = (3 - 2 i) / (2 + 4 i). But this isn't satisfactory. (Why?) Mathematica knows the answer. Activate the following cell: ;[s] 3:0,0;200,1;211,2;260,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect] z = (2 + 4 I ) / (3 - 2 I) :[font = input; preserveAspect] How could you get this answer by hand ?? ;[s] 1:0,0;41,-1; 1:1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect] Mathematica will even do some exotic stuff like the following: ;[s] 2:0,0;11,1;62,-1; 2:1,10,8,Times,3,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect] Sin[z] :[font = input; preserveAspect] N[Sin[z]] :[font = input; preserveAspect; endGroup] z^3-2 z^2 + 2 + 3 I :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] More handles on complex numbers :[font = text; inactive; preserveAspect] Here are two good tools to apply to the complex number z = x + y i , where x, y are reals. The absolute value or modulus of z is the non-negative real number | z | = Sqrt [x2 + y2]. Mathematica is aware of this idea, as well as the idea of real and imaginary parts of z ... ;[s] 11:0,0;102,1;116,2;122,3;129,4;191,5;192,6;196,7;197,8;202,9;213,10;350,-1; 11:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,32,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,32,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect] z = 3 + 4 I :[font = input; preserveAspect] Abs[z] :[font = input; preserveAspect] Re[z] :[font = input; preserveAspect] Im[z] :[font = text; inactive; preserveAspect] Here is another important concept:: the (complex) conjugate of a complex number z is given by _ z = x - y i. Again, Mathematica knows about this... ;[s] 7:0,0;43,1;50,2;53,3;62,4;126,5;137,6;179,-1; 7:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect] Conjugate[z] :[font = text; inactive; preserveAspect] There are a few useful laws of arithmetic that these operations satisfy. Let z, z1 and z2 be any three complex numbers. Then: | z1 z2 | = | z1 | | z2 | | z1 + z2 | £ | z1 | + | z2 | 2 _ | z | = z z _______ __ __ z1 + z2 z1 + z2 _____ __ __ z1 z2 = z1 z2 We can check these laws with Mathematica in specific examples. Here is one law. Try the others yourself. ;[s] 40:0,0;85,1;86,2;93,3;94,4;138,5;139,6;141,7;142,8;152,9;153,10;159,11;160,12;167,13;168,14;172,15;173,16;178,17;179,18;184,19;185,20;195,21;196,22;278,23;279,24;283,25;284,26;294,27;295,28;301,29;302,30;328,31;329,32;332,33;333,34;340,35;341,36;345,37;378,38;389,39;459,-1; 40:1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,0,0,Symbol,0,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,10,8,Times,66,12,0,0,0;1,11,8,Times,64,12,0,0,0; :[font = input; preserveAspect] z1 = 4 - 7 I :[font = input; preserveAspect] z2 = 3 + 2 I :[font = input; preserveAspect] Conjugate[z1 z2] :[font = input; preserveAspect; endGroup] Conjugate[z1] Conjugate[z2] :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] About the Fundamental Theorem of Algebra (FTOA) ... :[font = text; inactive; preserveAspect] Remember what it says: FTOA: Any non-constant polynomial in the variable z with complex coefficients has a root in the (field of) complex numbers. :[font = text; inactive; preserveAspect] Try solving this polynomial equation: z2 + z + 1 + i = 0. Mathematica knows how ... but actually, you can do better by hand. ;[s] 5:0,0;44,1;46,2;64,3;75,4;131,-1; 5:1,11,8,Times,0,12,0,0,0;1,11,8,Times,32,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect] Clear[z] :[font = input; preserveAspect] Solve[z^2 + z + 1 + I == 0, z] :[font = text; inactive; preserveAspect] Let's consider the problem of solving a fairly simple high degree polynomial equation of the form zn = a, where a is a given complex number. Mathematica already knows how. For example: ;[s] 5:0,0;102,1;103,2;148,3;159,4;193,-1; 5:1,11,8,Times,0,12,0,0,0;1,11,8,Times,32,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect] Clear[z] :[font = input; preserveAspect] n=3 :[font = input; preserveAspect] solns = Solve[z^n == 1, z] :[font = input; preserveAspect] rules = N[solns] :[font = input; preserveAspect] Just to see what these points look like, let's graph them and then do a dot-to-dot:: ;[s] 1:0,0;85,-1; 1:1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect] roots = Table[{Re[z /. rules[[ii]]], Im[z /. rules[[ii]]]}, {ii,1,n}] :[font = input; preserveAspect] roots=Append[roots,First[roots]] :[font = input; preserveAspect] ListPlot[roots,PlotJoined->True,AspectRatio->1] :[font = text; inactive; preserveAspect] Now go back and experiment with this sequence of cells a bit.. Change the degree. :[font = text; inactive; preserveAspect; endGroup] Actually, we can get a little more satisfying answer by hand if we use a tool known as the polar form of a complex number. Write, for a real number t, e it = cos t + i sin t so that every complex number z = x + i y can be written in the form z = r e it, where r = | z | and t is really the polar angle for the point z in the plane. We'll continue discussion of this in class, where I will give serveral assignments to be done on the computer (most easily done by recycling some cells in this notebook). ;[s] 9:0,0;91,1;101,2;160,3;162,4;262,5;264,6;266,7;521,8;523,-1; 9:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,32,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,32,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,11,8,Times,64,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] Exercises :[font = text; inactive; preserveAspect; endGroup; endGroup] 1. (fill in later) ^*)