(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. 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[ 32494, 1080]*) (*NotebookOutlinePosition[ 33491, 1114]*) (* CellTagsIndexPosition[ 33447, 1110]*) (*WindowFrame->Normal*) Notebook[{ Cell[TextData[{ "Introduction to ", StyleBox["Mathematica", FontSlant->"Italic"], "\nBasic Concepts I" }], "Title", Evaluatable->False, CellHorizontalScrolling->False, TextAlignment->Center, FontFamily->"Times New Roman", FontSize->24, FontWeight->"Bold", FontColor->GrayLevel[0], Background->RGBColor[0, 0.501961, 1]], Cell[TextData[{ "\t", StyleBox["Mathematica", FontSlant->"Italic"], " is an ", StyleBox["extremely", FontWeight->"Bold"], " powerful tool for use in mathematics and other technical work. ", StyleBox["Mathematica", FontSlant->"Italic"], " allows you to perform any of the operations of even the most \ sophisticated graphing calculators on the market today. In addition, ", StyleBox["Mathematica", FontSlant->"Italic"], " allows you to perform symbolic operations (such as computing derivatives \ and antiderivatives and solving equations symbolically) not possible with \ technology until only a few years ago. ", StyleBox["Mathematica", FontSlant->"Italic"], " also includes very powerful graphing and animation capabilities that can \ be extremely useful as a teaching tool. However, as is the case with any \ tool of great complexity and power, ", StyleBox["Mathematica", FontSlant->"Italic"], " requires an initial time investment to understand its rules of \ engagement." }], "Text", Evaluatable->False], Cell[TextData[{ "\tIn this first of three ", StyleBox["Mathematica", FontSlant->"Italic"], " ", StyleBox["notebooks ", FontWeight->"Bold"], "on the basic concepts of ", StyleBox["Mathematica", FontSlant->"Italic"], " (a 'notebook' is ", StyleBox["Mathematica", FontSlant->"Italic"], "'s name for a user's file), we will point out some of the major rules in \ getting along with ", StyleBox["Mathematica", FontSlant->"Italic"], ", as well as the most common pitfalls. In the second notebook, we'll \ cover more of the ", StyleBox["Mathematica", FontSlant->"Italic"], " syntax, its Help system, and using ", StyleBox["Mathematica", FontSlant->"Italic"], " for elementary calculus. In the third notebook, we'll go into great \ details regarding the plotting, graphics, and animation capabilities. There \ will be lots of information provided and exercises are mixed in to give you \ some practice. As a newcomers to ", StyleBox["Mathematica,", FontSlant->"Italic"], " you should not be discouraged if you don't remember everything that's \ covered here. That's not the goal. The goal is to get you familiar with the \ tool and to give you aids for the future to refer back to so you can \ effectively use this tool. So you can relax and just have some fun going \ through these tutorials. If at any point you have questions, simply ask one \ of the facilitators in the lab for assistance -- that's what we're here for. \ Any experienced computer user should need about 45 minutes for working \ through this notebook, 1 hour for the second notebook, and 2 hours for the \ third notebook." }], "Text", Evaluatable->False], Cell["\tReady? Great! Let's begin!", "Text", Evaluatable->False], Cell[TextData[{ "(You have probably noticed the little brackets along the right-hand side \ of the screen. These brackets partition the notebook into ", StyleBox["cells", FontWeight->"Bold"], ". The ", StyleBox["cell bracket", FontWeight->"Bold"], " of the cell ", StyleBox["following", FontVariations->{"Underline"->True}], " this one looks a bit different. There are actually two cell brackets. \ Note that the rightmost cell bracket has a little hook at the bottom of it. \ Position the cursor over the ", StyleBox["rightmost", FontVariations->{"Underline"->True}], " cell bracket until the cursor takes the appearance of an arrow pointing \ at a line. Then, double-click the left mouse button.)" }], "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[TextData[{ "Which Way Did They Go?\n\tWhich Way Did They Go?\n(Navigating in ", StyleBox["Mathematica", FontSlant->"Italic"], ")" }], "Section", Evaluatable->False], Cell[TextData[{ "\tYou have just \"opened\" a grouping of cells. Often, groupings of cells \ are closed so that a user of a ", StyleBox["Mathematica", FontSlant->"Italic"], " notebook may easily scroll to the section of interest." }], "Text", Evaluatable->False], Cell[TextData[{ "\t", StyleBox["Mathematica", FontSlant->"Italic"], " has the editing features of many common word processors. For example:\n\t\ Ctrl+X\tmeans\t\"cut\"\n\tCtrl+C\tmeans\t\"copy\"\n\tCtrl+V\tmeans\t\ \"paste\" \n\tYou may perform a \"cut\" or \"copy\" operation on highlighted \ text or on an entire cell. To perform an operation on an entire cell, \ simply single-click on a cell bracket to highlight it, then choose the \ desired edit option. These edit functions are also available on the main \ toolbar." }], "Text", Evaluatable->False], Cell["\<\ \tIn order to paste a cell between two existing cells, first position the cursor between the two cells so that it takes the appearance of a horizontal I-beam. Single click with the left mouse button. You should see a horizontal line between the two cells. Paste away! \ \>", "Text"], Cell[TextData[{ "\tIn completing your ", StyleBox["Mathematica", FontSlant->"Italic"], " assignments, you will often want to copy a cell of ", StyleBox["Mathematica", FontSlant->"Italic"], " commands, paste them somewhere, and modify the commands for your specific \ assignment." }], "Text", Evaluatable->False], Cell[TextData[StyleBox["Exercise: Delete this entire cell.", FontWeight->"Bold"]], "Text", Evaluatable->False, Background->RGBColor[0, 1, 1]], Cell[TextData[StyleBox["Exercise: Copy this cell. Then, paste the copy \ immediately below this cell.", FontWeight->"Bold"]], "Text", Evaluatable->False, Background->RGBColor[0, 1, 1]], Cell["\<\ Later on we'll make some neat graphics. We'll also be able to copy and paste \ these into things like Word documents and PowerPoint presentations. Can't wait, can you? \ \>", "Text"], Cell[TextData[{ "\tWhen working through a ", StyleBox["Mathematica", FontSlant->"Italic"], " notebook, it is a good idea to save your work periodically. To do this, \ select \"Save\" from the menu option \"File\" above, OR type \"Ctrl+S\". \ (Note: You will not be able to save a notebook to a file server unless you \ have write privileges to that server.)" }], "Text", Evaluatable->False], Cell["\<\ \tThat's enough navigation for now...except for one last item: To close a grouping of cells, double-click on the rightmost cell bracket in the grouping. Close this grouping now, and go on to the next section. \ \>", "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], "...\n\tEasy as 1+2+3" }], "Section", Evaluatable->False], Cell[TextData[{ "\tSo far, all of the cells we have encountered have been \"text cells.\" \ Text cells are denoted by the little \"flag\" at the top of the cell bracket. \ In order to get ", StyleBox["Mathematica", FontSlant->"Italic"], " to perform an actual computation or operation, we need an \"input cell.\" \ These have no flags on their cell brackets." }], "Text", Evaluatable->False], Cell[TextData[{ "\tThe following cell is an input cell. In order to get ", StyleBox["Mathematica", FontSlant->"Italic"], " to execute it, single-click anywhere within the cell. Then, press either \ Shift-Enter OR Enter on the ", StyleBox["numeric", FontVariations->{"Underline"->True}], " keypad." }], "Text"], Cell["1 + 2 + 3", "Input", PageWidth->Infinity], Cell[TextData[{ StyleBox["Note: ", FontWeight->"Bold"], " The first time you enter a command in Mathematica, it will take a couple \ of seconds for it to execute. This is because ", StyleBox["Mathematica", FontSlant->"Italic"], " must start up its processing routines (which are collectively called the \ \"", StyleBox["Mathematica", FontSlant->"Italic"], " Kernel\")." }], "Text"], Cell[TextData[{ "Suppose we want to get a decimal approximation of the fraction ", Cell[BoxData[ \(TraditionalForm\`2\/7\)]], ". Execute the following cell:" }], "Text"], Cell[BoxData[ \(2\/7\)], "Input"], Cell[TextData[{ "Hmmm...not exactly a decimal. ", StyleBox["Mathematica", FontSlant->"Italic"], " works with ", StyleBox["exact", FontVariations->{"Underline"->True}], " values whenever possible. To get a decimal approximation, use a capital \ \"N\" with SQUARE brackets: Execute the cell below." }], "Text"], Cell[BoxData[ \(N[2\/7]\)], "Input"], Cell["\<\ Want more digits...like, say, 24? Use the following: (Go ahead and execute it). \ \>", "Text"], Cell[BoxData[ \(N[2\/7, 24]\)], "Input"], Cell["\<\ If we replace the square brackets with parentheses, we get an error: (Give it a try by executing the cell below). \ \>", "Text"], Cell[BoxData[ \(N \((2\/7, 24)\)\)], "Input"], Cell[TextData[{ "Common Pitfall #1: ", StyleBox["Mathematica", FontSlant->"Italic"], " commands (functions) always expect their arguments to be within square \ brackets. Square brackets are not interchangeable with parentheses ( ) or \ squiggly braces { }." }], "Text", Background->GrayLevel[0.666667]], Cell["\<\ Work through the next few cells by executing each one of them. To multiply, use an asterisk: \ \>", "Text"], Cell[BoxData[ \(12*8\)], "Input"], Cell["\<\ Alternatively, you may just leave a space between the factors: \ \>", "Text"], Cell[BoxData[ \(12\ 8\)], "Input"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " can be used to simplify radicals or fractions...and it does so \ automatically!" }], "Text"], Cell[BoxData[ \(1284\/612\)], "Input"], Cell[BoxData[ \(\@52\)], "Input"], Cell[BoxData[ \(Notice\ below\ that\ when\ we\ compute\ \@52. \ instead\ of\ \@52, \ we\ get\ a\ completely\ different\ answer . \ \ That' s\ because\ when\ you\ use\ just\ integers, \ fractions, \ and/or\ \ symbols, \ Mathematica\ gives\ you\ the\ exact\ answer . \ \ However, \ if\ you\ use\ any\ numbers\ with\ decimal\ points, \ Mathematica\ automatically\ converts\ to\ a\ numerical\ format . \ \ \ While\ this\ may\ not\ seem\ like\ a\ ' big\ deal'\ now, \ it\ does\ have\ some\ significant\ implications\ for\ many\ of\ the\ more\ \ advanced\ functions\ of\ Mathematica\ and\ is\ definitely\ something\ to\ \ keep\ in\ \(\(mind\)\(.\)\)\)], "Text", FontFamily->"Arial"], Cell[BoxData[ \(\@52. \)], "Input"], Cell[TextData[{ "Helpful Hint: The use of any numbers with a decimal point automatically \ puts ", StyleBox["Mathematica", FontSlant->"Italic"], " into a numerical mode of operations which causes many functions to have \ significantly different behavior." }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ "We mentioned earlier that square brackets were needed for function calls \ and not to use parantheses. Parantheses are used in ", StyleBox["Mathematica", FontSlant->"Italic"], " to specify order of evaluation in expression (just like we learned in \ elementary school).\nExecute the cell below to see how the two expressions \ vary in their results:" }], "Text"], Cell[BoxData[{ \(5 + 2*10\), "\n", \(\((5 + 2)\)*10\)}], "Input"], Cell["\<\ Notice how we can also execute multiple expressions in the same cell and how \ their results come out in order. \ \>", "Text"], Cell[TextData[{ StyleBox["More navigational hints", FontWeight->"Bold"], ": One helpful tool in ", StyleBox["Mathematica", FontSlant->"Italic"], " is the \"%\" symbol. It stands for the most recent output. For example, \ if we want 30 digits of the last piece of ", StyleBox["Mathematica", FontSlant->"Italic"], " output, we enter the following:" }], "Text"], Cell[BoxData[ \(N[%, 30]\)], "Input"], Cell["\<\ To refer to the n-th piece of output in this notebook, use %n. For example: \ \>", "Text"], Cell[BoxData[ \(%5\)], "Input"], Cell[TextData[{ "Important constants like \[Pi], e, and i are programmed into Mathematica \ in a special way. For \[Pi], you can select the greek letter from the \ BasicInput palette that should be on the right side of your screen or you can \ type it as \"Pi\" (NOTE: This MUST be capital 'P' followed by lower case \ 'i'). The constants \[ExponentialE] and \[ImaginaryI] can also be selected \ from the BasicInput palette or typed as 'E' and 'I' respectively. They must \ be capitalized if typed directly, otherwise ", StyleBox["Mathematica", FontSlant->"Italic"], " will think you are declaring a variable named 'e' or 'i'." }], "Text"], Cell[TextData[{ "Common Pitfall #2: Folks will type in commands using 'pi' instead of \ 'Pi', 'e' instead of 'E', or 'i' instead of 'I' and ", StyleBox["Mathematica", FontSlant->"Italic"], " will not recognize them for what they are meant to be." }], "Text", Background->GrayLevel[0.666667]], Cell["\<\ Helpful Hint: If you ever lose the BasicInput palette, go to the Main Toolbar and select File|Palettes|BasicInput and it will be re-displayed for you. \ \>", "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ StyleBox["Exercise: In the input cell which follows, use ", FontWeight->"Bold"], StyleBox["Mathematica", FontWeight->"Bold", FontSlant->"Italic"], StyleBox[" to compute a decimal approximation for ", FontWeight->"Bold"], Cell[BoxData[ \(TraditionalForm\`\[Pi]\^2\)]], "/6 + ", Cell[BoxData[ \(TraditionalForm\`\@\(10 e\)\)]], "with 40 digits of accuracy. (Hint: You can find the Square root symbol on \ the BasicInput palette or use the function, Sqrt[-])." }], "Text", Background->RGBColor[0, 1, 1]], Cell[BoxData[ \(\n\)], "Input"], Cell[TextData[{ "NOTE: There are a number of different looking CELLS in this section. The \ ones like this one are \"Text\" cells used to input comments and descriptive \ text. You can also make these text cells look differently, like the gray or \ light blue ones above, by creating the text cell and then changing the \ formatting via the Format pull-down menu on the Main Toolbar.\nThe cells that \ are white with the goldish brown border are \"Input\" cells. This is the \ default cell type and is where you enter in commands for ", StyleBox["Mathematica", FontSlant->"Italic"], " to execute. There are also many other types of cells including titles, \ subtitles, sections, and many more. To change a cell's type, first select \ the cell by clicking on the bracket on the right side and then go to the Main \ Toolbar and select Format|Style and pick which style you want.\nTo create a \ new cell, simple move your cursor to just before or after an existing cell \ till you get a horizonal cursor symbol and start typing. In a blank \ notebook, you can just start typing. The type of the cell will default to an \ 'input' but you can change it as mentioned above." }], "Text"], Cell[TextData[{ StyleBox["Exercise: Create a new input cell right after this cell and use \ it to compute ", FontWeight->"Bold"], Cell[BoxData[ \(TraditionalForm\`\@2\)]], " ", StyleBox["with ten digits of accuracy.", FontWeight->"Bold"] }], "Text", Background->RGBColor[0, 1, 1]], Cell[TextData[{ "FOR THE CURIOUS: There are also \"Style sheets\" in ", StyleBox["Mathematica", FontSlant->"Italic"], " that set whole different looks for the notebook. The default Style Sheet \ is very plain. To change it to something more interesting (like the one \ used here), go to the Main Toolbar and select Format|Style Sheet and pick \ the one you'd like to use." }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["What's Your Function?", "Section"], Cell[TextData[{ "\tAs mentioned above, ", StyleBox["Mathematica's ", FontSlant->"Italic"], "true power lies in its ability to perform symbolic operations. Let's \ define a function f[x]. Before we do so, we should clear the variables f and \ x of any previous values. Click in the cell below and execute it." }], "Text"], Cell[BoxData[ \(\(Clear[f, x];\)\)], "Input"], Cell["\<\ \tThe Clear command ensures that previous definitions for the variables f and \ x are erased. (NOTE: The ';' is optional. In general it is used to surpress \ display of the command's output). \ \>", "Text"], Cell[TextData[{ "Common Pitfall #3: It is good form to clear variables before using them. \ Many ", StyleBox["Mathematica", FontSlant->"Italic"], " errors are caused by variables which have not been reset from a previous \ use." }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ "\tNote that the 'Clear' command is ", StyleBox["capitalized", FontWeight->"Bold"], ". ", StyleBox["Mathematica", FontSlant->"Italic"], "- defined functions and commands must always be capitalized. Sometimes, \ there are also capital letters within a command name." }], "Text"], Cell[TextData[{ "Common Pitfall #4: ", StyleBox["Mathematica", FontSlant->"Italic"], "-defined commands are case-sensitive. Pay attention to capital letters!" }], "Text", Background->GrayLevel[0.666667]], Cell["\<\ Next, define the function f as follows by executing the cell below: \ \>", "Text"], Cell[BoxData[ \(f[x_]\ = \ 2 x^2\ + 5\ x\ - 4\)], "Input"], Cell[TextData[{ "\tIn the definition of f, note the use of the square brackets, AND the use \ of the ", StyleBox["underscore", FontWeight->"Bold"], " after the input variable x. An ", StyleBox["underscore", FontWeight->"Bold"], " is always used when defining a function...", StyleBox["but only then", FontVariations->{"Underline"->True}], ". We do not use the underscore when evaluating a function f at a certain \ value: (Go ahead and execute the next five input cells one at a time)." }], "Text"], Cell[BoxData[ \(f[3]\)], "Input"], Cell[BoxData[ \(N[f[\[Pi]], 8]\)], "Input"], Cell["\<\ Nor do we use the underscore when we evaluate f at an arbitrary expression: \ \>", "Text"], Cell[BoxData[ \(f[w\^2\ y]\)], "Input"], Cell["Now, let's define another function g:", "Text"], Cell[BoxData[{ \(\(Clear[g, x];\)\), "\n", \(g[x] = x^3\ - 8 x\)}], "Input"], Cell["Evaluate g[100]:", "Text"], Cell[BoxData[ \(g[100]\)], "Input"], Cell[TextData[{ StyleBox["Exercise: Why does ", FontWeight->"Bold"], StyleBox["Mathematica", FontWeight->"Bold", FontSlant->"Italic"], StyleBox[" not produce a result for g[100]? Fix it.", FontWeight->"Bold"] }], "Text", Background->RGBColor[0, 1, 1]], Cell[TextData[{ "Common Pitfall #5: Use underscores after the input variable whenever you \ ", StyleBox["define", FontVariations->{"Underline"->True}], " a function. Do not use underscores at any other time." }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ StyleBox["Some more navigational hints:", FontWeight->"Bold"], " ", StyleBox["Mathematica ", FontSlant->"Italic"], "holds variable assignments in memory from one cell to the next. So, once \ we define the function f above, we are able to use it in any future cell:" }], "Text"], Cell[BoxData[ \(f[100]\)], "Input"], Cell[TextData[{ StyleBox["\tMathematica", FontSlant->"Italic"], " does not care about the order in which you execute cells. However, there \ is a flip side to this: ", StyleBox["Mathematica", FontSlant->"Italic"], " will not assign a value to a variable until you execute the cell, even if \ you execute a cell lower in the notebook. As a demonstration, do ", StyleBox["NOT ", FontWeight->"Bold"], "execute the following cell:" }], "Text"], Cell[BoxData[ \(m = 7\)], "Input"], Cell["But, DO execute this one:", "Text"], Cell[BoxData[ \(m^3\ + \ m^2\ + \ m\ - 1\)], "Input"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " does not know that we want m to be 7 until you execute the cell telling \ ", StyleBox["Mathematica", FontSlant->"Italic"], " that m = 7." }], "Text"], Cell[TextData[{ "Common Pitfall #6: Always check to be sure that you have executed the \ cells which you intended to execute. ", StyleBox["Mathematica", FontSlant->"Italic"], " is not a mind-reader (yet)." }], "Text", Background->GrayLevel[0.666667]] }, Closed]], Cell[CellGroupData[{ Cell["Algebraic Gymnastics, 2001", "Section"], Cell[TextData[{ "We can use ", StyleBox["Mathematica", FontSlant->"Italic"], " to solve equations using the Solve command. The Solve command takes two \ ", StyleBox["arguments", FontWeight->"Bold"], ": the ", StyleBox["equation", FontVariations->{"Underline"->True}], " itself and the ", StyleBox["variable", FontVariations->{"Underline"->True}], " for which we are solving: (Execute the cell below to check it out)." }], "Text"], Cell[BoxData[ \(Solve[3 x^2\ - \ 2 x - 7 == 0, x]\)], "Input"], Cell[TextData[{ "Note that the equation in the Solve command has ", StyleBox["double equal-signs", FontWeight->"Bold"], ". Double equals are used in equations. This differs from the use of a \ single equal-sign to assign a value to a variable or to define a function: \ (Execute the input cell below)." }], "Text"], Cell[BoxData[{ \(\(y\ = \ 15;\)\), "\n", \(Print[y^2\ - \ y]\)}], "Input"], Cell[TextData[{ "Common Pitfall #7: Use double equal-signs for equations which you want ", StyleBox["Mathematica", FontSlant->"Italic"], " to solve. Use a single equal-sign for assigning values to variables." }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ "As mentioned, ", StyleBox["Mathematica ", FontSlant->"Italic"], "allows us to solve equations symbolically. Can't remember the quadratic \ formula? No problem, execute the cell below:" }], "Text"], Cell[BoxData[{ \(\(Clear[a, b, c, x];\)\), "\n", \(Solve[a\ x^2\ + \ b\ x\ + \ c\ == \ 0, x]\)}], "Input"], Cell[TextData[{ "Note that the above equation uses spaces instead of asterisks to denote \ multiplication. This is a natural way to type an expression, as asterisks \ are seldom used in print to denote multiplication. However, ", StyleBox["the spaces themselves are important", FontVariations->{"Underline"->True}], ". Try the following:" }], "Text"], Cell[BoxData[{ \(\(Clear[a, b, c, x];\)\), "\n", \(Solve[ax^2\ + \ bx\ + \ c\ == \ 0, x]\)}], "Input"], Cell[TextData[{ StyleBox["What happened!? ", FontWeight->"Bold"], "Because no spaces were entered between the 'a' and the 'x' and between the \ 'b' and the 'x', ", StyleBox["Mathematica", FontSlant->"Italic"], " found no variable called 'x'. Instead, ", StyleBox["Mathematica", FontSlant->"Italic"], " saw an equation with variables 'ax', 'bx', and 'c'." }], "Text"], Cell["\<\ Common Pitfall #8: If you choose not to use an asterisk to denote multiplication, be certain to use a space. \ \>", "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ StyleBox["Exercise: Solve ", FontWeight->"Bold"], Cell[BoxData[ \(TraditionalForm\`y\^3 + by + 1 = 0\)], FontWeight->"Bold"], StyleBox[" for y.", FontWeight->"Bold"] }], "Text", Background->RGBColor[0, 1, 1]], Cell[BoxData[""], "Input"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " has several other functions that are particularily helpful with algebra. \ Below are some examples borrowed from a web-based tutorial at the Lawrence \ Livermore National Laboratory." }], "Text"], Cell["\<\ Two of the simplest and most commonly used functions are Factor and Expand. Check out the examples below. \ \>", "Text"], Cell[BoxData[ StyleBox[\(Factor[ a\ b\ c\ + \ 2\ a\ c\ + \ b\ c\ + \ 2\ c\ + \ 3\ a\ b\ + \ 6\ a\ + \ 3\ b\ + \ 6]\), FormatType->StandardForm]], "Input"], Cell[BoxData[ StyleBox[\(Expand[\((1\ + \ a)\)\ \((2\ + \ b)\)\ \((3\ + \ c)\)]\), FormatType->StandardForm]], "Input"], Cell["\<\ Some very rational things to do with fractions ,sorry for the pun, are to combine them using a common denominator or to expand them using partial fractions. The Mathematica Together and Apart commands handle this for us. See below: \ \>", "Text"], Cell[BoxData[ StyleBox[\(Together[\((\ \((3*x^2)\)/ y\ )\)\ + \ \((\ \((4*x)\)/\((2*z)\)\ )\)]\), FormatType->StandardForm]], "Input"], Cell[BoxData[ StyleBox[\(Apart[\((2*x*y\ + \ 3*x^2*z)\)\ /\ \((y*z)\)]\), FormatType->StandardForm]], "Input"], Cell["\<\ Finally, there's one more algebraic command that comes in very handy. Mathematica's Simplify command reduces and expression to it's simplest form (which in Mathematica means the fewest number of elements). Check out the examples below. \ \>", "Text"], Cell[BoxData[ StyleBox[\(Simplify[\((x^2\ + \ 2*x*y\ + \ y^2)\)\ /\ \((x + y)\)]\), FormatType->StandardForm]], "Input"], Cell[BoxData[ StyleBox[\(Simplify[\((3*a^3*b^2*c^2)\)/\((a*b*c)\)]\), FormatType->StandardForm]], "Input"], Cell["\<\ Great! That's pretty neat and sure would have come in handy back in high school. Let's try a few quick exercises and then wrap this session up. \ \>", "Text"], Cell[TextData[{ StyleBox["Exercise: Multiply out ", FontWeight->"Bold"], Cell[BoxData[ \(TraditionalForm\`\((a + b)\)\^5\)]], " ", StyleBox["and then factor the results (remember you can get at the results \ with the \"%\" symbol).", FontWeight->"Bold"] }], "Text", Background->RGBColor[0, 1, 1]], Cell[BoxData[""], "Input"], Cell[TextData[{ StyleBox["Exercise: Do a partial fractions decomposition on ", FontWeight->"Bold"], Cell[BoxData[ \(TraditionalForm\`1\/\(x\^2 - 1\)\)]], " ", StyleBox["and then put the results back together. Notice that the results \ of putting them back together can is not in the original form. Use Simplify \ on these results and see what happens.", FontWeight->"Bold"] }], "Text", Background->RGBColor[0, 1, 1]], Cell[BoxData[""], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Wrap-Up", "Section"], Cell[TextData[{ "\tNow that you have completed this notebook, you hopefully have some \ confidence that you can navigate around a ", StyleBox["Mathematica", FontSlant->"Italic"], " notebook and execute some simple commands. " }], "Text"], Cell[TextData[{ StyleBox["A Note on Syntax Errors", FontWeight->"Bold"], ": The eight \"common pitfalls\" described above account for probably 80% \ of the \"unexplained\" error messages which occur during a ", StyleBox["Mathematica", FontSlant->"Italic"], " session. Always check to see if an error fits into one of these \ categories. ", StyleBox["If all else fails, save your work, shut down ", FontWeight->"Bold"], StyleBox["Mathematica", FontWeight->"Bold", FontSlant->"Italic"], StyleBox[", and start over. ", FontWeight->"Bold"], " This causes the ", StyleBox["Mathematica", FontSlant->"Italic"], " Kernel to clear and reload and is often enough to correct the problem." }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Summary of Common Pitfalls", "Section"], Cell["\<\ You may want to print this section for future reference. If so, you can easily do this by clicking on the outer cell grouping bracket and then selecting 'File|Print Selection' from the main toolbar. \ \>", "Text"], Cell[TextData[{ "Common Pitfall #1: ", StyleBox["Mathematica", FontSlant->"Italic"], " commands (functions) always expect their arguments to be within square \ brackets. Square brackets are not interchangeable with parentheses ( ) or \ squiggly braces { }." }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ "Common Pitfall #2: Folks will type in commands using 'pi' instead of \ 'Pi', 'e' instead of 'E', or 'i' instead of 'I' and ", StyleBox["Mathematica", FontSlant->"Italic"], " will not recognize them for what they are meant to be." }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ "Common Pitfall #3: It is good form to clear variables before using them. \ Many ", StyleBox["Mathematica", FontSlant->"Italic"], " errors are caused by variables which have not been reset from a previous \ use." }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ "Common Pitfall #4: ", StyleBox["Mathematica", FontSlant->"Italic"], "-defined commands are case-sensitive. Pay attention to capital letters!" }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ "Common Pitfall #5: Use underscores after the input variable whenever you \ ", StyleBox["define", FontVariations->{"Underline"->True}], " a function. Do not use underscores at any other time." }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ "Common Pitfall #6: Always check to be sure that you have executed the \ cells which you intended to execute. ", StyleBox["Mathematica", FontSlant->"Italic"], " is not a mind-reader (yet)." }], "Text", Background->GrayLevel[0.666667]], Cell[TextData[{ "Common Pitfall #7: Use double equal-signs for equations which you want ", StyleBox["Mathematica", FontSlant->"Italic"], " to solve. Use a single equal-sign for assigning values to variables." }], "Text", Background->GrayLevel[0.666667]], Cell["\<\ Common Pitfall #8: If you choose not to use an asterisk to denote multiplication, be certain to use a space. \ \>", "Text", Background->GrayLevel[0.666667]] }, Closed]], Cell[CellGroupData[{ Cell["Acknowledgements", "Section"], Cell["\<\ This tutorial notebook is an accumulation of previous work done by many members of the Department of Mathematical Sciences, United States Air Force Academy including Capt Paul Simonich, Major Glenn Sjoden, and Capt Robert Clasen, and many others. It has been enhanced and packaged into its current form by Lt Col Steve Hadfield and Dr Brad Kline. Suggestions on further improvements can be submitted to Lt Col Hadfield via email to: steve.hadfield@usafa.af.mil. \ \>", "Text"] }, Closed]], Cell[TextData[StyleBox["", "Section", FontWeight->"Bold"]], "Subsubtitle"] }, FrontEndVersion->"4.0 for Microsoft Windows", ScreenRectangle->{{0, 800}, {0, 527}}, ScreenStyleEnvironment->"Working", WindowToolbars->{}, CellGrouping->Manual, WindowSize->{616, 466}, WindowMargins->{{4, Automatic}, {Automatic, 2}}, PrintingCopies->1, PrintingPageRange->{Automatic, Automatic}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, StyleDefinitions -> "DemoText.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[1717, 49, 344, 13, 70, "Title", Evaluatable->False], Cell[2064, 64, 1070, 27, 162, "Text", Evaluatable->False], Cell[3137, 93, 1707, 40, 238, "Text", Evaluatable->False], Cell[4847, 135, 68, 1, 70, "Text", Evaluatable->False], Cell[4918, 138, 777, 19, 70, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[5720, 161, 181, 6, 70, "Section", Evaluatable->False], Cell[5904, 169, 276, 7, 70, "Text", Evaluatable->False], Cell[6183, 178, 575, 12, 70, "Text", Evaluatable->False], Cell[6761, 192, 299, 7, 70, "Text"], Cell[7063, 201, 332, 10, 70, "Text", Evaluatable->False], Cell[7398, 213, 148, 3, 70, "Text", Evaluatable->False], Cell[7549, 218, 193, 4, 70, "Text", Evaluatable->False], Cell[7745, 224, 197, 7, 70, "Text"], Cell[7945, 233, 408, 9, 70, "Text", Evaluatable->False], Cell[8356, 244, 260, 7, 70, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[8653, 256, 129, 5, 70, "Section", Evaluatable->False], Cell[8785, 263, 409, 9, 70, "Text", Evaluatable->False], Cell[9197, 274, 330, 9, 70, "Text"], Cell[9530, 285, 49, 1, 70, "Input"], Cell[9582, 288, 408, 12, 70, "Text"], Cell[9993, 302, 182, 5, 70, "Text"], Cell[10178, 309, 37, 1, 70, "Input"], Cell[10218, 312, 330, 9, 70, "Text"], Cell[10551, 323, 40, 1, 70, "Input"], Cell[10594, 326, 108, 5, 70, "Text"], Cell[10705, 333, 44, 1, 70, "Input"], Cell[10752, 336, 141, 5, 70, "Text"], Cell[10896, 343, 49, 1, 70, "Input"], Cell[10948, 346, 318, 8, 70, "Text"], Cell[11269, 356, 119, 6, 70, "Text"], Cell[11391, 364, 37, 1, 70, "Input"], Cell[11431, 367, 88, 4, 70, "Text"], Cell[11522, 373, 38, 1, 70, "Input"], Cell[11563, 376, 165, 5, 70, "Text"], Cell[11731, 383, 42, 1, 70, "Input"], Cell[11776, 386, 37, 1, 70, "Input"], Cell[11816, 389, 719, 12, 70, "Text"], Cell[12538, 403, 39, 1, 70, "Input"], Cell[12580, 406, 315, 8, 70, "Text"], Cell[12898, 416, 393, 8, 70, "Text"], Cell[13294, 426, 74, 2, 70, "Input"], Cell[13371, 430, 139, 6, 70, "Text"], Cell[13513, 438, 386, 11, 70, "Text"], Cell[13902, 451, 41, 1, 70, "Input"], Cell[13946, 454, 103, 5, 70, "Text"], Cell[14052, 461, 35, 1, 70, "Input"], Cell[14090, 464, 659, 11, 70, "Text"], Cell[14752, 477, 305, 7, 70, "Text"], Cell[15060, 486, 214, 7, 70, "Text"], Cell[15277, 495, 564, 16, 70, "Text"], Cell[15844, 513, 35, 1, 70, "Input"], Cell[15882, 516, 1211, 18, 70, "Text"], Cell[17096, 536, 306, 10, 70, "Text"], Cell[17405, 548, 400, 8, 70, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[17842, 561, 40, 0, 70, "Section"], Cell[17885, 563, 335, 7, 70, "Text"], Cell[18223, 572, 49, 1, 70, "Input"], Cell[18275, 575, 221, 8, 70, "Text"], Cell[18499, 585, 289, 8, 70, "Text"], Cell[18791, 595, 314, 9, 70, "Text"], Cell[19108, 606, 217, 6, 70, "Text"], Cell[19328, 614, 95, 4, 70, "Text"], Cell[19426, 620, 66, 1, 70, "Input"], Cell[19495, 623, 529, 13, 70, "Text"], Cell[20027, 638, 37, 1, 70, "Input"], Cell[20067, 641, 47, 1, 70, "Input"], Cell[20117, 644, 101, 4, 70, "Text"], Cell[20221, 650, 43, 1, 70, "Input"], Cell[20267, 653, 53, 0, 70, "Text"], Cell[20323, 655, 87, 2, 70, "Input"], Cell[20413, 659, 32, 0, 70, "Text"], Cell[20448, 661, 39, 1, 70, "Input"], Cell[20490, 664, 277, 9, 70, "Text"], Cell[20770, 675, 268, 7, 70, "Text"], Cell[21041, 684, 312, 8, 70, "Text"], Cell[21356, 694, 39, 1, 70, "Input"], Cell[21398, 697, 468, 12, 70, "Text"], Cell[21869, 711, 38, 1, 70, "Input"], Cell[21910, 714, 41, 0, 70, "Text"], Cell[21954, 716, 60, 1, 70, "Input"], Cell[22017, 719, 230, 8, 70, "Text"], Cell[22250, 729, 265, 7, 70, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[22552, 741, 45, 0, 70, "Section"], Cell[22600, 743, 467, 15, 70, "Text"], Cell[23070, 760, 69, 1, 70, "Input"], Cell[23142, 763, 329, 7, 70, "Text"], Cell[23474, 772, 85, 2, 70, "Input"], Cell[23562, 776, 267, 6, 70, "Text"], Cell[23832, 784, 226, 6, 70, "Text"], Cell[24061, 792, 118, 2, 70, "Input"], Cell[24182, 796, 365, 7, 70, "Text"], Cell[24550, 805, 114, 2, 70, "Input"], Cell[24667, 809, 393, 11, 70, "Text"], Cell[25063, 822, 171, 6, 70, "Text"], Cell[25237, 830, 251, 9, 70, "Text"], Cell[25491, 841, 26, 0, 70, "Input"], Cell[25520, 843, 270, 6, 70, "Text"], Cell[25793, 851, 133, 5, 70, "Text"], Cell[25929, 858, 190, 4, 70, "Input"], Cell[26122, 864, 132, 2, 70, "Input"], Cell[26257, 868, 262, 7, 70, "Text"], Cell[26522, 877, 159, 3, 70, "Input"], Cell[26684, 882, 121, 2, 70, "Input"], Cell[26808, 886, 266, 7, 70, "Text"], Cell[27077, 895, 132, 2, 70, "Input"], Cell[27212, 899, 116, 2, 70, "Input"], Cell[27331, 903, 172, 5, 70, "Text"], Cell[27506, 910, 322, 10, 70, "Text"], Cell[27831, 922, 26, 0, 70, "Input"], Cell[27860, 924, 445, 11, 70, "Text"], Cell[28308, 937, 26, 0, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[28371, 942, 26, 0, 70, "Section"], Cell[28400, 944, 249, 6, 70, "Text"], Cell[28652, 952, 742, 20, 70, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[29431, 977, 45, 0, 70, "Section"], Cell[29479, 979, 227, 6, 70, "Text"], Cell[29709, 987, 318, 8, 70, "Text"], Cell[30030, 997, 305, 7, 70, "Text"], Cell[30338, 1006, 289, 8, 70, "Text"], Cell[30630, 1016, 217, 6, 70, "Text"], Cell[30850, 1024, 268, 7, 70, "Text"], Cell[31121, 1033, 265, 7, 70, "Text"], Cell[31389, 1042, 267, 6, 70, "Text"], Cell[31659, 1050, 171, 6, 70, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[31867, 1061, 35, 0, 70, "Section"], Cell[31905, 1063, 494, 11, 70, "Text"] }, Closed]], Cell[32414, 1077, 76, 1, 70, "Subsubtitle"] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)