(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 46192, 1778]*) (*NotebookOutlinePosition[ 47045, 1810]*) (* CellTagsIndexPosition[ 47001, 1806]*) (*WindowFrame->Normal*) Notebook[{ Cell[TextData["Tutorial"], "Title", Evaluatable->False, CellHorizontalScrolling->False, TextAlignment->Center], Cell[TextData[ "\nThe tutorial has several sections. You can open a section by \ double-clicking on the\n arrow at the lower right corner of the section. Or, \ you can select a section and use the \n command open all subgroups from the \ Cell menu."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["Introduction"], "Subsection", Evaluatable->False], Cell[TextData[ "We can use the computer algebra system Mathematica to investigate and solve \ problems in \n number theory. First, we describe some basic features of \ Mathematica and then\n more specialized aspects that are particularly useful \ for number theory. After this brief\n tutorial, we give a detailed \ description of list manipulation, functions, and procedural\n programming. \ It is best to work through all the examples yourself.\n\n Since you are \ reading the notebook version of this manual, you already know how\n to start \ Mathematica. A command in Mathematica is evaluated by using the\n Enter key \ (Macintosh systems) or Shift + Return on Windows and Unix front\n ends. If \ you wish to run Mathematica from the command line, then a statement\n can be \ evaluated as soon as it is complete by pressing the return key."], "Text", Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Mathematica as a Calculator"], "Subsection", Evaluatable->False], Cell[TextData[ " The simplest use of Mathematica is as a calculator. Unlike standard \ calculators, there\n is no limit to the size of numbers or the type of \ functions that Mathematica can handle.\n An expression is evaluated by \ entering it in the usual mathematical notation. You can evaluate\n the \ following expression by pressing the shift and return keys simultaneously."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData[" 2+ 11 * 8\n"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 90 \ \>", "\<\ 90\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Try other expressions to get used to the syntax used in Mathematica. Here \ are \n a few examples."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["\n2^67 -1"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 147573952589676412927 \ \>", "\<\ 147573952589676412927\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["(11^23-6^23)/5"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 179085890705002863728743 \ \>", "\<\ 179085890705002863728743\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["17/29"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 17/29 \ \>", "\<\ 17 -- 29\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Notice that the result of 17/29 is again 17/29. This is an important \ feature of Mathematica.\nMathematica represents mathematical values exactly, \ without any approximations. The \n value of 17/29 is 17/29, so that is the \ result given by Mathematica. If you wish to see\n a decimal approximation, \ then you can use the N function of Mathematica. The\n command\n N[ \ expression, places] gives a approximation of the expression to the specified \ number\n of places. "], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["\nN[17/29, 8]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 0.5862068965517241 \ \>", "\<\ 0.5862069\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ " Exercise: Compute the value of square root of 2 to 50\n decimal places. \ The Mathematica function for evaluating the square root is\n Sqrt[ \ expression]. "], "Text", Evaluatable->False], Cell[TextData["\n"], "Input", PageWidth->Infinity], Cell[TextData[ "Mathematical constants like e, pi, and i are represented\n by E, Pi, I in \ Mathematica. Mathematica has all built-in variables and functions starting \ with a \n capital letter, hence it is a good idea to start all your variables \ and functions with a lower\n case letter to avoid any confusion with an \ existing name."], "Text", Evaluatable->False], Cell[TextData[ "\nAnother feature of Mathematica is worth paying attention. Recall that \ we use the symbol\n ^ for exponentiation. Let us compute the cube root of \ -1."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["(-1)^(1/3)"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ (-1)^(1/3) \ \>", "\<\ 1/3 (-1)\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["N[ (-1)^(1/3), 6]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 0.5000000000000001 + 0.866025403784439*I \ \>", "\<\ 0.5 + 0.866025 I\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Observe that the approximation of the cube root of -1 is a complex number. \ The number\n-1 has three cube roots, two of them complex. Mathematica works \ internally with complex\n numbers, so it has selected a primitive complex \ cube root. To be able to compute\n a real cube root of a negative real \ number, we have to define a function ourselves. We \n will see how to \ accomplish this in a later section."], "Text", Evaluatable->False], Cell[TextData[ " Exercise: Determine sin(pi/12) to 8 decimal places. Compute sin(x)/x for \ values of\n x close to zero to observe the limit as x approaches 0. The \ Mathematica function for\nevaluating sin(x) is Sin[x]. "], "Text", Evaluatable->False], Cell[TextData[ "Here are examples of a few more useful functions. Quotient[a,b] gives the \ quotient\n when a is divided by b and Mod[a,b] gives the remainder that has \ the same sign as b. The \n two functions satisfy the relation\n\na= b \ Quotient[a,b] + Mod[a,b]."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData[" Quotient[ -34, 7]\n"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -5 \ \>", "\<\ -5\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Mod[ -34, 7]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 1 \ \>", "\<\ 1\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Quotient[ 34, -7]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -5 \ \>", "\<\ -5\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Mod[ 34, -7]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -1 \ \>", "\<\ -1\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Exercise: Verify that the relation between the Quotient and Remainder \ that is\n specified above is valid. "], "Text", Evaluatable->False], Cell[TextData[ "\n Another useful function is Floor[ x], that returns the largest integer \ less than x. Here x has to\n be an expression that evaluates to a real \ number, otherwise Floor doesn't do anything.\nRelated functions are Ceiling \ and Round; Ceiling returns the smallest integer greater \n than the \ expression and Round returns the nearest integer. Here are a few examples."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["Floor[ -4.5]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -5 \ \>", "\<\ -5\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Ceiling[-4.5]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -4 \ \>", "\<\ -4\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Round[ -4.6]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -5 \ \>", "\<\ -5\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Round[ -4.4]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -4 \ \>", "\<\ -4\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Exercise: What does Round do for numbers of the form integer + 1/2?"], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["\nFloor[1/3]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 0 \ \>", "\<\ 0\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Floor[Sqrt[2]]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ Floor[2^(1/2)] \ \>", "\<\ Floor[Sqrt[2]]\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData["Brackets, Parenthesis, and Braces"], "Subsection", Evaluatable->False], Cell[TextData[ " Brackets, parenthesis, and braces are intended for different purposes. \ Each has\n a specific meaning and their use cannot be interchanged. "], "Text",\ Evaluatable->False], Cell[TextData[ "Paranthesis: These are used for grouping expressions. Careful use of \ parenthesis\n is necessary to make clear the meaning of arithmetical \ expression. This is because multiplication\n and division have a higher \ order of precedence than addition and subtraction.\n For example, 3 + 7* 8 is \ not (3+7) *8 but 3 + (7*8). The expression \n 21/7-5 is (21/7) -5 and not \ 21/(7-5)."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["21/7-5"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -2 \ \>", "\<\ -2\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["21/(7-5)"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 21/2 \ \>", "\<\ 21 -- 2\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "In Mathematica (as in other programming languages) it is essential to use \ parenthesis\n to make the meaning of arithemetical expressions transparent. \ "], "Text", Evaluatable->False], Cell[TextData[ "\nExercise: What does a/b/c represent in Mathematica; (a/b)/c or a/(b/c)? \ What about\n a/b*c?"], "Text", Evaluatable->False], Cell[TextData[ "Brackets: Square brackets are used for specifying arguments of functions. \ For example,\n Floor takes a single argument, Floor[ x]. Square brackets \ cannot be used for grouping terms\n in arithmetical functions as done in \ written mathematical work. Try it in a few examples to \n see what \ happens."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["2*[3+4]\n"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ Syntax::sntxf: \"2*\" cannot be followed by \"[3+4]\". \ \>", "\<\ Syntax::sntxf: \"2*\" cannot be followed by \"[3+4]\". \ \>"], "Message", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Braces: These are used for specifying lists. A list is an order \ collection of objects. Lists are\n used for representing vectors, matrices \ and other mathematical collections. Many\n functions will return lists as \ their result and other functions manipulate lists. List\n manipulation is one \ of the most powerful features of Mathematica and is discussed in more\n \ detail in a later section. Here are a few examples of their use.\n We can \ compute the remainder obtained by the first few Fibonacci numbers using the \ list \n manipulation features of Mathematica."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData[ "numbers= { 1,1,2,3,5,8,13,21,34};\n\nMod[ numbers, 3]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ {1, 1, 2, 0, 2, 2, 1, 0, 1} \ \>", "\<\ {1, 1, 2, 0, 2, 2, 1, 0, 1}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Notice the semicolon at the end of the definition of the list named numbers \ above. The\n purpose of the semicolon is suppress the output of the \ expression. Try this in a few of\n your own computations. "], "Text", Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Referring to previous results"], "Subsection", Evaluatable->False], Cell[TextData[ "Mathematica has a convenient mechanism to refer to previously computed\n \ results in a given session. The symbol % can be used to refer to the last \ computed\n result. %n can be used to access the result in the cell Out[n]. \ "], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData[" Prime[ 5]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 11 \ \>", "\<\ 11\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["PrimePi[ %]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 5 \ \>", "\<\ 5\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Here, Prime[n] returns the nth prime and PrimePi[x] returns the number of\n \ primes less than or equal to x.\n\n The use of % and %n in expressions should \ be used very carefully since % refers to\n the last computed output and not \ the one right above the current expression. If you\n do another computation \ between using % and output you want to refer to, then you will\n get \ incorrect results. "], "Text", Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Getting Help"], "Subsection", Evaluatable->False], Cell[TextData[ "Mathematica has extensive online help to access information about functions\n\ and commands. The ? operator can be used for getting help. If a function \n \ is prefixed with ?, then Mathematica prints usage information. "], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["?Quotient"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ Quotient[n, m] gives the integer quotient of n and m, defined as Floor[n/m]. \ \>", "\<\ Quotient[n, m] gives the integer quotient of n and m, defined as Floor[n/m].\ \>"], "Print", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "More detailed information can be obtained by using ??."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["??Mod"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ Mod[m, n] gives the remainder on division of m by n. The result has the same sign as n. Attributes[Mod] = {Listable, Protected} \ \>", "\<\ Mod[m, n] gives the remainder on division of m by n. The result has the same sign as n. Attributes[Mod] = {Listable, Protected}\ \>"], "Print", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "If you don't know the name of a command, then you can\n search by using a * \ in the command name. For example,\n to find all commands beginning with Div, \ use ?Div*"], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["?Div*"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ Divide DivideBy DivisionFreeRowReduction Divisors DivisorSigma \ \>", "\<\ Divide DivideBy DivisionFreeRowReduction Divisors DivisorSigma \ \>"], "Print", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Exercise: Find out what DivisorSigma does and use to verify that \ 2305843008139952128\n is a perfect number. You can also use Divisors to find \ the divisors of the number and\n FactorInteger to find the prime \ factorization."], "Text", Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Functions"], "Subsection", Evaluatable->False, FontFamily->"Times New Roman", FontSize->12, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[TextData[ " The power of Mathematica lies in the enormous number of built-in functions \ and\n the numerous features that can be combined to define complex new \ functions that\n significantly extend the computational capabilities of \ Mathematica. This allows the \n user to quickly expand the abilities of \ Mathematica in powerful ways. \n\n A function is defined by specifying the \ name and its argument list, followed by actions\n to be performed by the \ function. The syntax will be clear from a few examples."], "Text", Evaluatable->False], Cell[TextData["square[x_]:= x^2;\n"], "Input", PageWidth->Infinity], Cell[CellGroupData[{Cell[TextData["square[ 5]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 25 \ \>", "\<\ 25\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["square[ Sqrt[2]]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 2 \ \>", "\<\ 2\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "In the left side of the definition, we specify the arguments of the function \ by\n placing an underbar after the variable. The := specifies that it is the \ definition of\n a function. After this, we give the rule for the evaluation \ of a function. "], "Text", Evaluatable->False], Cell[TextData["Exercise: Define a function to cube of a number."], "Text", Evaluatable->False], Cell[TextData[ "It is essential to use the underbar to represent a variable. If you use an \ underbar,\n then any number can be used as an argument. Otherwise, only the \ argument will\n match the expression. For example,"], "Text", Evaluatable->False], Cell[TextData["\n squareroot[x]:= x^(1/2)"], "Input", PageWidth->Infinity], Cell[CellGroupData[{Cell[TextData["squareroot[4]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ squareroot[4] \ \>", "\<\ squareroot[4]\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["squareroot[x]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ x^(1/2) \ \>", "\<\ Sqrt[x]\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "In this case, only when the argument of squareroot is x does the function\n \ give the correct value. No other expression matches it because of the lack of\ \n the underbar. \n\nThe simplest way to extend the function capabilities is \ to able to define functions\n with different expressions for different \ ranges of the input variables. Recall that we\n did not get the real cube \ root of -1 in a previous computation. Since the value of\n the cube root of \ a negative number is the negative of the cube root of its absolute \n value, \ we can define a function to give the real valued cube root as follows."], "Text", Evaluatable->False], Cell[TextData[ "realcuberoot[x_]:= (x)^(1/3) /; x>=0;\nrealcuberoot[x_]:= - (-x)^(1/3) /; \ x<0;"], "Input", PageWidth->Infinity], Cell[TextData[ "This defines a real valued cube root for real numbers. Notice, the \ definition for \n negative numbers. The /; after the expression specifies the \ conditions under which t\n the function is to be evaluated. Let us try this \ on a few values."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["realcuberoot[-1]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -1 \ \>", "\<\ -1\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["realcuberoot[ -8]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -2 \ \>", "\<\ -2\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["realcuberoot[ 27]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 3 \ \>", "\<\ 3\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "We can define functions by specifying rules for evaluating the functions. \ To define\n the Fibonacci numbers, we can convert the standard recurrence \ relation that defines\n them into a Mathematica function."], "Text", Evaluatable->False], Cell[TextData[ "fib[1]=1;\nfib[2]=1;\nfib[ n_]:= fib[ n-1] + fib[n-2]\n"], "Input", PageWidth->Infinity], Cell[CellGroupData[{Cell[TextData["fib[10]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 55 \ \>", "\<\ 55\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData["fib[30]"], "Input", PageWidth->Infinity], Cell[TextData[ "If you evaluated fib[30] then you would have noticed that the computation \ took a few\n minutes (depending on the speed of your machine). This happens \ because to evaluate\n fib[30], Mathematica first computes fib[29] and \ fib[28]. To evaluate fib[29] it\n has to compute fib[28] and all the smaller \ Fibonacci numbers, but these intermediate\n computations are then thrown \ away. To compute fib[28], then Mathematica again\n computes all the previous \ values. This is very inefficient in terms of computational time,\n so there \ is a way to tell Mathematica to remember all the intermediate values in\n a \ computation. This is done in the following way. We first make Mathematica\n\ forget the old definition by using the Clear command."], "Text", Evaluatable->False], Cell[TextData[ "Clear[fib]\nfib[1]=1;\nfib[2]=1;\nfib[n_]:= fib[n]= fib[n-1] + fib[n-2]"], "Input", PageWidth->Infinity], Cell[TextData[ "Here the definition fib[n_]:= fib[n] tells Mathematica to remember all the\n\ intermediate values. Now the computation should work much faster. There are \ also\n ways to compute large Fibonacci numbers directly, without computing \ all the\n previous ones. "], "Text", Evaluatable->False], Cell[TextData["Exercise: Define functions to compute n! and |x|. "], "Text", Evaluatable->False], Cell[TextData[ "More detailed description of functions using the Module command are\n \ described in the section on procedural programming."], "Text", Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Number Theoretic Functions"], "Subsection", Evaluatable->False, FontFamily->"Times New Roman", FontSize->12, FontWeight->"Bold", FontColor->GrayLevel[0], Background->GrayLevel[1]], Cell[TextData[ "Some of the built-in functions that are useful for doing number theoretic \ work\n are the following. \n\nMod[k,n] \t: computes the remainder when k is \ divided by n.\n\nQuotient[k,n]: Gives the integer quotient defined by \ Floor[k/n].\n\nGCD[n1,n2,...]: Gives the greatest common divisor of the \ arguments.\n\nPrimeQ[n]: Returns True if the number is prime and False \ otherwise.\n\nPrime[k]: Gives the kth prime.\n\nFactorInteger[ n]: \ Returns the prime factorization of n. The function is only suitable\n \ for integers less than 10^12. \n\nOther useful functions are \ PowerMod and EulerPhi.\n\nHere are a few examples of using these functions."], "Text", Evaluatable->False], Cell[TextData["\n"], "Input", PageWidth->Infinity], Cell[CellGroupData[{Cell[TextData["\nPrimeQ[ 2^61 -1]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ True \ \>", "\<\ True\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "This shows that 2^61 -1 is prime. Use of PrimeQ is not a proof that a \ number is\n prime. For proofs of primality of a number, consult your number \ theory textbook."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["FactorInteger[ 1234567]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ {{127, 1}, {9721, 1}} \ \>", "\<\ {{127, 1}, {9721, 1}}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "The result of FactorInteger is a list of the prime factors and the \ exponent to which\n that prime occurs in the factorization. In the above, \ 1234567 = 127 * 9721.\n\n FactorInteger is limited to about 12-15 digits and \ for numbers with more digits other\n methods are required. Consult your \ number theory book for details on other methods.\n Many functions such as \ Divisors, DivisorSigma and EulerPhi depend on FactorInteger,\n hence they too \ are restricted in the size of the input."], "Text", Evaluatable->False], Cell[TextData[ " For small numbers, we can verify if a number n is prime by dividing it\n by \ all primes up to sqrt(n). This is a good illustration of combining \ Mathematica functions.\n Let us verify that 9721 is Prime. We compute the \ primes up to sqrt(9721) using the following c\ncommands."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData[ "\nn=9721;\nk=N[ Sqrt[9721]]\n\nnumprimes= PrimePi[ k]\n\nlistofprimes= \ Table[ Prime[ i], { i, 1, numprimes}]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 98.5951317256588 \ \>", "\<\ 98.5951\ \>"], "Output", PageWidth->Infinity, Evaluatable->False], Cell[OutputFormData["\<\ 25 \ \>", "\<\ 25\ \>"], "Output", PageWidth->Infinity, Evaluatable->False], Cell[OutputFormData["\<\ {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97} \ \>", "\<\ {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Next, we can divide 9721 by all these numbers. Many Mathematica functions\n \ are Listable, that is, they can take a list as an argument and apply the \ function\n to each element. ( The same thing would require the use of loop \ structures in\n other languages.) The Table command and few other list \ related functions are discussed in\n the following section."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["Mod[ n, listofprimes]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ {1, 1, 1, 5, 8, 10, 14, 12, 15, 6, 18, 27, 4, 3, 39, 22, 45, 22, 6, 65, 12, 4, 10, 20, 21} \ \>", "\<\ {1, 1, 1, 5, 8, 10, 14, 12, 15, 6, 18, 27, 4, 3, 39, 22, 45, 22, 6, 65, 12, 4, 10, 20, 21}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "We computed the remainder when n is divided by all the primes up to square \ root of\n n and we see that all the remainders are non-zero. This proves \ that the number 9721\n is prime."], "Text", Evaluatable->False], Cell[TextData[ "Exercise: Verify that 7927 and 47419 are primes by using this division \ method."], "Text", Evaluatable->False], Cell[TextData[ "This method is not suitable for large numbers. More efficient methods for \ large primes\n are discussed in your textbook."], "Text", Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Lists"], "Subsection", Evaluatable->False], Cell[TextData[ "Mathematica is a powerful list processing language and has a lot of \ commands \n to manipulate and create lists. A list is an ordered collection \ of objects and Mathematica\n has commands for inserting elements to a list, \ to manipulate and apply functions to\n the list. \n\n The simplest list \ creation function is the Table commad. The first argument of Table\n is the \ function and the second is a range. To create a table of the first ten \ squares, we can\n write"], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["Table[ x^2, { x, 1, 10}]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ {1, 4, 9, 16, 25, 36, 49, 64, 81, 100} \ \>", "\<\ {1, 4, 9, 16, 25, 36, 49, 64, 81, 100}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "The range { x, 1, 10} specifies that x ranges from 1 through 10, \ increasing by 1 in\n each step. If we wanted the first ten odd squares, then \ we can use the range { x, 1, 20, 2}.\n Now x is incremented by 2 in each \ step. An ith element of a list L can be accessed by\n L[[i]]. The first and \ last elements of L are obtained by First[L] and Last[L]. A list is like a\n \ vector and a list of lists (all identical size) is like a matrix, so matrix \ operations\n can be applied to these. Transpose exchanges the rows and the \ columns.\n\nConsider the application of these in the following example."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData[ "factors= FactorInteger[ 789672]\n\n\nx= Transpose[factors]\n\nprimefactors= \ First[x]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ {{2, 3}, {3, 1}, {13, 1}, {2531, 1}} \ \>", "\<\ {{2, 3}, {3, 1}, {13, 1}, {2531, 1}}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False], Cell[OutputFormData["\<\ {{2, 3, 13, 2531}, {3, 1, 1, 1}} \ \>", "\<\ {{2, 3, 13, 2531}, {3, 1, 1, 1}}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False], Cell[OutputFormData["\<\ {2, 3, 13, 2531} \ \>", "\<\ {2, 3, 13, 2531}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "The result of these operations is to extract the prime factors of the \ number. FactorInteger\n returns a list of lists, ( a matrix) whose rows have \ two elements each, a prime and its\nexponent in the factorization. Transpose \ interchanges the rows and columns, so the first\n element of the transposed \ list is now a list of the prime factors. \n\n More list processing functions \ are discussed in a separate chapter."], "Text", Evaluatable->False], Cell[TextData[ "Exercise: Make a list of the first fifty Fibonacci numbers. Divide them \ by3.\n Which are divisible by 3? Make a conjecture and test it for larger \ Fibonacci numbers\n by making a list of only those Fibonacci numbers that \ you think are multiples of 3. \n Repeat the exercise to test divisibility by \ 3."], "Text", Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["The Clear command"], "Subsection", Evaluatable->False], Cell[TextData[ " An important feature of Mathematica is that it remembers the values of \ variables\n and definitions of functions throughout the session. This can be \ a problem when the\n same names are used again, because Mathematica will use \ the old values. You can\n remove the values and names from Mathematica's \ memory by using the Clear command.\nIt is important to do this, as \ Mathematica will not compute a new value for a function\n that is stored in \ memory. Not clearing names is the most frequent source of erroneous\n \ results in Mathematica programs. Consider the following example."], "Text", Evaluatable->False], Cell[TextData[ "Suppose f is a function for which f[2]=4 is already defined."], "Text", Evaluatable->False], Cell[TextData["Let us redefine f and compute f[3];"], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["f[3]=8;\nf[x_]:=x^3;\nf[3]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 8 \ \>", "\<\ 8\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "\nLet us redefine f to a new function and see what happens."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["\nf[a_]:= a+2;\nf[3]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 8 \ \>", "\<\ 8\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["f[2]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 8 \ \>", "\<\ 8\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["f[5]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 125 \ \>", "\<\ 125\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "The redefinition does not effect the values of the function. For this, it is \ necessary to clear\n all the values if the function. It is best to place the \ clear statement before the definition\n of a function. This way, if you make \ changes to the function, then the function is cleared\n before the changes \ are entered and all values will be computed again."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["Clear[f]\nf[a_]:= a+2;\nf[3]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 5 \ \>", "\<\ 5\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["Loops and Conditionals"], "Subsection", Evaluatable->False], Cell[CellGroupData[{Cell[TextData[" If statement"], "Subsubsection", Evaluatable->False], Cell[TextData[ " The If statement is used to perform actions based on the results of tests. \ The general\n format of the statement is \n\n If[ test, statements1, \ statements2]\n\n where statesments1 is performed if the result of the test \ is True and statements2\n is performed if the result of the test is False. \ If nothing is to be done when the test\n is False then statements2 can be \ omitted. It is important to separate the statements\n with a comma. The \ statements can be a series of expression separated by semi-colons."], "Text", Evaluatable->False], Cell[TextData[ "Clear[ realcuberoot]\nrealcuberoot[x_]:= If[ x>= 0,\n \ x^(1/3), (* True value *)\n -(-x)^(1/3) (*False \ value *)\n ]\n"], "Input", PageWidth->Infinity], Cell[CellGroupData[{Cell[TextData["realcuberoot[-1]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ -1 \ \>", "\<\ -1\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "\n The function returns the real cube root of a negative number. Observe \ that we\n placed a comment about the result in the If statement. Mathematica \ comments\n are placed between the expressions (* and *). \n\n Another \ example of an If statement is the following in which we check if a number\n \ is a perfect square. "], "Text", Evaluatable->False], Cell[TextData[ "squareQ[ n_]:= If[ Floor[ N[Sqrt[n]]]^2== n,\n True, \ (* Yes, aperfect square *)\n False (* not a square *)\n\ ]"], "Input", PageWidth->Infinity], Cell[CellGroupData[{Cell[TextData["squareQ[196]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ True \ \>", "\<\ True\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["squareQ[255]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ False \ \>", "\<\ False\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "The function can be written without any If statements by writing\n \ squareQ[n_]:= Floor[ N[ Sqrt[n]]]^2 == n;\n\n This is because the result of \ the test for equality is a True or False. The following are\n the relational \ operators that can be used. These can be combined with logical operators,\n \ And, Or , or Not to create all the tests that we need.\n\n x = = y Is x \ equal to y?\n\nx!= y Is x not equal to y?\n\n x> y Is x \ greater than y?\n\nx< y Is x less than y.\n\n Similarly, the \ relations >= and <= are self-explanatory. The only issue to keep in mind is\n\ that two equal signs are necessary for a test of equality. A single = is an \ assignment of\n one to the other and not a test. The boolean AND operator is \ represented by\n && and the logical OR by ||. The complement is represented \ by the exclamation !.\n For example, to test if n is a prime that is not of \ the form 5k+3, we can use\n\n PrimeQ[n] && !( Mod[ n,5]==3)."], "Text", Evaluatable->False], Cell[TextData[ "Exercise: Write a function that returns True if a number is either a prime \ or a perfect square, \n and False otherwise..\n\nWrite another function that \ returns True if a number is a prime or the square of a\n prime, and False \ otherwise. "], "Text", Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["The While statement"], "Subsubsection", Evaluatable->False], Cell[TextData[ "The While statement is used to evaluate a series of statements as long as\n\ the specified condition is True. The structure of the While statement is \ the following.\n\n While[ condition,\n statements]\n\n The \ statements are repeatedly executed while the condition holds True and the\n \ loop is exited when the condition is False. \n\n Consider the following \ function to find the first prime larger than an integer. We use \nPrimeQ to \ test if a number is prime. The function also illustrates the use of the \n \ Module function to define functions."], "Text", Evaluatable->False], Cell[TextData[ "firstprimeabove[ n_]:= Module[ {k},\n k=n+1;\n \ \t\t\t\t\t While[ !PrimeQ[k], \n \ k=k+1;\n ];\n \ Return[k];\n ]"], "Input", PageWidth->Infinity], Cell[CellGroupData[{Cell[TextData["firstprimeabove[ 167]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 173 \ \>", "\<\ 173\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "In the While loop, we increment k as along as it is not prime. When the \ loop is \n finished k is prime. Observe that even if the input is prime, \ then the function returns the\n next prime. The first statement of Module is \ a list of the variables internal to the Module, and\n are placed within \ braces. After that, there is a series of statements separated by semi-\n\ colons. "], "Text", Evaluatable->False], Cell[TextData[ "Exercise: Modify the function to return the second prime above n, or \ more\n generally, the function should take a second argument r, and return \ the rth prime\n above n."], "Text", Evaluatable->False]}, Open]], Cell[CellGroupData[{Cell[TextData["Do and For loops:"], "Subsubsection", Evaluatable->False], Cell[TextData[ " The Do loop executes a series of statements for a variable in the \ specified range.\n\nThe general format is \n\n Do[ statements,\n \ range]\n\n As an example, suppose we wish to print all the primes less than \ 100 that are\n of the form 8k+1, then we write"], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData[ "Do[ If[ PrimeQ[n] && (Mod[n,8]==1),\n Print[ n]\n ],\n \ {n, 3, 100,2}]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 17 41 73 89 97 \ \>", "\<\ 17 41 73 89 97\ \>"], "Print", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Exercise: The condition in the If statement can be reduced to PrimeQ[n] by\n \ modifying the range of n. Explain how to do this."], "Text", Evaluatable->False], Cell[TextData[ "Exercise: Write a program to print primes of\n the form x^2 +y^2. You can \ use one Do loop within another. "], "Text", Evaluatable->False], Cell[TextData["The For Statement"], "Subsubsection", Evaluatable->False], Cell[TextData[ "The For statement is more general than the Do loop and equivalent to the \ While\n statement. As a generalization of the Do it also includes a test \ and an increment.\n\n The format is\n For[ init, test, increment, \ statements]\n where init is the initialization sequence, and then the \ statements are executed while\n the test is true. The increment is performed \ after the statements are executed and the\n test is performed before the \ statements are executed. "], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["For[ x=1, x< 10, x++, Print[ Prime[x]] ]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ 2 3 5 7 11 13 17 19 23 \ \>", "\<\ 2 3 5 7 11 13 17 19 23\ \>"], "Print", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Here we used the increment operator ++ to increase the value of x by one. \ x++ is\n equivalent to x= x+1;"], "Text", Evaluatable->False]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["The Print statement"], "Subsection", Evaluatable->False], Cell[TextData[ " We have already seen a few examples of the use of the Print statement. As \ Mathematica\n prints the result of most calculations, it is usually not \ necessary to use the Print statement, except\n to format the output for \ improved readability. There are some features of the\n Print statement that \ should be kept in mind. The first is that Print does not leave any\n space \ between the values of different arguments. The amount of space for proper\n \ display has to be specified by you. For example,"], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["Print[ a,b,c]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ abc \ \>", "\<\ abc\ \>"], "Print", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "To get the appropriate space, specify it in the statement."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["Print[ a, \" \", b, \" \", c]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ a b c \ \>", "\<\ a b c\ \>"], "Print", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Additional characters that are useful are \"\\t\" for the tab and \"\\n\" \ for the end of line. Unlike\n C, Mathematica always places an end of line \ character at the end of a Print statement."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData[ "Do[ Print[ \"First prime above \", 10^n, \" is \",\n \ firstprimeabove[ 10^n]],\n {n, 1, 10}]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ First prime above 10 is 11 First prime above 100 is 101 First prime above 1000 is 1009 First prime above 10000 is 10007 First prime above 100000 is 100003 First prime above 1000000 is 1000003 First prime above 10000000 is 10000019 First prime above 100000000 is 100000007 First prime above 1000000000 is 1000000007 First prime above 10000000000 is 10000000019 \ \>", "\<\ First prime above 10 is 11 First prime above 100 is 101 First prime above 1000 is 1009 First prime above 10000 is 10007 First prime above 100000 is 100003 First prime above 1000000 is 1000003 First prime above 10000000 is 10000019 First prime above 100000000 is 100000007 First prime above 1000000000 is 1000000007 First prime above 10000000000 is 10000000019\ \>"], "Print", PageWidth->Infinity, Evaluatable->False]}, Open]]}, Open]], Cell[CellGroupData[{Cell[TextData["File IO"], "Subsection", Evaluatable->False], Cell[TextData[ "Sometimes it is necessary to write data to a file or to read data from a \ file. An \n expression can be stored in a file using the redirection arrows, \ >>. For example,"], "Text", Evaluatable->False], Cell[TextData["{ 2, 3, 5, 7, 11, 13, 17, 19,23}>> primefile"], "Input", PageWidth->Infinity], Cell[TextData[ "will create a file called primefile where the list will be stored. This can \ be read into\n any expression using the ReadList command."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["primes= ReadList[ \"primefile\", Expression]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ {{2, 3, 5, 7, 11, 13, 17, 19, 23}} \ \>", "\<\ {{2, 3, 5, 7, 11, 13, 17, 19, 23}}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "Notice that this has placed an extra set of braces around the input. The \ extra\n set of braces can be removed using the Flatten command, which removes \ all the\nbraces (except the outermost ones) from a list."], "Text", Evaluatable->False], Cell[CellGroupData[{Cell[TextData["primes= Flatten[ primes]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ {2, 3, 5, 7, 11, 13, 17, 19, 23} \ \>", "\<\ {2, 3, 5, 7, 11, 13, 17, 19, 23}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]], Cell[TextData[ "To add to a file we can use the PutAppend command or its short form, >>>."], "Text", Evaluatable->False], Cell[TextData["{ 29, 31, 37, 41, 43, 47} >>> primefile"], "Input", PageWidth->Infinity], Cell[CellGroupData[{Cell[TextData[ "primes= Flatten[ ReadList[ \"primefile\", Expression]]"], "Input", PageWidth->Infinity], Cell[OutputFormData["\<\ {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47} \ \>", "\<\ {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47}\ \>"], "Output", PageWidth->Infinity, Evaluatable->False]}, Open]]}, Open]] }, FrontEndVersion->"X 3.0", ScreenRectangle->{{0, 1280}, {0, 1024}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{520, 600}, WindowMargins->{{260, Automatic}, {Automatic, 177}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False} ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1711, 51, 116, 3, 70, "Title", Evaluatable->False], Cell[1830, 56, 281, 5, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[2134, 63, 66, 1, 70, "Subsection", Evaluatable->False], Cell[2203, 66, 884, 12, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[3119, 80, 81, 1, 70, "Subsection", Evaluatable->False], Cell[3203, 83, 418, 7, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[3644, 92, 62, 1, 70, "Input"], Cell[3709, 95, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[3830, 109, 150, 3, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[4003, 114, 59, 1, 70, "Input"], Cell[4065, 117, 147, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[4244, 131, 64, 1, 70, "Input"], Cell[4311, 134, 153, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[4496, 148, 55, 1, 70, "Input"], Cell[4554, 151, 118, 14, 70, "Output", Evaluatable->False] }, Open ]], Cell[4684, 167, 525, 8, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[5232, 177, 63, 1, 70, "Input"], Cell[5298, 180, 132, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[5442, 194, 208, 4, 70, "Text", Evaluatable->False], Cell[5653, 200, 52, 1, 70, "Input"], Cell[5708, 203, 371, 6, 70, "Text", Evaluatable->False], Cell[6082, 211, 205, 4, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[6310, 217, 60, 1, 70, "Input"], Cell[6373, 220, 127, 13, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[6532, 235, 67, 1, 70, "Input"], Cell[6602, 238, 164, 13, 70, "Output", Evaluatable->False] }, Open ]], Cell[6778, 253, 464, 7, 70, "Text", Evaluatable->False], Cell[7245, 262, 256, 4, 70, "Text", Evaluatable->False], Cell[7504, 268, 301, 5, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[7828, 275, 70, 1, 70, "Input"], Cell[7901, 278, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[8042, 292, 62, 1, 70, "Input"], Cell[8107, 295, 107, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[8246, 309, 67, 1, 70, "Input"], Cell[8316, 312, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[8457, 326, 62, 1, 70, "Input"], Cell[8522, 329, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[8643, 343, 160, 3, 70, "Text", Evaluatable->False], Cell[8806, 348, 428, 7, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[9257, 357, 62, 1, 70, "Input"], Cell[9322, 360, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[9463, 374, 63, 1, 70, "Input"], Cell[9529, 377, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[9670, 391, 62, 1, 70, "Input"], Cell[9735, 394, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[9876, 408, 62, 1, 70, "Input"], Cell[9941, 411, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[10062, 425, 121, 3, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[10206, 430, 62, 1, 70, "Input"], Cell[10271, 433, 107, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[10410, 447, 64, 1, 70, "Input"], Cell[10477, 450, 133, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[10622, 464, 87, 1, 70, "Subsection", Evaluatable->False], Cell[10712, 467, 194, 4, 70, "Text", Evaluatable->False], Cell[10909, 473, 436, 7, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[11368, 482, 56, 1, 70, "Input"], Cell[11427, 485, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[11568, 499, 58, 1, 70, "Input"], Cell[11629, 502, 116, 14, 70, "Output", Evaluatable->False] }, Closed]], Cell[11757, 518, 204, 4, 70, "Text", Evaluatable->False], Cell[11964, 524, 145, 3, 70, "Text", Evaluatable->False], Cell[12112, 529, 354, 6, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[12489, 537, 59, 1, 70, "Input"], Cell[12551, 540, 234, 18, 70, "Message", Evaluatable->False] }, Open ]], Cell[12797, 560, 628, 9, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[13448, 571, 104, 2, 70, "Input"], Cell[13555, 575, 159, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[13726, 589, 256, 4, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[14014, 595, 83, 1, 70, "Subsection", Evaluatable->False], Cell[14100, 598, 280, 5, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[14403, 605, 60, 1, 70, "Input"], Cell[14466, 608, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[14607, 622, 61, 1, 70, "Input"], Cell[14671, 625, 107, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[14790, 639, 454, 7, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[15276, 648, 66, 1, 70, "Subsection", Evaluatable->False], Cell[15345, 651, 271, 4, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[15639, 657, 59, 1, 70, "Input"], Cell[15701, 660, 268, 16, 70, "Print", Evaluatable->False] }, Open ]], Cell[15981, 678, 103, 2, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[16107, 682, 55, 1, 70, "Input"], Cell[16165, 685, 376, 20, 70, "Print", Evaluatable->False] }, Open ]], Cell[16553, 707, 215, 4, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[16791, 713, 55, 1, 70, "Input"], Cell[16849, 716, 230, 22, 70, "Print", Evaluatable->False] }, Open ]], Cell[17091, 740, 277, 5, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[17400, 747, 189, 6, 70, "Subsection", Evaluatable->False], Cell[17592, 755, 563, 8, 70, "Text", Evaluatable->False], Cell[18158, 765, 69, 1, 70, "Input"], Cell[CellGroupData[{ Cell[18250, 768, 60, 1, 70, "Input"], Cell[18313, 771, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[18454, 785, 66, 1, 70, "Input"], Cell[18523, 788, 107, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[18642, 802, 300, 5, 70, "Text", Evaluatable->False], Cell[18945, 809, 96, 1, 70, "Text", Evaluatable->False], Cell[19044, 812, 258, 4, 70, "Text", Evaluatable->False], Cell[19305, 818, 76, 1, 70, "Input"], Cell[CellGroupData[{ Cell[19404, 821, 63, 1, 70, "Input"], Cell[19470, 824, 131, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[19633, 838, 63, 1, 70, "Input"], Cell[19699, 841, 119, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[19830, 855, 667, 10, 70, "Text", Evaluatable->False], Cell[20500, 867, 131, 3, 70, "Input"], Cell[20634, 872, 292, 5, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[20949, 879, 66, 1, 70, "Input"], Cell[21018, 882, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[21159, 896, 67, 1, 70, "Input"], Cell[21229, 899, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[21370, 913, 67, 1, 70, "Input"], Cell[21440, 916, 107, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[21559, 930, 262, 4, 70, "Text", Evaluatable->False], Cell[21824, 936, 106, 2, 70, "Input"], Cell[CellGroupData[{ Cell[21953, 940, 57, 1, 70, "Input"], Cell[22013, 943, 109, 12, 70, "Output", Evaluatable->False] }, Open ]], Cell[22134, 957, 57, 1, 70, "Input"], Cell[22194, 960, 801, 11, 70, "Text", Evaluatable->False], Cell[22998, 973, 125, 3, 70, "Input"], Cell[23126, 978, 310, 5, 70, "Text", Evaluatable->False], Cell[23439, 985, 99, 1, 70, "Text", Evaluatable->False], Cell[23541, 988, 173, 3, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[23746, 993, 206, 6, 70, "Subsection", Evaluatable->False], Cell[23955, 1001, 742, 11, 70, "Text", Evaluatable->False], Cell[24700, 1014, 52, 1, 70, "Input"], Cell[CellGroupData[{ Cell[24775, 1017, 68, 1, 70, "Input"], Cell[24846, 1020, 112, 11, 70, "Output", Evaluatable->False] }, Open ]], Cell[24970, 1033, 220, 4, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[25213, 1039, 73, 1, 70, "Input"], Cell[25289, 1042, 146, 11, 70, "Output", Evaluatable->False] }, Open ]], Cell[25447, 1055, 546, 8, 70, "Text", Evaluatable->False], Cell[25996, 1065, 331, 5, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[26350, 1072, 161, 3, 70, "Input"], Cell[26514, 1077, 127, 11, 70, "Output", Evaluatable->False], Cell[26644, 1090, 108, 11, 70, "Output", Evaluatable->False], Cell[26755, 1103, 308, 15, 70, "Output", Evaluatable->False] }, Open ]], Cell[27075, 1120, 414, 6, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[27512, 1128, 71, 1, 70, "Input"], Cell[27586, 1131, 290, 13, 70, "Output", Evaluatable->False] }, Open ]], Cell[27888, 1146, 236, 4, 70, "Text", Evaluatable->False], Cell[28127, 1152, 130, 3, 70, "Text", Evaluatable->False], Cell[28260, 1157, 172, 3, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[28464, 1162, 59, 1, 70, "Subsection", Evaluatable->False], Cell[28526, 1165, 529, 8, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[29078, 1175, 74, 1, 70, "Input"], Cell[29155, 1178, 180, 11, 70, "Output", Evaluatable->False] }, Open ]], Cell[29347, 1191, 661, 10, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[30031, 1203, 137, 3, 70, "Input"], Cell[30171, 1208, 176, 11, 70, "Output", Evaluatable->False], Cell[30350, 1221, 168, 11, 70, "Output", Evaluatable->False], Cell[30521, 1234, 136, 11, 70, "Output", Evaluatable->False] }, Open ]], Cell[30669, 1247, 475, 7, 70, "Text", Evaluatable->False], Cell[31147, 1256, 358, 6, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[31537, 1264, 71, 1, 70, "Subsection", Evaluatable->False], Cell[31611, 1267, 644, 9, 70, "Text", Evaluatable->False], Cell[32258, 1278, 110, 2, 70, "Text", Evaluatable->False], Cell[32371, 1282, 83, 1, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[32477, 1285, 76, 1, 70, "Input"], Cell[32556, 1288, 105, 10, 70, "Output", Evaluatable->False] }, Open ]], Cell[32673, 1300, 110, 2, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[32806, 1304, 70, 1, 70, "Input"], Cell[32879, 1307, 105, 10, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[33016, 1319, 54, 1, 70, "Input"], Cell[33073, 1322, 105, 10, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[33210, 1334, 54, 1, 70, "Input"], Cell[33267, 1337, 109, 10, 70, "Output", Evaluatable->False] }, Open ]], Cell[33388, 1349, 414, 6, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[33825, 1357, 78, 1, 70, "Input"], Cell[33906, 1360, 105, 10, 70, "Output", Evaluatable->False] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[34052, 1372, 76, 1, 70, "Subsection", Evaluatable->False], Cell[CellGroupData[{ Cell[34151, 1375, 70, 1, 70, "Subsubsection", Evaluatable->False], Cell[34224, 1378, 571, 8, 70, "Text", Evaluatable->False], Cell[34798, 1388, 243, 4, 70, "Input"], Cell[CellGroupData[{ Cell[35064, 1394, 66, 1, 70, "Input"], Cell[35133, 1397, 107, 10, 70, "Output", Evaluatable->False] }, Open ]], Cell[35252, 1409, 376, 6, 70, "Text", Evaluatable->False], Cell[35631, 1417, 229, 4, 70, "Input"], Cell[CellGroupData[{ Cell[35883, 1423, 62, 1, 70, "Input"], Cell[35948, 1426, 111, 10, 70, "Output", Evaluatable->False] }, Open ]], Cell[CellGroupData[{ Cell[36091, 1438, 62, 1, 70, "Input"], Cell[36156, 1441, 113, 10, 70, "Output", Evaluatable->False] }, Open ]], Cell[36281, 1453, 1043, 14, 70, "Text", Evaluatable->False], Cell[37327, 1469, 293, 5, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[37652, 1476, 76, 1, 70, "Subsubsection", Evaluatable->False], Cell[37731, 1479, 621, 9, 70, "Text", Evaluatable->False], Cell[38355, 1490, 330, 5, 70, "Input"], Cell[CellGroupData[{ Cell[38708, 1497, 71, 1, 70, "Input"], Cell[38782, 1500, 108, 9, 70, "Output", Evaluatable->False] }, Open ]], Cell[38902, 1511, 438, 7, 70, "Text", Evaluatable->False], Cell[39343, 1520, 225, 4, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[39600, 1526, 74, 1, 70, "Subsubsection", Evaluatable->False], Cell[39677, 1529, 322, 5, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[40022, 1536, 145, 3, 70, "Input"], Cell[40170, 1541, 129, 17, 70, "Print", Evaluatable->False] }, Open ]], Cell[40311, 1560, 177, 3, 70, "Text", Evaluatable->False], Cell[40491, 1565, 159, 3, 70, "Text", Evaluatable->False], Cell[40653, 1570, 74, 1, 70, "Subsubsection", Evaluatable->False], Cell[40730, 1573, 523, 8, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[41276, 1583, 90, 1, 70, "Input"], Cell[41369, 1586, 145, 25, 70, "Print", Evaluatable->False] }, Open ]], Cell[41526, 1613, 156, 3, 70, "Text", Evaluatable->False] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[41723, 1618, 73, 1, 70, "Subsection", Evaluatable->False], Cell[41799, 1621, 558, 8, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[42380, 1631, 63, 1, 70, "Input"], Cell[42446, 1634, 107, 9, 70, "Print", Evaluatable->False] }, Open ]], Cell[42565, 1645, 108, 2, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[42696, 1649, 79, 1, 70, "Input"], Cell[42778, 1652, 111, 9, 70, "Print", Evaluatable->False] }, Open ]], Cell[42901, 1663, 243, 4, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[43167, 1669, 161, 3, 70, "Input"], Cell[43331, 1674, 819, 27, 70, "Print", Evaluatable->False] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[44191, 1703, 61, 1, 70, "Subsection", Evaluatable->False], Cell[44255, 1706, 220, 4, 70, "Text", Evaluatable->False], Cell[44478, 1712, 94, 1, 70, "Input"], Cell[44575, 1715, 186, 3, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[44784, 1720, 94, 1, 70, "Input"], Cell[44881, 1723, 170, 9, 70, "Output", Evaluatable->False] }, Closed]], Cell[45063, 1734, 261, 4, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[45347, 1740, 74, 1, 70, "Input"], Cell[45424, 1743, 166, 9, 70, "Output", Evaluatable->False] }, Closed]], Cell[45602, 1754, 126, 3, 70, "Text", Evaluatable->False], Cell[45731, 1759, 89, 1, 70, "Input"], Cell[CellGroupData[{ Cell[45843, 1762, 105, 2, 70, "Input"], Cell[45951, 1766, 220, 11, 70, "Output", Evaluatable->False] }, Closed]] }, Closed]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)