(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing 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[ 73884, 2578]*) (*NotebookOutlinePosition[ 74627, 2604]*) (* CellTagsIndexPosition[ 74583, 2600]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ "Physicist's Introduction to ", StyleBox["Mathematica:\n", FontSlant->"Italic"], StyleBox["Second Edition 2006", "Subtitle", FontSlant->"Italic"] }], "Title"], Cell["\<\ \tPhysics 200 \tNicholas Wheeler \tREED COLLEGE \t\t\ \>", "Subsubtitle"], Cell[TextData[{ "NOTE: The first edition of this material, written during the summer of \ 2000, was designed in the presumption that ", StyleBox["Mathematica", FontSlant->"Italic"], " 4 would be running on Macintosh OS 9. It is now 2006. During the \ interval, ", StyleBox["Mathematica ", FontSlant->"Italic"], "has acquired new capabilities, and OS X has become commonplace. I write \ now in the presumption that ", StyleBox["Mathematica", FontSlant->"Italic"], " 5.2 will be running on OS X version 10.4 or a comparable system.\n\nMajor \ attention was given in the first edition to matters having to do with memory \ management. That material has been now deleted: modern computers routinely \ have much more memory than was commonly available in 2000, and memory \ management is handled automatically by OS X. \n\nI have taken this \ opportunity to provide accounts of a few useful commands that were \ inadvertently omitted from the first edition, and to describe a few resources\ \[LongDash]most notably, the singular value decomposition (SVD) of an \ arbitrary rectangular matrix\[LongDash]that became available for the first \ time in ", StyleBox["Mathematica", FontSlant->"Italic"], " 5. I have also deleted material that seemed on second thought to \ introduce unnecessary clutter and complexity into the text.\n\n " }], "Subsubsection"], Cell[CellGroupData[{ Cell[TextData[StyleBox["Laboratory 0", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]]], "Subtitle"], Cell[CellGroupData[{ Cell[TextData[{ "Why Bother to Learn ", StyleBox["Mathematica", FontSlant->"Italic"], "?" }], "Section"], Cell[TextData[{ "Until a few years ago my own response to that question would have been \ \"Why indeed? I became a physicist in order to learn some things about how \ Nature works, not things about v.5 of some proprietary \ software\[Ellipsis]described in a book thicker and heavier than any of my \ physics books!\" But the fact of the matter is that we probe Nature not with \ our bare hands, but with tools\[LongDash]man-made contrivances, whether we \ call them principles, theorems, analytical techniques or multi-channel \ analyzers. So the short answer is: Because ", StyleBox["Mathematica", FontSlant->"Italic"], " is a wonderful new tool\[LongDash]sharper and more broadly useful than \ most others that spring to mind, and remarkably easy to use.", StyleBox["\n\t", FontFamily->"AGaramond"], StyleBox["Mathematica", FontSlant->"Italic"], ", first released in June 1988, is a creation of Stephen Wolfram (born in \ 1959). It provides an almost exhaustive compendium of mathematical data and \ information, and a computing engine of such immeasurably broad potential that \ few can claim mastery of all its parts\[Ellipsis]which is why ", StyleBox["The Mathematica Book ", FontSlant->"Italic"], "is so thick, and why so many excellent monographs treating this or that \ special area of application have come into being. Let us therefore accept at \ the outset that our present objective must be a limited one\[LongDash]to gain \ a working familiarity with the elementary first principles of ", StyleBox["Mathematica", FontSlant->"Italic"], ", and some rough sense of its potential. Refined procedures we agree to \ reserve for the day when the work at hand ", StyleBox["requires", FontSlant->"Italic"], " that we move beyond the basics, and lends urgency to the effort.", StyleBox["\n\t", FontFamily->"AGaramond"], "It will very soon become apparent to you that ", StyleBox["Mathematica", FontSlant->"Italic"], " is so powerful\[LongDash]and so easy to control\[LongDash]that it opens a \ door to quick-and-easy ", StyleBox["mathematical experimentation", FontColor->RGBColor[0, 0, 1]], " that until now has stood shut even to the greatest minds\[LongDash]a door \ to an entirely new and much more improvisatory way of thinking about and \ doing pure & applied mathematics. You will find yourself in position to do \ things that formerly you would not even have dreamed of doing (certainly not \ of doing casually, without a lot of labor-intensive special-purpose \ programming), and that the formulation/testing of conjectures has come to \ occupy a central position in your mathematical life. " }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Getting Started\[Ellipsis]and Stopped", "Section"], Cell[TextData[{ "I begin with a cautionary word: It is inevitable that you will from time \ to time (and especially in the beginning) steer ", StyleBox["Mathematica", FontSlant->"Italic"], " off the road, and have to ", StyleBox["Restart", FontWeight->"Bold"], ". To avoid catastrophy" }], "Text"], Cell[TextData[{ StyleBox["Be sure that you have ", FontSize->18], StyleBox["Saved", FontSize->18, FontWeight->"Bold"], StyleBox[" open documents running on other applications.", FontSize->18] }], "IndentedText", FontColor->RGBColor[1, 0, 0]], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " comes in two large and semi-autonomous packages:" }], "Text"], Cell[TextData[{ "\[Bullet] the computing engine itself, called the \"kernel\" (formally ", StyleBox["MathKernel", FontSlant->"Italic"], ");" }], "IndentedText"], Cell[TextData[{ "\[Bullet] the \"front end\" (formally ", StyleBox["Mathematica", FontSlant->"Italic"], "5), which mediates the flow of information between you and the kernel (or \ perhaps several kernels, running simultaneously on several computers). The \ front end manages screen display, graphics, access to the Help Browser and \ much else, and can perform certain tasks independently of the kernel; it was \ conceived and designed not by Wolfram himself, but by Theodore Gray. " }], "IndentedText"], Cell[" ", "Text"], Cell[TextData[{ "\tI will proceed in the assumption that you are running ", StyleBox["Mathematica", FontSlant->"Italic"], " 5.2 on a Mac OS X. Occasional small details change if you are running \ Windows; I am unfamiliar with them, and will not attempt to describe them." }], "Text"], Cell[TextData[{ "\tYou already have the front end running (may have turned it on by \ selecting and double-clicking ", StyleBox["Mathematica ", FontSlant->"Italic"], "5.2 in your Applications folder). To turn on the kernel and (more to the \ point) to ", StyleBox["establish communication between the front end and the kernel", FontColor->RGBColor[0, 0, 1]], " the traditional procedure is to type ", StyleBox["2-2", "Input"], " and hit ENTER:" }], "Text"], Cell[BoxData[ \(2 - 2\)], "Input", CellLabel->"In[1]:="], Cell[TextData[{ "NOTE: The traditional procedure is to type ", StyleBox["2+2", "Input"], ". The advantage of my eccentric ", StyleBox["2-2", "Input"], " procedure is that it can be ", StyleBox["done with one hand", FontSlant->"Italic"], ", without use of the SHIFT key." }], "Note"], Cell[TextData[{ "That took a second or two\[LongDash]a long time by the standard to which \ you will become accustomed, because the kernel is fat. Note that, while the \ kernel was performing its work your ", "input acquired an ", StyleBox["input number", FontWeight->"Bold"], ", and the output (when at last it appeared) was assigned a corresponding \ ", StyleBox["output number", FontWeight->"Bold"], ". " }], "Text"], Cell[TextData[{ "Subsequent calculations may run minutes/hours/days/weeks, depending upon \ their complexity, but you will not again during ", StyleBox["this", FontSlant->"Italic"], " work session have to wait for the kernel to come up. " }], "Text", CellOpen->False], Cell[TextData[{ "\tTo experience the often blinding speed of ", StyleBox["Mathematica", FontSlant->"Italic"], ", try" }], "Text"], Cell[BoxData[ \(\(1000!\)\)], "Input", CellLabel->"In[2]:="], Cell[BoxData[ \(Expand[\((1 + x)\)^100]\)], "Input", CellLabel->"In[3]:="], Cell["That was fast. How fast?", "Text"], Cell[BoxData[ \(% // Timing\)], "Input", CellLabel->"In[4]:="], Cell[TextData[{ "The initial ", StyleBox["{0.00009 Second,\[Ellipsis]} ", "Output"], "informs us that the calculation kept the kernel busy for about 0.00009 \ seconds. Were we to repeat the calculation we would find typically that it \ took a slightly different length of time. ", StyleBox[" ", "Output"] }], "Text"], Cell[TextData[{ "\tThe long response to ", StyleBox["1000!", "Input"], " is cluttering up the notebook. So we ", StyleBox["Select", FontWeight->"Bold"], " then ", StyleBox["double click", FontWeight->"Bold"], " the \"cell\" containing that ", StyleBox["In/Out ", "Output"], "pair; the output disappears, and the cell marker acquires an arrow at its \ base. ", StyleBox["Select/double click", FontWeight->"Bold"], " again and the output reappears. Do the same for the expansion of ", StyleBox["(1+x)^100", "Input"], ".", StyleBox[" ", "Output"], " " }], "Text"], Cell[TextData[{ "\tWhen ", StyleBox["Mathematica", FontSlant->"Italic"], " is calculating the title bar says ", StyleBox["Running\[Ellipsis]", FontWeight->"Bold"], ", and when it is drawing a graphic the title bar says ", StyleBox["Rendering\[Ellipsis]Running\[Ellipsis]", FontWeight->"Bold"], " In simple situations ", StyleBox["Mathematica", FontSlant->"Italic"], " completes its work so quickly that those announcements may pass \ unnoticed. To render them easily visible we must ask ", StyleBox["Mathematica", FontSlant->"Italic"], " ", "to work a bit. To that end, we define a pair of functions" }], "Text"], Cell[BoxData[{ \(\[Phi][x_, t_] := \(1\/2\) \((Cos[\[Pi]\ t] + Sin[\[Pi]\ t])\) Sin[\[Pi]\ x]\), "\[IndentingNewLine]", \(\[CapitalPhi][x_, t_, f1_, g1_, p_] := \[Sum]\+\(k = 0\)\%p\((f1 \( 8\/\(\((4 - \((2 k + 1)\)\^2)\) \[Pi]\)\) Sin[\(\((2 k + 1)\) \[Pi]\)\/2] Cos[\(\((2 k + 1)\)\/2\) \[Pi]\ t] + \[IndentingNewLine]g1 \( 2\/\(2 k + 1\)\) \(8\/\(\((4 - \((2 k + 1)\)\^2)\) \[Pi]\)\) Sin[\(\((2 k + 1)\) \[Pi]\)\/2] Sin[\(\((2 k + 1)\)\/2\) \[Pi]\ t])\) Sin[\(\(\((2 k + 1)\) \[Pi]\)\/2\) x]\)}], "Input", CellLabel->"In[5]:="], Cell["\<\ which we will use in a moment to construct a table of figures. \ Locate the title bar and watch it carefully after (now!) you have activated \ the following command:\ \>", "Text"], Cell[BoxData[ \(\(Table[{If[ n < 40, {\(Plot[\[Phi][x, \(n - 40\)\/20], {x, 0, 1}, \ PlotRange \[Rule] {\(-1.5\), 1.5}, \ Ticks \[Rule] {{1}, {\(-1\), 1}}];\)}, {\(Plot[\[CapitalPhi][x, \(n - 40\)\/20, 1/2, 1/2, 15], {x, 0, 1}, \ PlotRange \[Rule] {\(-1.5\), 1.5}, Ticks \[Rule] {{1}, {\(-1\), 1}}];\)}]}, {n, 0, 120}];\)\)], "Input", CellLabel->"In[7]:="], Cell[TextData[{ "Now ", StyleBox["select", FontWeight->"Bold"], " and ", StyleBox["double-click", FontWeight->"Bold"], " on the bracket that embraces the whole collection of figures. It \ collapses to a single figure. Now place the cursor on the figure (which will \ thereupon acquire a frame) and ", StyleBox["double-click", FontWeight->"Bold"], ". We have made\[LongDash]and now are running\[LongDash]a movie (notice \ the control buttons that appear at the bottom of the page while the movie \ runs), of what is actually a fairly interesting physical event: a string is \ vibrating with both ends clamped, then the right end is released and the \ slope at that end suddenly becomes and remains flat. \nThe latest version of \ ", StyleBox["Mathematica", FontSlant->"Italic"], " ", StyleBox["will accept new commands even while running/rendering", FontColor->RGBColor[0, 0, 1]], ", which it places in queue, and executes in sequence. " }], "Text"], Cell["\t", "Text"], Cell[CellGroupData[{ Cell["Terminating a running calculation", "Subsection"], Cell[TextData[{ "\tNot infrequently you will want, for one reason or another, to ", "terminate a calculation. Maybe you've realized you have asked ", StyleBox["Mathematica", FontSlant->"Italic"], " to do the wrong thing, or the calculation has run so long that you \ suspect (unfortunately, ", StyleBox["Mathematica", FontSlant->"Italic"], " returns no progress reports) something may be wrong with your command, or \ ", StyleBox["Mathematica", FontSlant->"Italic"], " reports back that it has been caught up in an endless loop. In such cases \ the first thing to try is" }], "Text"], Cell[TextData[{ "\t\[CloverLeaf]", StyleBox[".", "Input"], " ", StyleBox["Simple abort", FontColor->RGBColor[1, 0, 0]], ": hold down \[CloverLeaf] and press period\[Ellipsis]and wait." }], "Text"], Cell[TextData[{ "Equivalently, you might select ", StyleBox["Abort Evaluation", FontWeight->"Bold"], " from the front end's ", StyleBox["Kernel", FontWeight->"Bold"], " menu.The kernel has to \"back up,\" so the wait is roughly proportional \ to how deep you were into the calculation, but eventually (after perhaps \ several seconds or minutes) an ", StyleBox["Out[#]=Aborted ", "Output"], "should appear. " }], "Text"], Cell[TextData[{ "\tBut ", StyleBox["Mathematica", FontSlant->"Italic"], ", once started, reveals a single-minded reluctance to quit, and after a \ long wait you may conclude that the simple technique just described is not \ going to work. Or perhaps you are simply tired of waiting. Try" }], "Text"], Cell[TextData[{ "\t\[CloverLeaf]", StyleBox["q", "Input"], " ", StyleBox["Simple quit ", FontColor->RGBColor[1, 0, 0]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[1, 0, 0]], ": you will be asked if you want to ", StyleBox["Save", FontWeight->"Bold"], " your work, " }], "Text"], Cell[TextData[{ "then both the front end and the kernel will shut down, and you will have \ to ", StyleBox["Restart ", FontWeight->"Bold"], "the application. ", "If that is ineffective, try hitting" }], "Text"], Cell[TextData[{ "\t\[CloverLeaf]\[OptionKey]\[EscapeKey] ", StyleBox["Hard dump of the kernel", FontColor->RGBColor[1, 0, 0]], ". ", StyleBox["Save", FontWeight->"Bold"], " your work, ", StyleBox["Quit", FontWeight->"Bold"], " ", StyleBox["Mathematica", FontSlant->"Italic"], ", ", StyleBox["Restart", FontWeight->"Bold"], "." }], "Text"], Cell[TextData[{ "Finally, you can ", StyleBox["turn off the computer ", FontColor->RGBColor[1, 0, 0]], "(a \"forced quit\" may be necessary)", "\[Ellipsis]but will lose any unsaved open documents. It is in anticipation \ of such an event (or other misfortune) that you should be careful to " }], "Text"], Cell[TextData[{ StyleBox["Save your notebook at frequent intervals", FontSize->18, FontColor->RGBColor[1, 0, 0]], StyleBox[".", FontSize->18], " " }], "Text", TextAlignment->Center, TextJustification->0], Cell["\<\ SUGGESTION: WRITE THOSE THREE TERMINATION METHODS DOWN ON A SLIP OF \ PAPER. For when you most need them you will not be able to access this \ notebook where they are described!\ \>", "Note"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Notebooks", "Section"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " documents are called \"notebooks,\" and wear the suffix ", StyleBox[".nb ", FontWeight->"Bold"], "Open the ", StyleBox["File", FontWeight->"Bold"], " menu, select ", StyleBox["New", FontWeight->"Bold"], " (alternatively: hit \[CloverLeaf]", StyleBox["n", "Input"], "), and you have created a new notebook. Use ", StyleBox["File > Save As\[Ellipsis]", FontWeight->"Bold"], " (alternatively: \[ShiftKey]\[CloverLeaf]", StyleBox["s", "Input"], ") to name and save the notebook. " }], "Text"], Cell[TextData[{ "\tNotebooks can be rendered in various \"styles\"\[LongDash]designs \ intended for different uses. ", StyleBox["Mathematica", FontSlant->"Italic"], " is shipped with 17 canned designs: open ", StyleBox["Format > Style Sheet ", FontWeight->"Bold"], "to see the list. Try them, one after the other, to see what they do to \ this text.", " " }], "Text"], Cell[TextData[{ "I usually work in ", StyleBox["Default Style", FontWeight->"Bold"], ", but for present purposes I have selected and", StyleBox[" require you to work in ", FontColor->RGBColor[1, 0, 0]], StyleBox["TutorialBook Style", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], ". This I do for a reason: in other styles the ", StyleBox["In[#]", "Input", FontColor->RGBColor[0, 0, 1]], " signals are surpressed when a notebook is reopened, and I need for you to \ be able to see those. I have made the page 9.5 inches wide (that allows room \ for several input paletttes on my 17 inch screen), and run at 125% or 150% \ magnification. If you set up similarly you will be reading text pretty much \ as I intended it. " }], "Note"], Cell[TextData[{ "\tDifferent canned styles come equipped with different sets of options\ \[LongDash]few in some cases, numerous in others. Open ", StyleBox["Format", FontWeight->"Bold"], " and activate ", StyleBox["Show ToolBar", FontWeight->"Bold"], ". Go to ", StyleBox["Notepad Style ", FontWeight->"Bold"], "and open the ToolBar menu: it shows only four options. Now go to ", StyleBox["Textbook Style", FontWeight->"Bold"], ": it shows 29 options. It was (primarily for the reason just stated, but \ also) to obtain a workable set of options that I elected to work in ", StyleBox["TutorialBook Style", FontWeight->"Bold"], "." }], "Text"], Cell[TextData[{ "\tUnder ", StyleBox["Format", FontWeight->"Bold"], " you find ", StyleBox["Edit Style Sheet\[Ellipsis]", FontWeight->"Bold"], " and someday you may have occasion to do just that. The ", StyleBox["Mathematica", FontSlant->"Italic"], " Book tells you how. But for the moment we have already in hand all the \ resources we will need. My general advice:" }], "Text"], Cell[TextData[{ "\[Bullet] ", StyleBox["Mathematica", FontSlant->"Italic"], " is intolerant of typos\[LongDash]all capitalization, every brace and \ bracket, every bit of punctuation must be exactly right\[LongDash]so ", StyleBox["work with magnification big enough", FontColor->RGBColor[0, 0, 1]], " that you can clearly distinguish ", StyleBox[". ", "Input"], "from", StyleBox[" ", "Text"], StyleBox[",", "Input"], StyleBox[" ", "Text"], "etc.", StyleBox[" ", "Text"] }], "IndentedText"], Cell[TextData[{ "\[Bullet] ", StyleBox["Show the ToolBar", FontColor->RGBColor[0, 0, 1], Background->GrayLevel[1]], "; it is a great aid to the insertion of section titles, explanatory text, \ etc." }], "IndentedText"], Cell[TextData[{ "\[Bullet] Make the page large, yet small enough to ", StyleBox["leave room on the screen for an input palette or two", FontColor->RGBColor[0, 0, 1]], "." }], "IndentedText"], Cell[TextData[{ "\[Bullet] When opening a closed notebook to resume work,", StyleBox[" start with something simple like the standard ", FontColor->RGBColor[1, 0, 0]], StyleBox["2-2", "Input", FontColor->RGBColor[1, 0, 0]], "; otherwise the front end may be unable to find and connect with the \ kernel. " }], "IndentedText"] }, Open ]], Cell[CellGroupData[{ Cell["Input techniques & tips", "Section"], Cell[CellGroupData[{ Cell["Parentheses", "Subsection"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " assigns distinct and non-interchangeable responsibilities to ( ), [ ] and \ { }. Those I will explain in a moment. But first a\n" }], "Text"], Cell[TextData[{ StyleBox["TIP", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], StyleBox[" :", FontColor->RGBColor[1, 0, 0]], " The correct way to type ", StyleBox["(stuff) ", "Input"], "is not ", StyleBox["( ", "Input"], "then ", StyleBox["stuff ", "Input"], " then ", StyleBox[") ", "Input"], "but" }], "Text", TextAlignment->Left, TextJustification->0], Cell[TextData[{ StyleBox["( ) then the ", FontColor->RGBColor[0, 0, 1]], StyleBox["stepleft", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], StyleBox[" key \[LeftArrow] then ", FontColor->RGBColor[0, 0, 1]], StyleBox["stuff", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], StyleBox[" and finally the ", FontColor->RGBColor[0, 0, 1]], StyleBox["stepright", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], StyleBox[" key \[RightArrow]", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ "That way you will avoid both the danger of forgetting or misplacing the ", StyleBox[")", "Input"], ", and will avoid also the distraction of ", StyleBox["Mathematica", FontSlant->"Italic"], "'s ", StyleBox["signal", FontColor->RGBColor[1, 0, 1]], " that it has detected an unclosed parenthetic. A similar remark pertains\ \[LongDash]for the same reasons\[LongDash]to running ", Cell[BoxData[ StyleBox[ RowBox[{"T", AdjustmentBox["E", BoxMargins->{{-0.075, -0.085}, {0, 0}}, BoxBaselineShift->0.5], "X"}]]]], "\[Ellipsis]and, indeed, to all electronic keyboard work.\n " }], "Text"], Cell[TextData[{ StyleBox["\[Bullet] Mathematica", FontSlant->"Italic"], " reserves ", StyleBox["( )", "Input"], " to delimit expressions, as in ", StyleBox["(1+x)^n ", "Input"], "and", StyleBox[" (a+b)(c+d)", "Input"], "." }], "Text"], Cell[TextData[{ StyleBox["\[Bullet] Mathematica", FontSlant->"Italic"], " reserves ", StyleBox["[ ]", "Input"], " to identify the arguments of functions, where the term \"function\" is \ (as will emerge) very broadly construed; simple examples are ", StyleBox["f[x,y]", "Input"], " and ", StyleBox["Sin[x]", "Input"], "." }], "Text"], Cell[TextData[{ "\[Bullet] ", StyleBox["Mathematica", FontSlant->"Italic"], " reserves ", StyleBox["{ } ", "Input"], "to identify lists, where again the term will be very broadly construed; \ thus ", StyleBox["{2,3,5,7,11,13}", "Input"], " is a list of primes, and ", StyleBox["{{a,b},{c,d}}", "Input"], " is a list of lists (i.e., a matrix):" }], "Text"], Cell[BoxData[ StyleBox[\({{a, b}, {c, d}} // MatrixForm\), "Input"]], "Input", CellLabel->"In[8]:="] }, Open ]], Cell[CellGroupData[{ Cell["Palettes", "Subsection"], Cell[TextData[{ "Versions 1 (1988) and 2 (1991) of ", StyleBox["Mathematica", FontSlant->"Italic"], " required one to communicate with the front end in a kind of \ one-dimensional \"telegraphic\" code. For example, to evaluate ", Cell[BoxData[ FormBox[ RowBox[{\(\[Integral]\_\(\(\ \)\(0\)\)\%\(\(\ \)\(\[Infinity]\)\)\), RowBox[{"x", " ", \(e\^\(-x\^3\)\), StyleBox["dx", FontSlant->"Italic"]}]}], TraditionalForm]]], " one had to enter " }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Integrate[x\ Exp[\(-x^3\)], {x, 0, Infinity}]\)], "Input", CellLabel->"In[9]:="], Cell[BoxData[ \(1\/3\ Gamma[2\/3]\)], "Output", CellLabel->"Out[9]="] }, Open ]], Cell["\<\ That, as you see, still works, and is the style still preferred by \ some people. It is\[LongDash]in simple contexts\[LongDash]often the quickest \ way to go, but never pretty. For many commands the telegraphic style remains \ mandatory in Version 5; look, for example\[LongDash]picking one from a \ zillion\[LongDash]to the following command:\ \>", "Text"], Cell[BoxData[ \(Plot[SinIntegral[x], \ {x, 0, 20}, PlotRange \[Rule] All]\)], "Input", CellLabel->"In[10]:="], Cell[TextData[{ "\t\n\tBut\[LongDash]beginning with Version 3 (1996) and continuing with \ Versions 4 (1999) and 5 (2005)\[LongDash]it has become possible to enter many \ commands using a \"two-dimensional\" code that looks much like ordinary \ mathematical notation. Returning to our recent example, to evaluate ", Cell[BoxData[ FormBox[ RowBox[{\(\[Integral]\_\(\(\ \)\(0\)\)\%\(\(\ \)\(\[Infinity]\)\)\), RowBox[{"x", " ", \(e\^\(-x\^3\)\), StyleBox["dx", FontSlant->"Italic"]}]}], TraditionalForm]]], " one would enter " }], "Text"], Cell[BoxData[ \(\[Integral]\_0\%\[Infinity] x\ \(\[ExponentialE]\^\(-x\^3\)\) \[DifferentialD]x\)], "Input", CellLabel->"In[11]:="], Cell["\<\ This is accomplished with the aid of a collection of \"palettes.\" \ The standard collection serves most needs, but can readily be expanded by the \ user who has specialized requirements. \ \>", "Text"], Cell[TextData[{ "In the ", StyleBox["File", FontWeight->"Bold"], " menu go to", StyleBox[" Palettes", FontWeight->"Bold"], ",", StyleBox[" ", FontWeight->"Bold"], "where you see nine options:\n Open", StyleBox[" ", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], StyleBox["Author Tools", FontWeight->"Bold"], ". Get a preliminary sense of the lay of the land, then close. " }], "Text"], Cell[TextData[{ "Open ", StyleBox["AlgebraicManipulation", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], ". Ditto.\nOpen ", StyleBox["BasicCalculations", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], ". Notice that it stands as a gateway to seven sub-options, several of \ which contain sub-sub-options. Close.\nOpen ", StyleBox["BasicInput", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], ". Leave it on your desktop in some readily accessible place.\nOpen ", StyleBox["BasicTypesetting", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], ". Have a look, close.\nOpen ", StyleBox["CompleteCharacters", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], ". Again many sub-options. Close.\nOpen ", StyleBox["Create Slide", FontWeight->"Bold"], " Show. Have a look, close.\nOpen ", StyleBox["InternationalCharacters", FontWeight->"Bold"], ". Not likely to use much, close.\nOpen ", StyleBox["NotebookLauncher", FontWeight->"Bold"], ". Redundant with ", StyleBox["Format > Style Sheet", FontWeight->"Bold"], ". Close" }], "IndentedText"], Cell[TextData[{ "I have highlighted the palettes I find most useful. There is a large \ element of redundancy present in the design of the standard palettes; for \ example, everything on the ", StyleBox["BasicInput", FontWeight->"Bold"], " palette can be found also on one or another of the more specialized \ palettes." }], "Text"], Cell[TextData[{ "\tMany palette buttons produce characters with one or more blank boxes. \ ", Cell[BoxData[ \(TraditionalForm\`\[Sum]\+\(\[Placeholder] = \[Placeholder]\)\%\ \[Placeholder] \[FilledSmallSquare]\)]], " is a good example. ", StyleBox["Use \[TabKey] to advance from box to box", FontColor->RGBColor[0, 0, 1]], ", entering data as you go." }], "Text"], Cell["\<\ \tWhat distinguishes the \[SelectionPlaceholder] boxes from the \ \[Placeholder] boxes? Suppose, having written\ \>", "Text"], Cell[TextData[{ "REMARK: Here and henceforth I have ", StyleBox["grayed out", FontColor->GrayLevel[0.500008]], " statements in input style that are ", StyleBox["not actually intended to be entered as input", FontColor->RGBColor[0, 0, 1]], "." }], "Note"], Cell[BoxData[ StyleBox[\(6 \[ExponentialE]\^\(\(-a\)\ x\)\), FontColor->GrayLevel[0.500008]]], "Input"], Cell[TextData[{ "you decide you want to integrate that function. ", StyleBox["Select", FontWeight->"Bold"], " the expression, then hit the ", Cell[BoxData[ \(TraditionalForm\`\[Integral]\_\[Placeholder]\%\[Placeholder] \ \[FilledSquare] \[DifferentialD]\[Placeholder]\)]], " button; you get" }], "Text"], Cell[BoxData[ StyleBox[\(\[Integral]\_\[Placeholder]\%\[Placeholder] 6 \( \[ExponentialE]\^\(\(-a\)\ x\)\) \ \[DifferentialD]\[Placeholder]\), FontColor->GrayLevel[0.500008]]], "Input"], Cell[TextData[{ "Type", StyleBox[" 0", "Input"], "\[TabKey]", StyleBox["\[Infinity]\[TabKey]x ", "Input"], ",", StyleBox[" ", "Input"], "then press the ", StyleBox["enter", FontWeight->"Bold"], " key to construct/execute" }], "Text"], Cell[BoxData[ \(\[Integral]\_0\%\[Infinity] 6 \( \[ExponentialE]\^\(\(-a\)\ x\)\) \[DifferentialD]x\)], "Input", CellLabel->"In[12]:="], Cell[TextData[{ " Note also the presence of the easy-to-miss ", StyleBox["6", "Output"], " in front of the ", StyleBox["If", "Output"], ". The correct evaluation is not ", StyleBox["1/a", "Output"], " but ", StyleBox["6/a", "Output"], ". " }], "Note"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " is so compulsive about reporting the preconditions necessary for its \ reported results to be valid that it reports also\[LongDash]rather \ confusingly\[LongDash]the conditions under which the reported calculation \ would fail: thus" }], "Text"], Cell[BoxData[ \(Integrate[6 \[ExponentialE]\^\(\(-a\)\ x\), {x, 0, \[Infinity]}, Assumptions \[Rule] Re[a] > 0]\)], "Input", CellLabel->"In[13]:="], Cell["while", "Text"], Cell[BoxData[ \(Integrate[6 \[ExponentialE]\^\(\(-a\)\ x\), {x, 0, \[Infinity]}, Assumptions \[Rule] Re[a] \[LessEqual] 0]\)], "Input", CellLabel->"In[14]:="], Cell[TextData[{ "Look to another example: ", StyleBox["Select", FontWeight->"Bold"] }], "Text"], Cell[BoxData[ \(1 + \@\(1 + \(a + x\)\/b\)\)], "Input"], Cell[TextData[{ "and hit ", Cell[BoxData[ \(TraditionalForm\`\[FilledSquare]\^\[Placeholder]\)]], " to create" }], "Text"], Cell[BoxData[ \(\((1 + \@\(1 + \(a + x\)\/b\))\)\^2\)], "Input"], Cell[TextData[{ "Notice that ", StyleBox["Mathematica", FontSlant->"Italic"], " has automatically supplied parentheses of the appropriate shape and \ size." }], "Text"], Cell["Do the same with", "Text"], Cell[BoxData[ StyleBox[\(Sin[x]\), "Input"]], "Input"], Cell[TextData[{ "and you discover that, while ", StyleBox["Mathematica", FontSlant->"Italic"], " does not recognize the common construction ", Cell[BoxData[ \(TraditionalForm\`sin\^2\)]], "[", StyleBox["x", FontSlant->"Italic"], "], neither does it require anything so cumbersome as ", Cell[BoxData[ \(TraditionalForm\`\(\(\((sin[x])\)\^2\)\(.\)\)\)]], "\n" }], "Text"], Cell[TextData[{ "The short answer to our initial question: ", StyleBox["\[SelectionPlaceholder] boxes wrap around ", FontColor->RGBColor[0, 0, 1]], StyleBox["selected", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" objects, \[Placeholder] boxes are placeholders for objects that \ have yet to be specified", FontColor->RGBColor[0, 0, 1]], ". Now we understand why ", StyleBox["Mathematica", FontSlant->"Italic"], " calls \[SelectionPlaceholder] the \"SelectionPlaceholder,\" and \ \[Placeholder] the \"Placeholder.\"\n" }], "Text"], Cell[TextData[{ "\tPalette buttons are a great aid to speed and legibility. But they \ require use of the mouse, and in some situations their repetitive use can \ become tedious (though deft use of ", StyleBox["Cut/Copy/Paste", FontWeight->"Bold"], " often permits accelerated escape from the tedium", "). It is useful to know that the action of palette buttons can often be \ achieved directly from the keyboard. Open ", StyleBox["File > Palettes > CompleteCharacters", FontWeight->"Bold"], ", then open (say) ", StyleBox["Technical Symbols", FontSlant->"Italic"], " and ", StyleBox["Shapes and Icons", FontSlant->"Italic"], ". Move the selection arrow around over the face of the palettes and watch \ the bottom of the window. You will discover, for example, that" }], "Text"], Cell[TextData[{ " \[WatchIcon] can be produced by typing the ", Cell[BoxData[ StyleBox[ RowBox[{"T", AdjustmentBox["E", BoxMargins->{{-0.075, -0.085}, {0, 0}}, BoxBaselineShift->0.5], "X"}]]]], "-like command \\[Watch Icon]. ", StyleBox["(Here I had to introduce an artificial space; delete it to see \ why!)", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ "\[MathematicaIcon] can be produced by typing either \[EscapeKey]math\ \[EscapeKey] or \\[", "Mathematica", " Icon]. ", StyleBox["(Artificial space)", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ "\[KernelIcon] can be produced by typing \\[Kernel Icon]. ", StyleBox["(Artificial space)", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ "\[FreakedSmiley] can be produced either by \[EscapeKey]:-@\[EscapeKey] or \ by \\[Freaked Smiley]. ", StyleBox["(Artificial space)", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ "\[SelectionPlaceholder] can be produced either by \[EscapeKey]spl\ \[EscapeKey] or by \\[Selection Placeholder]. ", StyleBox["(Artificial space)", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ "\[Placeholder] can be produced either by \[EscapeKey]pl\[EscapeKey] or by \ \\[Place holder]. ", StyleBox["(Artificial space)", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ StyleBox["\[ExponentialE] ", "Input"], "can be produced either by \[EscapeKey]ee\[EscapeKey] or by \\[Exponential \ E]. ", StyleBox["(Artificial space)", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ StyleBox["\[ImaginaryI]", "Input"], " can be produced either by \[EscapeKey]ii\[EscapeKey] or by \\[Imaginary \ I]. ", StyleBox["(Artificial space)", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ "\[Pi] can be produced either by \[EscapeKey]p\[EscapeKey] or by \\[P i]. \ ", StyleBox["(Artificial space)", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ "Etc. There is a limit to how many such commands one can remember, but the \ point is ", StyleBox["one does not need to remember them", FontSlant->"Italic"], ": palette design automatically reminds one of their existence." }], "Text"], Cell["\<\ \tIn addition to the lengthy list of \"longform\" commands \\[Etc] \ and a shorter list of \"shortform\" commands \[EscapeKey]etc\[EscapeKey] it \ is possible (on Macintosh) to enter some symbols with commands of the form \ \[OptionKey]p (which produces \[Pi]); use \[OptionKey]- and \[OptionKey]\ \[ShiftKey]- to run through the keyboard and discover the possibilities\ \[LongDash]most of which are uninteresting.\ \>", "Text"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Sources of Information & Help", "Section"], Cell[CellGroupData[{ Cell["Hardcopy Materials", "Subsection"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " ships with hardcopy editions of " }], "Text"], Cell[TextData[{ "\[Bullet] ", StyleBox["The ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" Book", FontColor->RGBColor[0, 0, 1]], ", which provides the definitive description of every feature of the \ software, but is too fat to carry around. Chapter 1 ", StyleBox["\"A Practical Introduction of ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox["\" ", FontColor->RGBColor[0, 0, 1]], "runs to 228 pages, and provides a valuable survey of the basics, with many \ examples. The remainder of the book is in places less successfully tutorial, \ and easy to get lost in. " }], "Text"], Cell[TextData[{ "\[Bullet] ", StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" Standard Add-on Packages", FontColor->RGBColor[0, 0, 1]], ", describes and illustrates the use of roughly 1000 \ resources\[LongDash]many quite valuable\[LongDash]which become available only \ when explicitly called upon. Many ", StyleBox["non-standard", FontSlant->"Italic"], " add-on packages also exist (and more\[LongDash]some free, some \ proprietary\[LongDash]come into being every week); a place to launch a search \ for those is ", StyleBox["www.wolfram.com", FontColor->RGBColor[0, 0, 1]], ", but Google (keyword: ", StyleBox["Mathematica", FontSlant->"Italic"], " packages) will lead you to a great many additional sources.\n\tOne should \ peruse that material, and will have frequent occasion to return to it \ (electronically, via the ", StyleBox["Help", FontWeight->"Bold"], " menu) in pursuit of various details\[Ellipsis]but it is sometimes easier \ to ", StyleBox["learn", FontSlant->"Italic"], " your ", StyleBox["Mathematica", FontSlant->"Italic"], " from other sources. And it is definitely to other sources that one must \ look to gain a sense of the more intricate potentialities of ", StyleBox["Mathematica", FontSlant->"Italic"], ": " }], "Text"], Cell[TextData[{ "\[Bullet] Jerry Glynn & Theodore Gray, ", StyleBox["The Beginner's Guide to ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" 4", FontColor->RGBColor[0, 0, 1]], " (2000) provides an excellent and very friendly introduction to the \ basics." }], "Text"], Cell[TextData[{ "\[Bullet] Stan Wagon, ", StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" in Action", FontColor->RGBColor[0, 0, 1]], " (", Cell[BoxData[ \(TraditionalForm\`2\^nd\ edition\ 1999\)]], ") uses an interestingly varied set of physical/mathematical applications \ to describe some more complex procedures\[LongDash]many of which are of \ special interest to physicists. " }], "Text"], Cell[TextData[{ "\[Bullet] Patrick T. Tam, ", StyleBox["A Physicist's Guide to ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], " (1997) uses physics to motivate a survey of basic and intermediate ", StyleBox["Mathematica", FontSlant->"Italic"], ". Remains useful, though it came out while Version 3 was in pre-release; \ look for a later edition." }], "Text"], Cell[TextData[{ "\[Bullet] Martha L. Abell & James P. Braselton, ", StyleBox["Differential Equations with ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], " (1997) also looks mainly to physics for motivation, treats its subject in \ 800-page detail." }], "Text"], Cell[TextData[{ "\[Bullet] Roman E. Maeder, ", StyleBox["The ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" Programmer II", FontColor->RGBColor[0, 0, 1]], " (1996). ", StyleBox["Mathematica", FontSlant->"Italic"], " provides not only an elaborate computing resource, but also a programing \ language. The subject is surveyed by an expert in the field, who draws many \ of his examples from physics. Programming is treated also in Chapter 3 of \ Tam's book." }], "Text"], Cell[TextData[{ "\[Bullet] William T. Shaw & Jason Trigg, ", StyleBox["Applied ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[": Getting Started, Getting It Done", FontColor->RGBColor[0, 0, 1]], " (1994). Old, but I find it still very helpful. " }], "Text"], Cell[TextData[{ "\[Bullet] Gerd Baumann,", StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" in Theoretical Physics: Selected Examples from Classical \ Mechanics to Fractals", FontColor->RGBColor[0, 0, 1]], " (1993). Even older, but also still helpful, full of good ideas. Perhaps a \ more recent edition has appeared." }], "Text"], Cell[TextData[{ "\[Bullet] Richard Crandall, ", StyleBox["Mathematica for the Sciences", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontSlant->"Italic"], "(1991) and ", StyleBox["Topics in Advanced Scientific Computation", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], " (1996).\n" }], "Text"], Cell[TextData[{ "\tTwo journals are devoted to ", StyleBox["Mathematica", FontSlant->"Italic"], " and its applications:" }], "Text"], Cell[TextData[{ "\[Bullet] ", StyleBox["The ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" Journal", FontColor->RGBColor[0, 0, 1]], " (available in the Reed College Library)" }], "Text"], Cell[TextData[{ "\[Bullet] ", StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" in Education and Research", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[TextData[{ "Both read much like ", StyleBox["American Journal of Physics", FontSlant->"Italic"], " or ", StyleBox["Mathematical Monthly", FontSlant->"Italic"], ", so are readily accessible to students.\n" }], "Text"], Cell[TextData[{ "\tFinally, you will want to visit some of the ", StyleBox["Mathematica", FontSlant->"Italic"], " web sites. Places to start are " }], "Text"], Cell["\<\ \t\t\[Bullet] http://store.wolfram.com/catalog/books/\ \>", "Text"], Cell["\<\ \[Bullet] \ www.wolfran.com/mathwire\ \>", "Text"], Cell["\<\ \t\t\[Bullet] http://mathworld.wolfram.com/\ \>", "Text"], Cell[TextData[{ "The last of those is a very useful ", StyleBox["Mathematica", FontSlant->"Italic"], "-based \"mathematical encyclopedia.\"\n" }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Built-in Sources", "Subsection"], Cell[TextData[{ "Open ", StyleBox["Help > ", FontWeight->"Bold"], StyleBox["Mathematica", FontWeight->"Bold", FontSlant->"Italic"], StyleBox[" Book\[Ellipsis] ", FontWeight->"Bold"], "and after a few seconds you will discover that you have no need to lug ", StyleBox["The ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" Book", FontColor->RGBColor[0, 0, 1]], " around with you; the entire thing\[LongDash]page for page\[LongDash]is \ built into the design of the ", StyleBox["Help Browser", FontWeight->"Bold"], ". So also is ", StyleBox["Standard Add-on Packages", FontColor->RGBColor[0, 0, 1]], " (lives at ", StyleBox["Help > Add-ons\[Ellipsis]", FontWeight->"Bold"], "). And much else. All very carefully indexed (open ", StyleBox["Help > Master Index\[Ellipsis]", FontWeight->"Bold"], "), and supplied with hyperlinks at all appropriate places. We will explore \ some of those resources in a moment. " }], "Text"], Cell["\<\ \tBut there exist other/quicker ways to obtain information which \ are frequently quite useful. Suppose, for example, that we had computed\ \>", \ "Text"], Cell[BoxData[ \(\[Sum]\+\(j = 0\)\%\[Infinity] x\^j\/\((j + u)\)\^\[Nu]\)], "Input", CellLabel->"In[15]:="], Cell["\<\ and find ourselves wondering \"What in the world is a 'LerchPhi \ function'?\" We might enter\ \>", "Text"], Cell[BoxData[ \(\(?LerchPhi\)\)], "Input", CellLabel->"In[16]:="], Cell["which gives us some little information, and if we enter", "Text"], Cell[BoxData[ \(?? LerchPhi\)], "Input", CellLabel->"In[17]:="], Cell["or equivalently", "Text"], Cell[BoxData[ \(Information[LerchPhi]\)], "Input", CellLabel->"In[18]:="], Cell["\<\ we get more detailed information\[LongDash]some of it pretty \ cryptic. But\[LongDash]backing up to our starting point\[LongDash]if in \ \ \>", "Text"], Cell[BoxData[ \(\[Sum]\+\(j = 0\)\%\[Infinity] x\^j\/\((j + u)\)\^\[Nu]\)], "Input", CellLabel->"In[19]:="], Cell[TextData[{ "we ", StyleBox["Select", FontWeight->"Bold"], " the output (select only the ", StyleBox["LerchPhi", "Output"], "; leave out the ", StyleBox["[x,\[Nu],u]", "Output"], ") and then open ", StyleBox["Help > Find Selected Function\[Ellipsis] ", FontWeight->"Bold"], "we are instantly led to a notebook that provides a detailed description of \ the \"Lerch transcendent\" and of its relation to (among others) the Riemann \ zeta and polylog functions. " }], "Text"], Cell[TextData[{ "\tDistinct from and complementary to ", StyleBox["Information ", "Input"], "is ", StyleBox["Options", "Input"], ". We can ask ", StyleBox["Mathematica", FontSlant->"Italic"], " itself to describe the difference:" }], "Text"], Cell[BoxData[ RowBox[{"?", StyleBox["Information", FontColor->RGBColor[1, 0, 0]]}]], "Input", CellLabel->"In[20]:="], Cell[BoxData[ RowBox[{"?", StyleBox["Options", FontColor->RGBColor[1, 0, 0]]}]], "Input", CellLabel->"In[21]:="], Cell["\<\ Many things\[LongDash]graphics most notoriously\[LongDash]support \ lots of options. Suppose, for example, we perform\ \>", "Text"], Cell[BoxData[ \(Plot[Sin[x], {x, 0, \[Pi]}]\)], "Input", CellLabel->"In[22]:="], Cell["\<\ and then become curious about the options which were available to \ us; to discover those, we enter\ \>", "Text"], Cell[BoxData[ \(Options[%]\)], "Input", CellLabel->"In[23]:="], Cell[TextData[{ "Later we will give attention to what those various options mean, how they \ are used. To discover what that use of ", StyleBox["% ", "Input"], "was all about, we enter" }], "Text"], Cell[BoxData[ \(\(?%\)\)], "Input", CellLabel->"In[24]:="], Cell[TextData[{ "Pay particular attention to the ", StyleBox["More", "Output", FontColor->RGBColor[0, 0, 1]], ". I make very frequent/casual use of ", StyleBox["?", "Input"], " and ", StyleBox["Options", "Input"], ", and encourage you to develop the same habit. You will then almost never \ need to crack the pages of The ", StyleBox["Mathematica", FontSlant->"Italic"], " Book itself." }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Your Own \"My Tricks\" Notebook", "Subsection"], Cell[TextData[{ "I mention finally an undocumentable resource which will in time become the \ most valuable of all. Experience is problem-solving, in this sphere as in all \ others. When ", StyleBox["Mathematica", FontSlant->"Italic"], " has presented difficulties which you have finally overcome (it will, and \ you will), ", StyleBox["take the time to record your success in a dedicated notebook", FontColor->RGBColor[0, 0, 1]], ". You will then never again have to solve that particular problem, and can \ use your former success as a ", StyleBox["Copy/Paste ", FontWeight->"Bold"], "template. For your" }], "Text"], Cell[BoxData[ StyleBox[\(Mathematica\ power = \[Sum]\+\(t = today\)\%then Problems\ successfully\ solved\), FontColor->GrayLevel[0.500008]]], "Input"], Cell["\<\ And don't be too proud to save also\[LongDash]perhaps in a separate \ notebook of \"Stolen Tricks\"\[LongDash]a record of the ideas developed by \ others that seem to you interesting, or potentially useful. Quite a number of \ those will be encountered as we proceed.\ \>", "Text"], Cell[TextData[{ "\tSometimes your \"tricks\" will consist of programs that run a dozen or \ more lines (", StyleBox["Mathematica", FontSlant->"Italic"], " programs are seldom ", StyleBox["very", FontSlant->"Italic"], " long; that heavy work was done by the designers of the software", "), but more often they will consist of felicitous selections from among \ available options. The value of your Tricks Notebooks will be much increased \ if you ", StyleBox["include explanatory text and references", FontColor->RGBColor[0, 0, 1]], "\[LongDash]easy if you open ", StyleBox["Format > Show ToolBar", FontWeight->"Bold"], ". Notice also that you need not add to the ", StyleBox["end", FontSlant->"Italic"], " of your notebook: you can ", StyleBox["introduce new material interstitially", FontColor->RGBColor[0, 0, 1]], ", in conformity with some organizational pattern, with categories labled \ with appropriate ", StyleBox["Section", FontWeight->"Bold"], " titles." }], "Text"], Cell[TextData[{ "\tUse ", StyleBox["Mathematica", FontSlant->"Italic"], "'s ", StyleBox["Find", "Input"], " command, or OSX's Spotlight, to locate material in your notebooks. The \ task is made easier if you embellish your notebooks with appropriate tag \ words and phrases. " }], "Text"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Three Primary Flavors of =", "Section"], Cell["Enter the following:", "Text"], Cell[BoxData[ RowBox[{"?", StyleBox["=", FontColor->RGBColor[1, 0, 0]]}]], "Input", CellLabel->"In[25]:="], Cell[BoxData[ RowBox[{"?", StyleBox[":=", FontColor->RGBColor[1, 0, 0]]}]], "Input", CellLabel->"In[26]:="], Cell[BoxData[ RowBox[{"?", StyleBox["==", FontColor->RGBColor[1, 0, 0]]}]], "Input", CellLabel->"In[27]:="], Cell["What, in plain words, do those statements mean?", "Text"], Cell[CellGroupData[{ Cell["Assignment", "Subsection"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " understands that when we write" }], "Text"], Cell[BoxData[ \(a = 2\)], "Input", CellLabel->"In[28]:="], Cell[TextData[{ "we are ", StyleBox["assigning", FontSlant->"Italic"], " the meaning ", StyleBox["2", "Input"], " to the symbol ", StyleBox["a", "Input"], ". So we have" }], "Text"], Cell[BoxData[ \(a + 1\)], "Input", CellLabel->"In[29]:="], Cell["If we now write", "Text"], Cell[BoxData[ \(a = Sin[x]\)], "Input", CellLabel->"In[30]:="], Cell[TextData[{ "we have ", StyleBox["reassigned", FontSlant->"Italic"], " meaning to ", StyleBox["a", "Input"], ":" }], "Text"], Cell[BoxData[ \(1 - a\^2\)], "Input", CellLabel->"In[31]:="], Cell[BoxData[ \(Simplify[%]\)], "Input", CellLabel->"In[32]:="], Cell[BoxData[ \(Clear[a]\)], "Input", CellLabel->"In[33]:="], Cell["When we write", "Text"], Cell[BoxData[ \(g = Plot[x\ Sin[x], {x, 0, 100}]\)], "Input", CellLabel->"In[34]:="], Cell[TextData[{ "we have, in effect, asserted that ", StyleBox["g", "Input"], " will be the ", StyleBox["name", FontSlant->"Italic"], " of", " the graph. Here is an instance of the ", StyleBox["use", FontSlant->"Italic"], " of that name:" }], "Text"], Cell[BoxData[ \(Show[g]\)], "Input", CellLabel->"In[35]:="], Cell["\<\ A mnemonically better name in this instance might have been \ something like\ \>", "Text"], Cell[BoxData[ \(firstgraph = Plot[x\ Sin[x], {x, 0, 100}]\)], "Input", CellLabel->"In[36]:="], Cell[BoxData[ \(Show[firstgraph]\)], "Input", CellLabel->"In[37]:="], Cell[TextData[{ "\tIt was to permit such practice that the designers of ", StyleBox["Mathematica ", FontSlant->"Italic"], "interpret ", StyleBox["xy ", "Input"], "to be a ", StyleBox["compound symbol or \"name,\"", FontColor->RGBColor[0, 0, 1]], " and require use of some special device to signify \"", StyleBox["multiplication", FontColor->RGBColor[0, 0, 1]], "\":" }], "Text"], Cell[TextData[{ "\t", StyleBox["x y", "Input", FontColor->GrayLevel[0.500008]], StyleBox[" ", "Input"], "Here the \[SpaceKey] signifies multiplication; alternatively, use" }], "Text"], Cell[TextData[{ "\t", StyleBox["x*y", "Input", FontColor->GrayLevel[0.500008]], StyleBox[" ", "Input"], "or ", StyleBox[" ", FontColor->GrayLevel[0.500008]], StyleBox["x\[Times]y", "Input", FontColor->GrayLevel[0.500008]], StyleBox[" ", "Input"], "where \[Times] is produced \[EscapeKey]*\[EscapeKey]. Notice, however, \ that one must write" }], "Text"], Cell[TextData[{ "\t", StyleBox["x.y", "Input", FontColor->GrayLevel[0.500008]], StyleBox[" ", "Input"], "if ", StyleBox["x ", "Input"], "and ", StyleBox["y ", "Input"], "are ", StyleBox["matrices ", FontColor->RGBColor[0, 0, 1]], "that you intend to multiply", "." }], "Text"], Cell["Conversely, spaces cannot be used in names.", "Text"], Cell["\<\ \tIt is permitted to make several assignments simultaneously. Try\ \ \>", "Text"], Cell["\<\ BEWARE! You will get a \"Possible spelling error\" message. Ignore \ it.\ \>", "Note"], Cell[BoxData[{ \(p = Tom\), "\[IndentingNewLine]", \(q = Dick\), "\[IndentingNewLine]", \(r = Harry\)}], "Input", CellLabel->"In[38]:="], Cell["\<\ Notice that a single input has produced three lines of output. Now, \ as a test, try\ \>", "Text"], Cell[BoxData[ \(List[p, q, r]\)], "Input", CellLabel->"In[41]:="], Cell[BoxData[ \(Clear[p, q, r]\)], "Input", CellLabel->"In[42]:="], Cell[TextData[{ "NOTE:", StyleBox[" Mathematica ", FontSlant->"Italic"], "capitalizes the names of all functions and commands", StyleBox[". ", FontSlant->"Italic"], "To avoid confusion\[LongDash]and the distraction of such \"possible \ spelling error\" messages\[LongDash]you should ", StyleBox["assign lower case names", FontColor->RGBColor[0, 0, 1]], " to all your own variables and functions. In the present instance we might \ better have written tom, dick & harry.", StyleBox[" ", FontSlant->"Italic"] }], "Note"] }, Open ]], Cell[CellGroupData[{ Cell["Delayed Assignment: Functional Definition", "Subsection"], Cell["Were we to write", "Text"], Cell[BoxData[ \(f = x\^17\)], "Input", CellLabel->"In[43]:="], Cell[TextData[{ "(thus giving the name ", StyleBox["f ", "Input"], "to the expression on the right) we would\[LongDash]for some limited \ purposes\[LongDash]be in position to treat ", StyleBox["f", "Input"], " as though it were a ", StyleBox["function", FontSlant->"Italic"], "; try" }], "Text"], Cell[BoxData[ \(\[PartialD]\_x\ f\)], "Input", CellLabel->"In[44]:="], Cell[BoxData[ \(\[Integral]f \[DifferentialD]x\)], "Input", CellLabel->"In[45]:="], Cell[BoxData[ RowBox[{\(Clear[f, x]\), " ", RowBox[{"(*", RowBox[{ "Execute", " ", "but", " ", "do", " ", "for", " ", "the", " ", "moment", " ", "worry", " ", "about", " ", "the", " ", "point", " ", "of", " ", "this", " ", \(command . \ Do\), " ", "notice", " ", "the", " ", "use", " ", "here", " ", "of", " ", StyleBox[\( (*\ *) \), FontColor->RGBColor[0, 0, 1]], " ", "to", " ", "bracket", " ", StyleBox["COMMENTS", FontColor->RGBColor[0, 0, 1]]}], "*)"}]}]], "Input", CellLabel->"In[46]:="], Cell[TextData[{ "But we would not be in position to ask \"What is the value assumed by ", StyleBox["f", "Input"], " at ", StyleBox["x = 3", "DisplayFormula"], " ?\" Or to plot ", StyleBox["f(x) ", "DisplayFormula"], ". ", StyleBox["Mathematica", FontSlant->"Italic"], " understands" }], "Text"], Cell[BoxData[ \(f[x_] := x\^17\)], "Input", CellLabel->"In[47]:="], Cell[TextData[{ "to signify that we intend to ", StyleBox["delay the assignment of specific value", FontColor->RGBColor[0, 0, 1]], " to ", StyleBox["x", "Input"], "; in short, to look upon the preceding command as a ", StyleBox["description of the functional structure", FontColor->RGBColor[0, 0, 1]], " we have assigned to ", StyleBox["f[x]", "Input"], ". We are only now in position to make commands such as the following:" }], "Text"], Cell[BoxData[ \(f[3]\)], "Input", CellLabel->"In[48]:="], Cell[BoxData[ RowBox[{\(List[f[1], f[2], f[3]]\), " ", RowBox[{"(*", RowBox[{"Look", " ", "up", " ", StyleBox["List", FontColor->RGBColor[0, 0, 1]], " ", "in", " ", "the", " ", "Master", " ", \(Index . \ Be\), " ", "sure", " ", "to", " ", "open", " ", "\"\\""}], "*)"}]}]], "Input", CellLabel->"In[49]:="], Cell[BoxData[ \(\[PartialD]\_x\((\ f[x]\^2 + x)\)\)], "Input", CellLabel->"In[50]:="], Cell[BoxData[ \(Plot[f[x], {x, 0, 1}, \ PlotRange \[Rule] All]\)], "Input", CellLabel->"In[51]:="], Cell[TextData[{ "\t", StyleBox["Note the use of the subscripted ", FontColor->RGBColor[1, 0, 0]], StyleBox["_", "Input", FontColor->RGBColor[1, 0, 0]], StyleBox[" to identify the \"independent variable\"", FontColor->RGBColor[1, 0, 0]], " ", StyleBox["x", "Input"], "; its purpose becomes clearer when you look at" }], "Text"], Cell[BoxData[ \(f[x_, y_] := u\ x\^3 + v\ y\^3\ + w\)], "Input", CellLabel->"In[52]:="], Cell[TextData[{ "where we have announced our intention to look upon ", StyleBox["x", "Input"], ", ", StyleBox["y ", "Input"], "as a variables, and ", StyleBox["u", "Input"], ", ", StyleBox["v", "Input"], ", ", StyleBox["w ", "Input"], "as adjustable constants/parameters. Try" }], "Text"], Cell[BoxData[ \(\(\(\[PartialD]\_x\ f[x, y]\)\(\ \ \)\)\)], "Input", CellLabel->"In[53]:="], Cell["which is not at all surprising, and ", "Text"], Cell[BoxData[ \(\[PartialD]\_u\ f[x, y]\)], "Input", CellLabel->"In[54]:="], Cell[TextData[{ "which is a little bit surprising: ", StyleBox["Mathematica", FontSlant->"Italic"], " has uncomplainingly ", StyleBox["differentiated with respect to a parameter", FontColor->RGBColor[0, 0, 1]], "." }], "Text"], Cell[CellGroupData[{ Cell["Piece-wise functional definition:", "Subsubsection"], Cell["\<\ Not infrequently we develop interest in functions with \"piece-wise\ \" definitions. Look to this example:\ \>", "Text"], Cell[BoxData[ \(Clear[vee]\)], "Input", CellLabel->"In[55]:="], Cell[BoxData[{ RowBox[{\(vee[x_] := 1\ /; \ x < \(-1\)\), " "}], "\[IndentingNewLine]", \(vee[ x_] := \(-x\)\ /; \ \(-1\) < x < 0\), "\[IndentingNewLine]", \(vee[ x_] := \(+x\)\ /; \ 0 < x < 1\), "\[IndentingNewLine]", RowBox[{\(vee[x_]\), ":=", RowBox[{"1", " ", "/;", " ", RowBox[{"1", "<", "x", "\[IndentingNewLine]", " ", RowBox[{"(*", " ", RowBox[{ StyleBox["/;", FontColor->RGBColor[0, 0, 1]], " ", RowBox[{"means", " ", StyleBox["\"\\"", FontColor->RGBColor[0, 0, 1]]}]}], "*)"}]}]}]}]}], "Input", CellLabel->"In[56]:="], Cell[BoxData[ \(Plot[vee[x], {x, \(-2\), 2}]\)], "Input", CellLabel->"In[60]:="], Cell[TextData[{ "New to Mathematica5 is the powerful command ", StyleBox["Piecewise[ ]", "Input"], "that can be used to the same end. Look it up in ", StyleBox["Help", FontWeight->"Bold"], ", and be sure to look at the ", StyleBox["Further Examples", FontWeight->"Bold"], ", which are numerous and diverse. Sometimes it is simpler to use", StyleBox[" Which[ ]", "Input"], ": look it up and, again, be sure to look at the ", StyleBox["Further Examples", FontWeight->"Bold"], " (of which there is only one, but it makes the correct use of this handy \ command very clear). " }], "Text"], Cell[TextData[{ "An important instance of such a function is the Heaviside ", StyleBox["UnitStep ", "Input"], "function, which is a built-in resource of ", StyleBox["Mathematica", FontSlant->"Italic"], ":" }], "Text"], Cell[BoxData[ RowBox[{"?", StyleBox["UnitStep", FontColor->RGBColor[1, 0, 0]]}]], "Input", CellLabel->"In[61]:="], Cell[BoxData[ \(Plot[UnitStep[x], {x, \(-2\), 2}, PlotStyle \[Rule] {{RGBColor[1, .3, 0], Thickness[0.01]}}, \ PlotRange \[Rule] {0, 2}]\)], "Input", CellLabel->"In[62]:="] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Equality", "Subsection"], Cell[BoxData[ \(\(?==\)\)], "Input", CellLabel->"In[63]:="], Cell[TextData[{ "When you intend \"equals\" in the familiar sense, ", StyleBox["Mathematica", FontSlant->"Italic"], " expects you to write ", StyleBox["==", "Input"], ". Here are some simple examples:" }], "Text"], Cell[BoxData[ \(2 + 2 \[Equal] 3\)], "Input", CellLabel->"In[64]:="], Cell[BoxData[ \(2 + 2 \[Equal] 4\)], "Input", CellLabel->"In[65]:="], Cell[TextData[{ StyleBox["==", "Input"], " is used in \"solve situations\" (algebraic equations, differential \ equations) where one wants to ", StyleBox["discover the conditions under which", FontVariations->{"Underline"->True}], " two expressions become identical. Here are some simple examples:" }], "Text"], Cell[BoxData[ \(\(\(Solve[\[Phi]\^2 + \[Phi] - 1 \[Equal] 0]\)\(\ \)\( (*Equation\ defines\ what\ Mathematica\ calls\ the\ \ "\"*) \)\)\)], "Input", CellLabel->"In[66]:="], Cell[BoxData[ RowBox[{\(N[GoldenRatio]\), " ", RowBox[{"(*", RowBox[{ StyleBox["Asks", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["for", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["the", FontColor->RGBColor[0, 0, 1]], " ", StyleBox["numerical", FontColor->RGBColor[0, 0, 1]], StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox["value", FontColor->RGBColor[0, 0, 1]], " ", "of", " ", "GoldenRatio"}], "*)"}]}]], "Input", CellLabel->"In[67]:="], Cell[BoxData[ \(\(\(N[GoldenRatio, 30]\)\(\ \)\( (*Asks\ for\ 30 - place\ accuracy*) \)\)\)], "Input", CellLabel->"In[68]:="], Cell[BoxData[ \(Solve[{2 x + 3 y \[Equal] 1, 3 x + 5 y \[Equal] 1}, {x, y}]\)], "Input", CellLabel->"In[69]:="], Cell[BoxData[ \(DSolve[{\(y'\)[x] \[Equal] \[Alpha]\ y[x], y[0] \[Equal] 1}, y[x], x]\)], "Input", CellLabel->"In[70]:="] }, Open ]], Cell[CellGroupData[{ Cell["Secondary Flavors of = , and of some of its Relatives", "Subsection"], Cell["Constructions like", "Text"], Cell[BoxData[ StyleBox["===", FontColor->GrayLevel[0.500008]]], "Input"], Cell[BoxData[ StyleBox[\(\(=!=\)\(\ \)\( (*negation\ of\ the\ preceding*) \)\), FontColor->GrayLevel[0.500008]]], "Input"], Cell[BoxData[ StyleBox["<", FontColor->GrayLevel[0.500008]]], "Input"], Cell[BoxData[ StyleBox[">", FontColor->GrayLevel[0.500008]]], "Input"], Cell[BoxData[ StyleBox["<=", FontColor->GrayLevel[0.500008]]], "Input"], Cell[BoxData[ StyleBox[">=", FontColor->GrayLevel[0.500008]]], "Input"], Cell[TextData[{ "return ", StyleBox["True/False ", "Output"], "output, and are ", StyleBox["used mainly in ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" programming", FontColor->RGBColor[0, 0, 1]], ". The first asks whether the expression on the left is ", StyleBox["structurally identical", FontSlant->"Italic"], " to the expression on the right" }], "Text"], Cell[BoxData[ \(3 x\^2 === \[PartialD]\_x\ x\^3\)], "Input", CellLabel->"In[71]:="], Cell[BoxData[ \(\(\(Sin[x]\^2 + Cos[x]\^2\)\(===\)\(1\)\(\ \)\( (*identity, \ but\ not\ "\"*) \)\)\)], "Input", CellLabel->"In[72]:="], Cell[TextData[{ " The final pair ask \[LessEqual] ? and \[GreaterEqual] ? respectively, but \ require the expressions on left and right to be ", StyleBox["numeric, not symbolic", FontColor->RGBColor[0, 0, 1]], ": with the Schwarz inequality in mind, we ask" }], "Text"], Cell[BoxData[ \(\((4\^2 + 6\^2 + 8\^2)\) \((5\^2 + 7\^2 + 9\^2)\) \[GreaterEqual] \((4\[Times]5 + 6\[Times]7 + \ 8\[Times]9)\)\^2\)], "Input", CellLabel->"In[73]:="], Cell["but when we ask the general instance of the same question", "Text"], Cell[BoxData[ \(\((a\_1\^2 + a\_2\^2 + a\_3\^2)\) \((b\_1\^2 + b\_2\^2 + b\_3\^2)\) >= \((a\_1\ \ b\_1 + a\_2\ \ b\_2 + a\_3\ \ b\_3)\)\^2\ \)], "Input", CellLabel->"In[74]:="], Cell[TextData[{ StyleBox["Mathematica ", FontSlant->"Italic"], "(because it has not been informed that we intend the", StyleBox[" a'", FontSlant->"Italic"], "s and", StyleBox[" b'", FontSlant->"Italic"], "s to be real", ") remains non-committal." }], "Text"], Cell[TextData[{ "\tFor discussion, open ", StyleBox["Help > The ", FontWeight->"Bold"], StyleBox["Mathematica", FontWeight->"Bold", FontSlant->"Italic"], StyleBox[" Book ", FontWeight->"Bold"], "and ", StyleBox["Go To 2.6.8", FontWeight->"Bold"], " (Conditionals), or consult Chapter 56: \"How do I program in ", StyleBox["Mathematica", FontSlant->"Italic"], "?\" in Glynn & Gray. This, however, is a topic that can safely be set \ aside until our command of the basics is more secure." }], "Text"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Clear, Remove", "Section"], Cell[TextData[{ "Open a new notebook, enter ", StyleBox["f[u]", "Input"], " and discover that its recent definition is still in force. It lives in \ the kernel, and so will travel with you from notebook to notebook until \ either you explicitly discard it or terminate this work session; i.e., until \ either you ", StyleBox["Quit ", FontWeight->"Bold"], StyleBox["Mathematica ", FontSlant->"Italic"], "or ", StyleBox["Clear ", "Input"], "the definition", StyleBox[".", FontWeight->"Bold"], " ", StyleBox[" ", FontColor->GrayLevel[0.666667]], StyleBox["Now close and discard your nameless new notebook.", FontColor->GrayLevel[0.500008]] }], "Text"], Cell["\tSuppose you had interest at this point in defining", "Text"], Cell[BoxData[ \(distance[t_] := r + \(1\/2\) g\ t\^2\)], "Input", CellLabel->"In[75]:="], Cell["Check to see what you have created", "Text"], Cell[BoxData[ \(distance[t]\)], "Input", CellLabel->"In[76]:="], Cell[TextData[{ "and get something weird. That is because you have previously assigned a \ meaning to ", StyleBox["g", "Input"], ", and that is still lively: " }], "Text"], Cell[BoxData[ \(g\)], "Input", CellLabel->"In[77]:="], Cell[BoxData[ \(Show[g]\)], "Input", CellLabel->"In[78]:="], Cell[TextData[{ "You might ", StyleBox["reassign ", FontSlant->"Italic"], "meaning to those symbols, but ", StyleBox["how do you simply ", FontColor->RGBColor[0, 0, 1]], StyleBox["strip away", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" those prior assignments, and restore ", FontColor->RGBColor[0, 0, 1]], StyleBox["g ", "Input", FontColor->RGBColor[0, 0, 1]], StyleBox["to the list of \"meaningless symbols\"?", FontColor->RGBColor[0, 0, 1]], " " }], "Text"], Cell[BoxData[ RowBox[{"?", StyleBox["Clear", FontColor->RGBColor[1, 0, 0]]}]], "Input", CellLabel->"In[79]:="], Cell["Enter the command", "Text"], Cell[BoxData[ \(\(\(Clear[ g]\)\(\ \ \ \ \ \ \)\( (*Erases\ previous\ assignment*) \)\)\)], "Input",\ CellLabel->"In[80]:="], Cell["and check to confirm that the command did its work:", "Text"], Cell[BoxData[ \(g\)], "Input", CellLabel->"In[81]:="], Cell[CellGroupData[{ Cell["Clearing functions", "Subsection"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], "'s response to the query" }], "Text"], Cell[BoxData[ \(\(?f\)\)], "Input", CellLabel->"In[82]:="], Cell[TextData[{ "reminds us that we have assigned the name ", StyleBox["f ", "Input"], "to two different functions\[Ellipsis]which we are not likely to confuse \ (and neither is ", StyleBox["Mathematica", FontSlant->"Italic"], "), since one is a function of a single variable, and the other a function \ of two variables. Here's the rub: ", StyleBox["Mathematica", FontSlant->"Italic"], " affords no way to clear one without at the same time clearing the other \ (and, indeed, clearing ", StyleBox["all", FontSlant->"Italic"], " things named ", StyleBox["f", "Input"], "). Try it:" }], "Text"], Cell[BoxData[ \(Clear[f]\)], "Input", CellLabel->"In[83]:="], Cell[BoxData[ \(\(?f\)\)], "Input", CellLabel->"In[84]:="], Cell[BoxData[ \(Remove[f]\)], "Input", CellLabel->"In[85]:="], Cell[BoxData[ \(\(?f\)\)], "Input", CellLabel->"In[86]:="], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " has reported that it can now find no such placeholder. Notice that such \ reports are not numbered \"output,\" but have more the status of \ \"announcements.\" \n" }], "Text"], Cell[TextData[{ StyleBox["TIP", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], ": To preserve flexibility, ", StyleBox["always assign distinct names to distinct functions", FontColor->RGBColor[0, 0, 1]], ". In the preceding examples we might better have written" }], "Text"], Cell[BoxData[{ \(f1[x_] := x\^17\), "\[IndentingNewLine]", \(f2[x_, y_] := u\ x\^3 + v\ y\^3\ + w\), "\[IndentingNewLine]", \(Null\)}], "Input", CellLabel->"In[87]:=", FontColor->GrayLevel[0.500008]], Cell[TextData[{ StyleBox["TIP", FontColor->RGBColor[1, 0, 0]], StyleBox[": One should be careful to ", FontWeight->"Plain"], StyleBox["clear assignments/definitions when you are finished with them", FontWeight->"Plain", FontColor->RGBColor[0, 0, 1]], StyleBox[". This frees up memory, and helps avoid distracting surprises and \ confusion. But you will sometimes forget, so\[Ellipsis]\n", FontWeight->"Plain"] }], "Text", FontWeight->"Bold"], Cell[TextData[{ StyleBox["TIP", FontColor->RGBColor[1, 0, 0]], StyleBox[": Make ", FontWeight->"Plain"] }], "Text", FontWeight->"Bold"], Cell[BoxData[ RowBox[{ StyleBox["Clear", FontColor->GrayLevel[0.500008]], StyleBox["[", FontColor->GrayLevel[0.500008]], StyleBox[\(the\ letters/strings\ you\ expect\ to\ assign\), "Text", FontSlant->"Italic", FontColor->GrayLevel[0.500008]], StyleBox["]", FontColor->GrayLevel[0.500008]]}]], "Input"], Cell[TextData[{ "your ", StyleBox["first command in every computation", FontColor->RGBColor[0, 0, 1]], ".\n" }], "Text"], Cell["\<\ We will have no immediate need of the more comprehensive \ command\ \>", "Text"], Cell[BoxData[ RowBox[{"?", StyleBox["ClearAll", FontColor->RGBColor[1, 0, 0]]}]], "Input", CellLabel->"In[90]:="], Cell[TextData[{ StyleBox["Save", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], "." }], "Note"], Cell["\<\ If you have interest in how much memory you have used in this work session \ (prior to the development of OSX that was always a critical consideration), \ command\ \>", "Text"], Cell[BoxData[ \(MaxMemoryUsed[]\)], "Input", CellLabel->"In[90]:="] }, Open ]] }, Open ]] }, Open ]] }, Open ]] }, FrontEndVersion->"5.2 for Macintosh", ScreenRectangle->{{0, 1280}, {0, 943}}, WindowToolbars->"EditBar", WindowSize->{892, 720}, WindowMargins->{{3, Automatic}, {Automatic, 8}}, ShowSelection->True, Magnification->1.25, StyleDefinitions -> "TutorialBook.nb" ] (******************************************************************* 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[CellGroupData[{ Cell[1776, 53, 188, 6, 133, "Title"], Cell[1967, 61, 83, 5, 109, "Subsubtitle"], Cell[2053, 68, 1384, 27, 280, "Subsubsection"], Cell[CellGroupData[{ Cell[3462, 99, 106, 2, 37, "Subtitle"], Cell[CellGroupData[{ Cell[3593, 105, 114, 5, 111, "Section"], Cell[3710, 112, 2691, 50, 510, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[6438, 167, 56, 0, 111, "Section"], Cell[6497, 169, 316, 9, 59, "Text"], Cell[6816, 180, 265, 9, 37, "IndentedText"], Cell[7084, 191, 133, 4, 34, "Text"], Cell[7220, 197, 170, 5, 34, "IndentedText"], Cell[7393, 204, 515, 9, 106, "IndentedText"], Cell[7911, 215, 18, 0, 34, "Text"], Cell[7932, 217, 293, 6, 58, "Text"], Cell[8228, 225, 478, 12, 84, "Text"], Cell[8709, 239, 62, 2, 36, "Input"], Cell[8774, 243, 300, 9, 73, "Note"], Cell[9077, 254, 439, 12, 84, "Text"], Cell[9519, 268, 279, 7, 23, "Text", CellOpen->False], Cell[9801, 277, 139, 5, 34, "Text"], Cell[9943, 284, 66, 2, 36, "Input"], Cell[10012, 288, 80, 2, 36, "Input"], Cell[10095, 292, 41, 0, 34, "Text"], Cell[10139, 294, 68, 2, 36, "Input"], Cell[10210, 298, 325, 7, 60, "Text"], Cell[10538, 307, 606, 20, 89, "Text"], Cell[11147, 329, 656, 19, 108, "Text"], Cell[11806, 350, 740, 14, 300, "Input"], Cell[12549, 366, 189, 4, 58, "Text"], Cell[12741, 372, 507, 10, 332, "Input"], Cell[13251, 384, 991, 24, 192, "Text"], Cell[14245, 410, 18, 0, 34, "Text"], Cell[CellGroupData[{ Cell[14288, 414, 55, 0, 52, "Subsection"], Cell[14346, 416, 611, 15, 106, "Text"], Cell[14960, 433, 211, 7, 36, "Text"], Cell[15174, 442, 442, 12, 84, "Text"], Cell[15619, 456, 309, 7, 82, "Text"], Cell[15931, 465, 332, 13, 37, "Text"], Cell[16266, 480, 222, 7, 59, "Text"], Cell[16491, 489, 380, 17, 35, "Text"], Cell[16874, 508, 315, 7, 58, "Text"], Cell[17192, 517, 225, 9, 37, "Text"], Cell[17420, 528, 201, 4, 64, "Note"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[17670, 538, 28, 0, 111, "Section"], Cell[17701, 540, 602, 20, 86, "Text"], Cell[18306, 562, 390, 11, 83, "Text"], Cell[18699, 575, 774, 18, 107, "Note"], Cell[19476, 595, 685, 19, 109, "Text"], Cell[20164, 616, 407, 12, 83, "Text"], Cell[20574, 630, 521, 16, 60, "IndentedText"], Cell[21098, 648, 232, 7, 34, "IndentedText"], Cell[21333, 657, 200, 5, 34, "IndentedText"], Cell[21536, 664, 340, 8, 60, "IndentedText"] }, Open ]], Cell[CellGroupData[{ Cell[21913, 677, 42, 0, 111, "Section"], Cell[CellGroupData[{ Cell[21980, 681, 33, 0, 52, "Subsection"], Cell[22016, 683, 213, 5, 94, "Text"], Cell[22232, 690, 398, 17, 37, "Text"], Cell[22633, 709, 544, 18, 35, "Text"], Cell[23180, 729, 673, 18, 120, "Text"], Cell[23856, 749, 254, 10, 36, "Text"], Cell[24113, 761, 353, 11, 62, "Text"], Cell[24469, 774, 377, 12, 62, "Text"], Cell[24849, 788, 112, 3, 36, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[24998, 796, 30, 0, 52, "Subsection"], Cell[25031, 798, 519, 13, 63, "Text"], Cell[CellGroupData[{ Cell[25575, 815, 102, 2, 36, "Input"], Cell[25680, 819, 75, 2, 52, "Output"] }, Open ]], Cell[25770, 824, 367, 6, 82, "Text"], Cell[26140, 832, 115, 2, 36, "Input"], Cell[26258, 836, 595, 12, 123, "Text"], Cell[26856, 850, 146, 3, 62, "Input"], Cell[27005, 855, 212, 5, 94, "Text"], Cell[27220, 862, 436, 17, 71, "Text"], Cell[27659, 881, 1144, 35, 283, "IndentedText"], Cell[28806, 918, 342, 8, 83, "Text"], Cell[29151, 928, 384, 10, 58, "Text"], Cell[29538, 940, 135, 3, 34, "Text"], Cell[29676, 945, 272, 8, 47, "Note"], Cell[29951, 955, 114, 2, 37, "Input"], Cell[30068, 959, 323, 9, 38, "Text"], Cell[30394, 970, 206, 4, 63, "Input"], Cell[30603, 976, 255, 11, 37, "Text"], Cell[30861, 989, 150, 3, 62, "Input"], Cell[31014, 994, 271, 10, 55, "Note"], Cell[31288, 1006, 317, 7, 58, "Text"], Cell[31608, 1015, 161, 3, 37, "Input"], Cell[31772, 1020, 21, 0, 34, "Text"], Cell[31796, 1022, 172, 3, 37, "Input"], Cell[31971, 1027, 103, 4, 35, "Text"], Cell[32077, 1033, 59, 1, 77, "Input"], Cell[32139, 1036, 134, 5, 34, "Text"], Cell[32276, 1043, 68, 1, 84, "Input"], Cell[32347, 1046, 178, 6, 34, "Text"], Cell[32528, 1054, 32, 0, 34, "Text"], Cell[32563, 1056, 64, 2, 36, "Input"], Cell[32630, 1060, 407, 14, 94, "Text"], Cell[33040, 1076, 582, 15, 118, "Text"], Cell[33625, 1093, 815, 19, 156, "Text"], Cell[34443, 1114, 413, 12, 58, "Text"], Cell[34859, 1128, 220, 7, 34, "Text"], Cell[35082, 1137, 157, 4, 34, "Text"], Cell[35242, 1143, 200, 5, 34, "Text"], Cell[35445, 1150, 214, 5, 34, "Text"], Cell[35662, 1157, 195, 5, 34, "Text"], Cell[35860, 1164, 221, 6, 36, "Text"], Cell[36084, 1172, 218, 6, 36, "Text"], Cell[36305, 1180, 176, 5, 34, "Text"], Cell[36484, 1187, 260, 6, 58, "Text"], Cell[36747, 1195, 438, 7, 106, "Text"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[37234, 1208, 48, 0, 111, "Section"], Cell[CellGroupData[{ Cell[37307, 1212, 40, 0, 52, "Subsection"], Cell[37350, 1214, 117, 4, 34, "Text"], Cell[37470, 1220, 773, 21, 106, "Text"], Cell[38246, 1243, 1362, 37, 214, "Text"], Cell[39611, 1282, 366, 11, 58, "Text"], Cell[39980, 1295, 462, 13, 58, "Text"], Cell[40445, 1310, 449, 12, 82, "Text"], Cell[40897, 1324, 343, 9, 58, "Text"], Cell[41243, 1335, 578, 16, 82, "Text"], Cell[41824, 1353, 355, 10, 58, "Text"], Cell[42182, 1365, 439, 12, 58, "Text"], Cell[42624, 1379, 354, 12, 70, "Text"], Cell[42981, 1393, 142, 5, 34, "Text"], Cell[43126, 1400, 286, 10, 34, "Text"], Cell[43415, 1412, 204, 7, 34, "Text"], Cell[43622, 1421, 239, 8, 70, "Text"], Cell[43864, 1431, 170, 5, 34, "Text"], Cell[44037, 1438, 77, 2, 34, "Text"], Cell[44117, 1442, 88, 3, 34, "Text"], Cell[44208, 1447, 67, 2, 34, "Text"], Cell[44278, 1451, 164, 5, 70, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[44479, 1461, 38, 0, 52, "Subsection"], Cell[44520, 1463, 1075, 32, 134, "Text"], Cell[45598, 1497, 165, 4, 58, "Text"], Cell[45766, 1503, 113, 2, 91, "Input"], Cell[45882, 1507, 117, 3, 34, "Text"], Cell[46002, 1512, 71, 2, 36, "Input"], Cell[46076, 1516, 71, 0, 34, "Text"], Cell[46150, 1518, 69, 2, 36, "Input"], Cell[46222, 1522, 31, 0, 34, "Text"], Cell[46256, 1524, 79, 2, 36, "Input"], Cell[46338, 1528, 161, 4, 34, "Text"], Cell[46502, 1534, 113, 2, 91, "Input"], Cell[46618, 1538, 502, 14, 85, "Text"], Cell[47123, 1554, 260, 9, 60, "Text"], Cell[47386, 1565, 137, 4, 36, "Input"], Cell[47526, 1571, 133, 4, 36, "Input"], Cell[47662, 1577, 141, 3, 34, "Text"], Cell[47806, 1582, 85, 2, 36, "Input"], Cell[47894, 1586, 123, 3, 34, "Text"], Cell[48020, 1591, 68, 2, 36, "Input"], Cell[48091, 1595, 204, 5, 60, "Text"], Cell[48298, 1602, 64, 2, 36, "Input"], Cell[48365, 1606, 424, 13, 60, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[48826, 1624, 53, 0, 52, "Subsection"], Cell[48882, 1626, 645, 15, 107, "Text"], Cell[49530, 1643, 173, 3, 79, "Input"], Cell[49706, 1648, 292, 5, 82, "Text"], Cell[50001, 1655, 1035, 28, 156, "Text"], Cell[51039, 1685, 305, 9, 60, "Text"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[51393, 1700, 45, 0, 111, "Section"], Cell[51441, 1702, 36, 0, 34, "Text"], Cell[51480, 1704, 127, 4, 36, "Input"], Cell[51610, 1710, 128, 4, 36, "Input"], Cell[51741, 1716, 128, 4, 36, "Input"], Cell[51872, 1722, 63, 0, 34, "Text"], Cell[CellGroupData[{ Cell[51960, 1726, 32, 0, 52, "Subsection"], Cell[51995, 1728, 115, 4, 34, "Text"], Cell[52113, 1734, 63, 2, 36, "Input"], Cell[52179, 1738, 199, 9, 36, "Text"], Cell[52381, 1749, 63, 2, 36, "Input"], Cell[52447, 1753, 31, 0, 34, "Text"], Cell[52481, 1755, 68, 2, 36, "Input"], Cell[52552, 1759, 142, 7, 36, "Text"], Cell[52697, 1768, 66, 2, 39, "Input"], Cell[52766, 1772, 69, 2, 36, "Input"], Cell[52838, 1776, 66, 2, 36, "Input"], Cell[52907, 1780, 29, 0, 34, "Text"], Cell[52939, 1782, 90, 2, 36, "Input"], Cell[53032, 1786, 275, 11, 36, "Text"], Cell[53310, 1799, 65, 2, 36, "Input"], Cell[53378, 1803, 100, 3, 34, "Text"], Cell[53481, 1808, 99, 2, 36, "Input"], Cell[53583, 1812, 74, 2, 36, "Input"], Cell[53660, 1816, 408, 13, 60, "Text"], Cell[54071, 1831, 195, 6, 36, "Text"], Cell[54269, 1839, 381, 13, 36, "Text"], Cell[54653, 1854, 307, 14, 36, "Text"], Cell[54963, 1870, 59, 0, 34, "Text"], Cell[55025, 1872, 91, 3, 34, "Text"], Cell[55119, 1877, 97, 3, 47, "Note"], Cell[55219, 1882, 152, 4, 86, "Input"], Cell[55374, 1888, 108, 3, 34, "Text"], Cell[55485, 1893, 71, 2, 36, "Input"], Cell[55559, 1897, 72, 2, 36, "Input"], Cell[55634, 1901, 551, 15, 81, "Note"] }, Open ]], Cell[CellGroupData[{ Cell[56222, 1921, 63, 0, 52, "Subsection"], Cell[56288, 1923, 32, 0, 34, "Text"], Cell[56323, 1925, 67, 2, 39, "Input"], Cell[56393, 1929, 317, 10, 62, "Text"], Cell[56713, 1941, 75, 2, 36, "Input"], Cell[56791, 1945, 88, 2, 60, "Input"], Cell[56882, 1949, 602, 12, 111, "Input"], Cell[57487, 1963, 321, 11, 60, "Text"], Cell[57811, 1976, 72, 2, 39, "Input"], Cell[57886, 1980, 465, 12, 86, "Text"], Cell[58354, 1994, 62, 2, 36, "Input"], Cell[58419, 1998, 391, 8, 86, "Input"], Cell[58813, 2008, 91, 2, 39, "Input"], Cell[58907, 2012, 104, 2, 36, "Input"], Cell[59014, 2016, 354, 11, 60, "Text"], Cell[59371, 2029, 94, 2, 39, "Input"], Cell[59468, 2033, 310, 12, 60, "Text"], Cell[59781, 2047, 97, 2, 36, "Input"], Cell[59881, 2051, 52, 0, 34, "Text"], Cell[59936, 2053, 81, 2, 36, "Input"], Cell[60020, 2057, 244, 8, 34, "Text"], Cell[CellGroupData[{ Cell[60289, 2069, 58, 0, 42, "Subsubsection"], Cell[60350, 2071, 130, 3, 34, "Text"], Cell[60483, 2076, 68, 2, 36, "Input"], Cell[60554, 2080, 730, 15, 136, "Input"], Cell[61287, 2097, 86, 2, 36, "Input"], Cell[61376, 2101, 618, 16, 112, "Text"], Cell[61997, 2119, 232, 7, 60, "Text"], Cell[62232, 2128, 134, 4, 36, "Input"], Cell[62369, 2134, 193, 4, 86, "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[62611, 2144, 30, 0, 52, "Subsection"], Cell[62644, 2146, 65, 2, 36, "Input"], Cell[62712, 2150, 228, 7, 60, "Text"], Cell[62943, 2159, 74, 2, 36, "Input"], Cell[63020, 2163, 74, 2, 36, "Input"], Cell[63097, 2167, 322, 7, 60, "Text"], Cell[63422, 2176, 200, 4, 64, "Input"], Cell[63625, 2182, 743, 21, 36, "Input"], Cell[64371, 2205, 138, 3, 36, "Input"], Cell[64512, 2210, 130, 3, 36, "Input"], Cell[64645, 2215, 134, 3, 36, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[64816, 2223, 75, 0, 52, "Subsection"], Cell[64894, 2225, 34, 0, 34, "Text"], Cell[64931, 2227, 82, 2, 36, "Input"], Cell[65016, 2231, 132, 2, 36, "Input"], Cell[65151, 2235, 80, 2, 36, "Input"], Cell[65234, 2239, 80, 2, 36, "Input"], Cell[65317, 2243, 81, 2, 36, "Input"], Cell[65401, 2247, 81, 2, 36, "Input"], Cell[65485, 2251, 472, 15, 59, "Text"], Cell[65960, 2268, 90, 2, 39, "Input"], Cell[66053, 2272, 171, 3, 64, "Input"], Cell[66227, 2277, 279, 6, 58, "Text"], Cell[66509, 2285, 184, 4, 39, "Input"], Cell[66696, 2291, 73, 0, 34, "Text"], Cell[66772, 2293, 195, 4, 39, "Input"], Cell[66970, 2299, 284, 11, 34, "Text"], Cell[67257, 2312, 540, 17, 83, "Text"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[67846, 2335, 32, 0, 111, "Section"], Cell[67881, 2337, 696, 21, 111, "Text"], Cell[68580, 2360, 68, 0, 34, "Text"], Cell[68651, 2362, 94, 2, 62, "Input"], Cell[68748, 2366, 50, 0, 34, "Text"], Cell[68801, 2368, 69, 2, 36, "Input"], Cell[68873, 2372, 179, 5, 36, "Text"], Cell[69055, 2379, 59, 2, 36, "Input"], Cell[69117, 2383, 65, 2, 36, "Input"], Cell[69185, 2387, 530, 17, 60, "Text"], Cell[69718, 2406, 131, 4, 36, "Input"], Cell[69852, 2412, 34, 0, 34, "Text"], Cell[69889, 2414, 137, 4, 36, "Input"], Cell[70029, 2420, 67, 0, 34, "Text"], Cell[70099, 2422, 59, 2, 36, "Input"], Cell[CellGroupData[{ Cell[70183, 2428, 40, 0, 52, "Subsection"], Cell[70226, 2430, 108, 4, 34, "Text"], Cell[70337, 2436, 64, 2, 36, "Input"], Cell[70404, 2440, 627, 18, 110, "Text"], Cell[71034, 2460, 66, 2, 36, "Input"], Cell[71103, 2464, 64, 2, 36, "Input"], Cell[71170, 2468, 67, 2, 36, "Input"], Cell[71240, 2472, 64, 2, 36, "Input"], Cell[71307, 2476, 248, 6, 94, "Text"], Cell[71558, 2484, 298, 8, 59, "Text"], Cell[71859, 2494, 218, 5, 92, "Input"], Cell[72080, 2501, 471, 12, 95, "Text"], Cell[72554, 2515, 150, 6, 35, "Text"], Cell[72707, 2523, 380, 11, 36, "Input"], Cell[73090, 2536, 130, 5, 70, "Text"], Cell[73223, 2543, 90, 3, 34, "Text"], Cell[73316, 2548, 134, 4, 36, "Input"], Cell[73453, 2554, 111, 5, 47, "Note"], Cell[73567, 2561, 189, 7, 166, "Text"], Cell[73759, 2570, 73, 2, 36, "Input"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)