(************** Content-type: application/mathematica **************
CreatedBy='Mathematica 5.0'
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[ 10854, 386]*)
(*NotebookOutlinePosition[ 11847, 418]*)
(* CellTagsIndexPosition[ 11803, 414]*)
(*WindowFrame->Normal*)
Notebook[{
Cell[TextData[{
"LESSON 3\n",
StyleBox["Mathematica",
FontSlant->"Italic"],
" AS \nSYMBOLIC CALCULATOR"
}], "Title",
Evaluatable->False,
TextAlignment->Center,
AspectRatioFixed->True],
Cell[CellGroupData[{
Cell[TextData["Author's notice\n"], "Section",
Evaluatable->False,
AspectRatioFixed->True],
Cell["\<\
This tutorial was written by
Fred Goodman
Department of Mathematics
University of Iowa
Iowa City, IA 52242
goodman@math.uiowa.edu
This material may be freely copied and used for non-commercial purposes. \
Please retain this author's notice, and do not distribute any altered version \
of this material without the author's permission (unless the material is \
altered beyond recognition).
\
\>", "Text",
Evaluatable->False,
AspectRatioFixed->True]
}, Closed]],
Cell[CellGroupData[{
Cell[TextData["Assigning values to variables.\n"], "Section",
Evaluatable->False,
AspectRatioFixed->True],
Cell["\<\
As in all general purpose computer languages, you can assign values \
to variable. Mathematica will remember the value until you explicitly \
change it or Clear[ ] it.
The following is an input cell; to do the indicated computation, Click on \
the red bracket on the right and hit enter, or shift+return.
Do the same with the subsequent input cells (and observe the output).
\
\>", "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[CellGroupData[{
Cell[BoxData[{
\(Clear[a]\), "\n",
\(3\ a + 5\), "\[IndentingNewLine]",
\(Sin[a]\)}], "Input",
AspectRatioFixed->True],
Cell[BoxData[{
\(a = .03\), "\n",
\(3\ a + 5\), "\n",
\(Sin[a]\), "\[IndentingNewLine]",
\(\((a + b)\)^2\)}], "Input",
AspectRatioFixed->True]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[TextData["Defining your own functions.\n"], "Section",
Evaluatable->False,
AspectRatioFixed->True],
Cell["\<\
To define your own function in Mathematica, you use the following \
pattern. You must follow this pattern exactly. Notice in particular the \
underline next to the x on the left side and the colon followed by the equal \
sign.
Evaluate the following cell now! \
\>", "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[BoxData[
\(f[x_] := x\^5 + 16\ x\^2 - 4\ x + 3\)], "Input",
AspectRatioFixed->True],
Cell["\<\
When you evaluated the input cell above, nothing seems to happen; this is \
because the := (colon followed by equals) causes delayed evaluation. \
However Mathematica now knows the definition of the function f.\
\>", "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[BoxData[{
\(f[3]\),
\(f[y]\),
\(f[a + b]\)}], "Input",
AspectRatioFixed->True],
Cell[TextData[{
"\n",
StyleBox["Hey, what happened to a?",
FontWeight->"Bold"],
" Mathematica remembered that ",
StyleBox["a",
FontWeight->"Bold"],
" still has the value .03, although you may have forgotten. If you no \
longer want a to have this value, you have to clear it. After you clear ",
StyleBox["a",
FontWeight->"Bold"],
", ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" will again treat it as a symbol, or variable quantity.\n"
}], "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[BoxData[{
\(Clear[a]\),
\(f[a + b]\)}], "Input",
AspectRatioFixed->True],
Cell["\<\
Warning: You must follow the syntax exactly for defining a function. You \
must use the little underline after the variable on the left side, and you \
must use the delayed assignment operator :=. If you don't, you can get some \
wierd and confusing results.
Try the following experiment:\
\>", "Text",
Evaluatable->False,
AspectRatioFixed->True,
FontWeight->"Bold",
FontSlant->"Plain",
FontTracking->"Plain",
FontVariations->{"Underline"->False,
"Outline"->False,
"Shadow"->False}],
Cell[BoxData[{
\(Clear[f]\),
\(f[x_] := Sin[x]\^2 + 5\),
\(f[3]\),
\(f[3.]\),
\(f[y]\)}], "Input",
AspectRatioFixed->True],
Cell[TextData[{
"(Notice that ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" left Sin[3] in symbolic form; we could tell it we wanted a numerical \
answer by writing 3. = 3.0 instead of just 3.)\n\nNow let's do it ",
StyleBox["wrong:",
FontWeight->"Bold"]
}], "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[BoxData[{
\(Clear[f]\),
\(f[x] := Sin[x]\^2 + 5\),
\(f[3]\),
\(f[3.]\),
\(f[y]\)}], "Input",
AspectRatioFixed->True],
Cell[TextData[
"Mathematica didn't learn the new function definition because we got the \
syntax wrong."], "Text",
Evaluatable->False,
AspectRatioFixed->True]
}, Closed]],
Cell[CellGroupData[{
Cell[TextData["Simplifying algebraic expressions.\n"], "Section",
Evaluatable->False,
AspectRatioFixed->True],
Cell[TextData[{
"\nMost of what you know how to do from algebra, factoring, expanding, \
combining rational expressions, working with radicals and exponents can also \
be done in (or by) ",
StyleBox["Mathematica",
FontSlant->"Italic"],
". "
}], "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[BoxData[{
\(Clear[f]\),
\(f[x_] := \(-18360\)\ x - 1895\ x\^2 - 369\ x\^3 + 15\ x\^4 + x\^5\)}],
"Input",
AspectRatioFixed->True],
Cell[BoxData[
\(f[x]\)], "Input",
AspectRatioFixed->True],
Cell[TextData[{
"\n",
StyleBox["Factor[ ] ",
FontWeight->"Bold"],
" will factor expressions (when it can)."
}], "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[BoxData[
\(Factor[f[x]]\)], "Input",
AspectRatioFixed->True],
Cell[TextData[{
StyleBox["Together[ ] ",
FontWeight->"Bold"],
" will combine sums over a common denominator and afterwards cancel common \
factors."
}], "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[CellGroupData[{
Cell[BoxData[{
\(F[x_] := \(-\(\(x\^3\ 2\ x\)\/\((1 + x\^2)\)\^2\)\) + \(3\ x\^3\)\/\(1 \
+ x\^2\)\), "\n",
\(F[x]\)}], "Input",
AspectRatioFixed->True],
Cell[BoxData[{
\(Together[F[x]]\), "\n",
\(Factor[Together[F[x]]]\)}], "Input",
AspectRatioFixed->True]
}, Open ]],
Cell[TextData[{
StyleBox["Simplify[ ] ",
FontWeight->"Bold"],
" attempts to put an expression in \"simplest\" form. Possibly it will not \
be the form you prefer, however. In this example, it does just what we \
want."
}], "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[BoxData[
\(Simplify[F[x]]\)], "Input",
AspectRatioFixed->True],
Cell[TextData[{
"Other functions for changing the form of expressions are:\n",
StyleBox["Apart[ ]",
FontWeight->"Bold"],
", which is more or less the opposite of Together[ ],\n",
StyleBox["Collect[ ]",
FontWeight->"Bold"],
", which collects like terms,\n",
StyleBox["Expand[ ]",
FontWeight->"Bold"],
", which multiplies out factors, and\n",
StyleBox["Cancel[ ]",
FontWeight->"Bold"],
", which cancels common factors.\nYou can get information on these using \
the ? operation.\n"
}], "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[BoxData[
\(\(?Cancel\)\)], "Input",
AspectRatioFixed->True],
Cell[TextData[{
"For working with trigonometric functions, you can use the simplification \
functions above, but you have to set the option ",
StyleBox["Trig-> True",
FontWeight->"Bold"],
"."
}], "Text",
Evaluatable->False,
AspectRatioFixed->True],
Cell[BoxData[{
\(Together[Sec[x]\^2 - Tan[x]]\), "\n",
\(Together[Sec[x]\^2 - Tan[x], Trig \[Rule] True]\)}], "Input",
AspectRatioFixed->True]
}, Closed]],
Cell[CellGroupData[{
Cell[TextData[" Wish I didn't know now what I didn't know then\n"], "Section",
Evaluatable->False,
AspectRatioFixed->True],
Cell[TextData[{
"Mathematica's memory for previous definitions can often lead to very \
confusing results. In particular, if you close one notebook and then begin \
to work with another, Mathematica still remembers the definitions made while \
you were working with the old notebook, which probably have nothing at all to \
do with the new notebook. Occasionally Mathematica seems not to forget old \
definitions even when you redefine things. It's a good idea, which I don't \
always follow myself, whenever you define a new function or use a new \
variable, to Clear[ ] it first.\n\n\nWhen you get strange results which are \
not at all what you expect:\n\n",
StyleBox["Clear[ ] functions and variables before using or defining them.\
\n\nCheck that you used the correct syntax for defining functions.\n\nIf \
things get really wierd, select \"quit kernel\" from the kernel menu, and",
FontWeight->"Bold"],
StyleBox[" then start over. This will cause ",
FontWeight->"Bold"],
StyleBox["Mathematica",
FontWeight->"Bold",
FontSlant->"Italic"],
StyleBox[" to forget all that you have told it.\n\nWhen all else fails, \
save your notebook to disk, quit Mathematica, and start over. This should \
hardly ever be necessary.",
FontWeight->"Bold"]
}], "Text",
Evaluatable->False,
AspectRatioFixed->True]
}, Closed]]
},
FrontEndVersion->"5.0 for Macintosh",
ScreenRectangle->{{55, 1440}, {0, 878}},
ScreenStyleEnvironment->"Presentation",
WindowToolbars->{"RulerBar", "EditBar"},
CellGrouping->Manual,
WindowSize->{910, 719},
WindowMargins->{{4, Automatic}, {Automatic, 1}},
PrivateNotebookOptions->{"ColorPalette"->{RGBColor, 128}},
ShowCellLabel->True,
ShowCellTags->False,
RenderingOptions->{"ObjectDithering"->True,
"RasterDithering"->False},
CharacterEncoding->"MacintoshAutomaticEncoding",
StyleDefinitions -> "Report.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[1754, 51, 200, 8, 242, "Title",
Evaluatable->False],
Cell[CellGroupData[{
Cell[1979, 63, 94, 2, 120, "Section",
Evaluatable->False],
Cell[2076, 67, 468, 17, 276, "Text",
Evaluatable->False]
}, Closed]],
Cell[CellGroupData[{
Cell[2581, 89, 109, 2, 82, "Section",
Evaluatable->False],
Cell[2693, 93, 455, 11, 172, "Text",
Evaluatable->False],
Cell[CellGroupData[{
Cell[3173, 108, 134, 4, 94, "Input"],
Cell[3310, 114, 164, 5, 117, "Input"]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[3523, 125, 107, 2, 120, "Section",
Evaluatable->False],
Cell[3633, 129, 337, 9, 100, "Text",
Evaluatable->False],
Cell[3973, 140, 94, 2, 44, "Input"],
Cell[4070, 144, 287, 7, 78, "Text",
Evaluatable->False],
Cell[4360, 153, 99, 4, 74, "Input"],
Cell[4462, 159, 540, 17, 100, "Text",
Evaluatable->False],
Cell[5005, 178, 88, 3, 58, "Input"],
Cell[5096, 183, 512, 16, 122, "Text",
Evaluatable->False],
Cell[5611, 201, 148, 6, 108, "Input"],
Cell[5762, 209, 335, 10, 78, "Text",
Evaluatable->False],
Cell[6100, 221, 147, 6, 108, "Input"],
Cell[6250, 229, 162, 4, 34, "Text",
Evaluatable->False]
}, Closed]],
Cell[CellGroupData[{
Cell[6449, 238, 113, 2, 54, "Section",
Evaluatable->False],
Cell[6565, 242, 311, 9, 78, "Text",
Evaluatable->False],
Cell[6879, 253, 148, 4, 60, "Input"],
Cell[7030, 259, 63, 2, 42, "Input"],
Cell[7096, 263, 177, 7, 56, "Text",
Evaluatable->False],
Cell[7276, 272, 71, 2, 42, "Input"],
Cell[7350, 276, 217, 7, 34, "Text",
Evaluatable->False],
Cell[CellGroupData[{
Cell[7592, 287, 163, 4, 81, "Input"],
Cell[7758, 293, 114, 3, 58, "Input"]
}, Open ]],
Cell[7887, 299, 289, 8, 56, "Text",
Evaluatable->False],
Cell[8179, 309, 73, 2, 42, "Input"],
Cell[8255, 313, 580, 17, 166, "Text",
Evaluatable->False],
Cell[8838, 332, 70, 2, 42, "Input"],
Cell[8911, 336, 263, 8, 34, "Text",
Evaluatable->False],
Cell[9177, 346, 153, 3, 66, "Input"]
}, Closed]],
Cell[CellGroupData[{
Cell[9367, 354, 126, 2, 54, "Section",
Evaluatable->False],
Cell[9496, 358, 1342, 25, 364, "Text",
Evaluatable->False]
}, Closed]]
}
]
*)
(*******************************************************************
End of Mathematica Notebook file.
*******************************************************************)