(*^ ::[ frontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.1"; macintoshStandardFontEncoding; paletteColors = 128; automaticGrouping; currentKernel; 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"; ; ] :[font = special1; inactive; preserveAspect; ] Sequences -- QuickStart This notebook illustrates the way in which Mathematica can be used to work with sequences. The following cell defines a sequence representing a bank account earning 4% interest with an initial deposit of $100.00. Evaluate that cell now. ;[s] 5:0,3;58,0;103,1;114,0;276,2;300,-1; 4:2,13,9,Times,0,12,0,0,0;1,13,9,Times,2,12,0,0,0;1,13,9,Times,1,12,65535,0,0;1,13,9,Times,1,12,0,0,0; :[font = input; preserveAspect; ] Clear[p] (* Forget any old information *) (* about p. *) p[1] := 100 p[n_] := 1.04 * p[n-1] ;[s] 3:0,0;12,1;89,0;126,-1; 2:2,12,10,Courier,1,12,0,0,0;1,12,10,Courier,1,12,65535,0,0; :[font = special1; inactive; preserveAspect; ] Now you can examine the amount in the account at the beginning of any year, for example year 10, as illustrated in the cell below. Evaluate that cell now. ;[s] 3:0,0;132,1;154,0;156,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect; ] p[10] :[font = special1; inactive; preserveAspect; ] The cell below illustrates how Mathematica can be used to print several years. Evaluate that cell now. Notice the 20 that indicates the number of years to be printed. ;[s] 6:0,0;31,1;42,0;81,2;106,3;169,2;170,-1; 4:2,13,9,Times,0,12,0,0,0;1,13,9,Times,2,12,0,0,0;2,13,9,Times,1,12,65535,0,0;1,13,9,Times,1,12,65535,0,65535; :[font = input; preserveAspect; ] TableForm[Table[{i, p[i]}, {i, 1, 20}]] ;[s] 3:0,0;34,1;36,0;40,-1; 2:2,12,10,Courier,1,12,0,0,0;1,12,10,Courier,1,12,65535,0,65535; :[font = special1; inactive; preserveAspect; ] The cell below illustrates how Mathematica can be used to plot several years. Evaluate that cell now. Notice the 20 that indicates the number of years to be plotted. ;[s] 5:0,0;31,1;42,0;80,2;105,3;169,-1; 4:2,13,9,Times,0,12,0,0,0;1,13,9,Times,2,12,0,0,0;1,13,9,Times,1,12,65535,0,0;1,13,9,Times,1,12,65535,0,65535; :[font = input; preserveAspect; ] ListPlot[Table[{i, p[i]}, {i, 1, 20}], PlotJoined -> True, PlotRange -> {0, 250}] ;[s] 3:0,0;33,1;35,0;100,-1; 2:2,12,10,Courier,1,12,0,0,0;1,12,10,Courier,1,12,65535,0,65535; :[font = special1; inactive; preserveAspect; ] By modifying the cells above or by using them as examples, showing how to write your own Mathematica cells, you can use Mathematica to answer many questions about sequences. Sequences are often defined by algebraic expressions as illustrated in the cell below. Evaluate that cell now. ;[s] 7:0,2;89,3;100,2;121,3;132,2;175,0;265,1;289,-1; 4:1,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,65535,0,0;3,13,9,Times,1,12,0,0,65535;2,13,9,Times,3,12,0,0,65535; :[font = input; preserveAspect; ] Clear[q] (* Forget any old information *) (* about q. *) q[n_] = 100 * 1.04^(n - 1) ;[s] 3:0,0;12,1;89,0;119,-1; 2:2,12,10,Courier,1,12,0,0,0;1,12,10,Courier,1,12,65535,0,0; :[font = special1; inactive; preserveAspect; ] The two sequences -- p and q -- we have defined in this notebook are numerically the same. Notice, for example, that p[20] and q[20] are the same, as shown in the cell below. Evaluate that cell now. ;[s] 10:0,0;21,1;22,0;28,1;29,0;119,1;124,0;129,1;134,0;178,2;202,-1; 3:5,13,9,Times,0,12,0,0,0;4,13,9,Times,1,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect; ] p[20] q[20] ^*)