(*^ ::[ 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; automaticGrouping; currentKernel; ] :[font = input; preserveAspect; center] Tools for Analyzing Discrete Dynamical Systems: Iterating Functions Written by Richard A. Holmgren last modified June 18, 1996 ;[s] 2:0,0;68,1;127,-1; 2:1,16,12,Times,1,18,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect] These programs were developed for use with the text A First Course in Discrete Dynamical Systems, 2nd edition by Richard A. Holmgren, which was published by Springer-Verlag in 1996. Suggestions for improvement are gratefully accepted. Please contact Professor Holmgren at rholmgre@alleg.edu with suggestions and comments. ;[s] 4:0,0;54,1;111,2;278,3;386,-1; 4: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,Courier,0,12,0,0,0; :[font = section; inactive; Cclosed; preserveAspect; startGroup] Iterating Functions :[font = text; inactive; preserveAspect] The easiest way to iterate functions with Mathematica is to use the Nest[...] command. The format is Nest[ function, start value, number of iterations]. For example, below we define f(x) = x3 and then iterate f(x) three times starting at 1.2. ;[s] 17:0,0;42,1;53,2;68,3;78,4;103,5;108,6;109,7;152,8;153,9;187,10;191,11;192,12;194,13;195,14;213,15;217,16;248,-1; 17: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,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,10,8,Times,1,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,8,6,Times,32,9,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; startGroup] Clear[f]; f[x_] := x^3; Nest[f,1.2,3] :[font = output; output; inactive; preserveAspect; endGroup] 137.3705519674592 ;[o] 137.371 :[font = text; inactive; preserveAspect] NestList[...] will show the value of the first n iterates. The format is similar. Below we see the first three iterates of 1.2 under f(x) = x^3. ;[s] 4:0,0;14,1;47,2;48,3;150,-1; 4:1,10,8,Times,1,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; startGroup] Clear[f]; f[x_] := x^3; NestList[f,1.2,3] :[font = output; output; inactive; preserveAspect; endGroup] {1.2, 1.728, 5.159780351999998, 137.3705519674592} ;[o] {1.2, 1.728, 5.15978, 137.371} :[font = text; inactive; preserveAspect] The formatting command TableForm[...] can make the output of NestList[...] easier to read, especially for long lists. ;[s] 5:0,0;23,1;38,2;61,3;75,4;120,-1; 5:1,11,8,Times,0,12,0,0,0;1,10,8,Times,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; startGroup] Clear[f]; f[x_] := x^3; TableForm[NestList[f,1.01,8]] :[font = output; output; inactive; preserveAspect; endGroup; endGroup] TableForm[{1.01, 1.030301, 1.093685272684361, 1.308208878117079, 2.238882369366195, 11.22260892213956, 1413.453376225317, 2.823868459170065*10^9, 2.25181852657034*10^28}] ;[o] 1.01 1.0303 1.09369 1.30821 2.23888 11.2226 1413.45 9 2.82387 10 28 2.25182 10 :[font = section; inactive; Cclosed; pageBreak; preserveAspect; startGroup] Creating Tables of Iterates. :[font = text; inactive; preserveAspect] The following set of commands determine how a given value changes under iteration of a function by generating a table of values with the number of iterations represented in the first column. Note that we may not want to print the first few iterations since it may take the a awhile for the iteratiosn to settle reach an attracting orbit. In the following example, the iterations seem to be approaching an attracting perioid two orbit. In the first two lines we define the function. Next we tell the computer what our starting value is and in the fourth and fifth lines we tell the computer which iterations to print. :[font = input; preserveAspect; startGroup] Clear[h]; h[x_]:= 3.2x(1-x); StartingValue = .1; FirstIteration = 20; LastIteration = 30; i=0; y = N[StartingValue]; While[i <= LastIteration, If[i >= FirstIteration, Print[i,"\t ",N[y,8]]]; y = h[y]; i = i+1] :[font = print; inactive; preserveAspect; endGroup] 20 0.51309332 21 0.79945141 22 0.51305233 23 0.79945484 24 0.51304576 25 0.79945539 26 0.51304471 27 0.79945547 28 0.51304454 29 0.79945549 30 0.51304451 :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] Controlling the precision of a calculation :[font = text; inactive; preserveAspect] For some of the exercises in the text we need be able to control the precision of the computations. The Mathematica command SetPrecision[number, n] writes number to n significant digits, adding zeros or rounding as necessary. Zeros which are added are in binary so the base ten representation of the new number will not necessarily end in zeros. The variable SigDigits controls the amount of rounding. ;[s] 11:0,0;127,1;140,2;149,3;150,4;158,5;164,6;168,7;169,8;365,9;374,10;408,-1; 11:1,11,8,Times,0,12,0,0,0;1,10,8,Times,1,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,10,8,Times,1,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;1,10,8,Times,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; endGroup; endGroup] Clear[h]; h[x_]:= 3.2x(1-x); StartingValue = .1; FirstIteration = 10; LastIteration = 20; SigDigits = 16; i=0; y = SetPrecision[StartingValue,SigDigits]; While[i <= LastIteration, If[i >= FirstIteration, Print[i," ",N[y,8]]]; y = SetPrecision[h[y],SigDigits]; i = i+1] :[font = section; inactive; Cclosed; preserveAspect; startGroup] Graphing Iterated Functions :[font = text; inactive; preserveAspect] The following set of commands plots the 2nd iterate of h(x) and the line y=x on the same graph. The variables xmax and xmin are maximum and minimum limits for the graphed domain and range of h(x). The variable NumberOfIterations should be self-explanatory. ;[s] 16:0,0;56,1;60,2;74,3;75,4;76,5;77,6;98,7;113,8;117,9;122,10;126,11;194,12;198,13;214,14;232,15;262,-1; 16: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;1,11,8,Times,0,12,0,0,0;1,10,8,Times,1,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,1,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,1,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; startGroup] Clear[h]; h[x_]:= 3.2x(1-x); xmin = 0 ; xmax = 1 ; NumberOfIterations = 2 ; Plot[{Nest[h,x,NumberOfIterations],x},{x,xmin,xmax}, PlotRange->{xmin,xmax}, AspectRatio->1] :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 282] %! %%Creator: Mathematica %%AspectRatio: 1 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.02381 0.952381 0 1 [ [(0)] .02381 0 0 2 Msboxa [(0.2)] .21429 0 0 2 Msboxa [(0.4)] .40476 0 0 2 Msboxa [(0.6)] .59524 0 0 2 Msboxa [(0.8)] .78571 0 0 2 Msboxa [(1)] .97619 0 0 2 Msboxa [(0.2)] .01131 .2 1 0 Msboxa [(0.4)] .01131 .4 1 0 Msboxa [(0.6)] .01131 .6 1 0 Msboxa [(0.8)] .01131 .8 1 0 Msboxa [(1)] .01131 1 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 1.001 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .02381 0 m .02381 .00625 L s P [(0)] .02381 0 0 2 Mshowa p .002 w .21429 0 m .21429 .00625 L s P [(0.2)] .21429 0 0 2 Mshowa p .002 w .40476 0 m .40476 .00625 L s P [(0.4)] .40476 0 0 2 Mshowa p .002 w .59524 0 m .59524 .00625 L s P [(0.6)] .59524 0 0 2 Mshowa p .002 w .78571 0 m .78571 .00625 L s P [(0.8)] .78571 0 0 2 Mshowa p .002 w .97619 0 m .97619 .00625 L s P [(1)] .97619 0 0 2 Mshowa p .001 w .0619 0 m .0619 .00375 L s P p .001 w .1 0 m .1 .00375 L s P p .001 w .1381 0 m .1381 .00375 L s P p .001 w .17619 0 m .17619 .00375 L s P p .001 w .25238 0 m .25238 .00375 L s P p .001 w .29048 0 m .29048 .00375 L s P p .001 w .32857 0 m .32857 .00375 L s P p .001 w .36667 0 m .36667 .00375 L s P p .001 w .44286 0 m .44286 .00375 L s P p .001 w .48095 0 m .48095 .00375 L s P p .001 w .51905 0 m .51905 .00375 L s P p .001 w .55714 0 m .55714 .00375 L s P p .001 w .63333 0 m .63333 .00375 L s P p .001 w .67143 0 m .67143 .00375 L s P p .001 w .70952 0 m .70952 .00375 L s P p .001 w .74762 0 m .74762 .00375 L s P p .001 w .82381 0 m .82381 .00375 L s P p .001 w .8619 0 m .8619 .00375 L s P p .001 w .9 0 m .9 .00375 L s P p .001 w .9381 0 m .9381 .00375 L s P p .002 w 0 0 m 1 0 L s P p .002 w .02381 .2 m .03006 .2 L s P [(0.2)] .01131 .2 1 0 Mshowa p .002 w .02381 .4 m .03006 .4 L s P [(0.4)] .01131 .4 1 0 Mshowa p .002 w .02381 .6 m .03006 .6 L s P [(0.6)] .01131 .6 1 0 Mshowa p .002 w .02381 .8 m .03006 .8 L s P [(0.8)] .01131 .8 1 0 Mshowa p .002 w .02381 1 m .03006 1 L s P [(1)] .01131 1 1 0 Mshowa p .001 w .02381 .04 m .02756 .04 L s P p .001 w .02381 .08 m .02756 .08 L s P p .001 w .02381 .12 m .02756 .12 L s P p .001 w .02381 .16 m .02756 .16 L s P p .001 w .02381 .24 m .02756 .24 L s P p .001 w .02381 .28 m .02756 .28 L s P p .001 w .02381 .32 m .02756 .32 L s P p .001 w .02381 .36 m .02756 .36 L s P p .001 w .02381 .44 m .02756 .44 L s P p .001 w .02381 .48 m .02756 .48 L s P p .001 w .02381 .52 m .02756 .52 L s P p .001 w .02381 .56 m .02756 .56 L s P p .001 w .02381 .64 m .02756 .64 L s P p .001 w .02381 .68 m .02756 .68 L s P p .001 w .02381 .72 m .02756 .72 L s P p .001 w .02381 .76 m .02756 .76 L s P p .001 w .02381 .84 m .02756 .84 L s P p .001 w .02381 .88 m .02756 .88 L s P p .001 w .02381 .92 m .02756 .92 L s P p .001 w .02381 .96 m .02756 .96 L s P p .002 w .02381 0 m .02381 1 L s P P 0 0 m 1 0 L 1 1 L 0 1 L closepath clip newpath p p p .004 w .02381 0 m .04365 .19525 L .06349 .35664 L .08333 .4875 L .10317 .59101 L .12302 .67022 L .13294 .70161 L .14286 .728 L .15278 .74972 L .1627 .7671 L .17262 .78047 L .17758 .78574 L .18254 .79012 L .1875 .79365 L .19246 .79637 L .19494 .79743 L .19742 .79831 L .1999 .79899 L .20114 .79927 L .20238 .7995 L .20362 .79969 L .20486 .79983 L .2061 .79993 L .20734 .79998 L .20858 .8 L .20982 .79997 L .21106 .7999 L .2123 .7998 L .21478 .79946 L .21602 .79923 L .21726 .79897 L .22222 .79753 L .22718 .79552 L .23214 .79297 L .24206 .78636 L .2619 .768 L .30159 .71694 L .34127 .65738 L .38095 .6 L .40079 .57481 L .42063 .55309 L .44048 .5355 L .4504 .52843 L .46032 .52257 L .47024 .51797 L .4752 .51615 L .48016 .51466 L .48512 .5135 L .4876 .51304 L .49008 .51267 L Mistroke .49256 .51237 L .4938 .51226 L .49504 .51217 L .49628 .51209 L .49752 .51204 L .49876 .51201 L .5 .512 L .50124 .51201 L .50248 .51204 L .50372 .51209 L .50496 .51217 L .5062 .51226 L .50744 .51237 L .50992 .51267 L .5124 .51304 L .51488 .5135 L .51984 .51466 L .5248 .51615 L .52976 .51797 L .53968 .52257 L .55952 .5355 L .57937 .55309 L .61905 .6 L .65873 .65738 L .69841 .71694 L .71825 .74429 L .7381 .768 L .75794 .78636 L .7629 .78991 L .76786 .79297 L .77282 .79552 L .77778 .79753 L .78026 .79832 L .78274 .79897 L .78398 .79923 L .78522 .79946 L .78646 .79965 L .7877 .7998 L .78894 .7999 L .79018 .79997 L .79142 .8 L .79266 .79998 L .7939 .79993 L .79514 .79983 L .79638 .79969 L .79762 .7995 L .8001 .79899 L .80258 .79831 L .80506 .79743 L .80754 .79637 L Mistroke .8125 .79365 L .81746 .79012 L .82738 .78047 L .8373 .7671 L .84722 .74972 L .85714 .728 L .87698 .67022 L .89683 .59101 L .91667 .4875 L .93651 .35664 L .97619 0 L Mfstroke P P p p .004 w .02381 0 m .06349 .04167 L .10317 .08333 L .14286 .125 L .18254 .16667 L .22222 .20833 L .2619 .25 L .30159 .29167 L .34127 .33333 L .38095 .375 L .42063 .41667 L .46032 .45833 L .5 .5 L .53968 .54167 L .57937 .58333 L .61905 .625 L .65873 .66667 L .69841 .70833 L .7381 .75 L .77778 .79167 L .81746 .83333 L .85714 .875 L .89683 .91667 L .93651 .95833 L .97619 1 L s P P P % End of Graphics MathPictureEnd :[font = output; output; inactive; preserveAspect; endGroup] Graphics["<<>>"] ;[o] -Graphics- :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] Exercises :[font = text; inactive; preserveAspect; endGroup; endGroup] 1) Does h(x) have any points of period 2? What is the significance of the points of intersection of the graph of the line y=x and the graph of the nth iterate of the function h(x)? 2) Using the above procedure determine whether or not h(x) has any points of prime period 4. 3) Using the graphing command above, determine the periodic points of the function h(x) = 3.5x(1-x). ;[s] 3:0,0;150,1;151,2;384,-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; ^*)