(* Content-type: application/mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 6.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 145, 7]
NotebookDataLength[ 60239, 1788]
NotebookOptionsPosition[ 54250, 1609]
NotebookOutlinePosition[ 54622, 1625]
CellTagsIndexPosition[ 54579, 1622]
WindowFrame->Normal
ContainsDynamic->False*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[TextData[{
StyleBox["Lab 00 - Introduction to Labs and ",
FontSize->18,
FontWeight->"Bold",
FontVariations->{"Underline"->True}],
StyleBox["Mathematica",
FontSize->18,
FontWeight->"Bold",
FontSlant->"Italic",
FontVariations->{"Underline"->True}],
"\nMath 2374 - University of Minnesota\nhttp://www.math.umn.edu/math2374\n\
Questions to: rogness@math.umn.edu"
}], "Text",
CellFrame->True,
TextAlignment->Center,
FontColor->GrayLevel[1],
Background->RGBColor[0, 0, 1]],
Cell[CellGroupData[{
Cell[TextData[StyleBox["Introduction to the Labs",
FontSize->16]], "Section"],
Cell[TextData[{
"This semester you will spend a significant amount of time working on the \
computers. We've written a number of labs which should help illustrate many \
of the concepts we'll talk about. Sometimes we'll use the computer to draw \
pretty pictures, which the computer is extremely good at, so you can \
understand a certain idea. Other times we'll give you an interesting problem \
to work on which includes some long and technical computations, and would \
therefore be difficult to do by hand; with the computer doing the number \
crunching (and sometimes even the calculus) for you, you can concentrate on \
understanding the ideas and not worrying about evaluating an ugly integral \
which requires three integration by parts, trigonometry substitutions, and an \
extra u-substitution for good measure.\n\nMost of the time you'll be using ",
StyleBox["Mathematica",
FontSlant->"Italic"],
", the program you're using to view this notebook right now. Because this \
is an Institute of Technology course, and nearly all of our students are \
enrolled in the IT, we'll assume a basic level of computer knowledge. \
Although we use Linux, which is quite different from Windows or Macintosh \
computers, the interface in ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" is very similar to most other applications you can run on any modern \
system. We won't assume you have a working knowledge of Linux, but once \
you're using ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" or a web browser, we expect that you will be comfortable working with \
pull-down menus, windows with scroll bars, etc. If you're worried about this \
you should talk to your TA and we'll try to help you improve your computer \
skills. For now all you have to do is read.\n\nAs you move on, you'll find \
there are commands in the lab for you to run. It would also be useful to \
open another notebook while you read the lab so that you can do your own work \
there. (Go to the File menu and choose \"New\" to do this.)\n\nThere are \
also a number of exercises for you to work on in the labs. To help you \
distinguish these from rhetorical questions, or things that we just want you \
to do on your own, we've formatted the labs so that \"official\" exercises \
are always in a box with a reddish background. (On some computers the \
background is more pink than red.) Here's an example:"
}], "Text"],
Cell[TextData[{
StyleBox["Fake Exercise 1",
FontSize->16,
FontWeight->"Bold"],
"\n\nIf this were a real exercise, this message would be followed by \
instructions about what to do..."
}], "Text",
CellFrame->True,
Background->RGBColor[1, 0.501961, 0.501961]],
Cell["\<\
Note that you won't always have to turn in every exercise, although it would \
be a good idea to work on all of them. Your TA will tell you at an \
appropriate time which solutions you need to hand in for each lab.
Usually we'll work on a different lab each week, but in general you'll only \
have to turn something in every two weeks. If you look on the syllabus \
you'll notice that most of the labs are in two pieces, as in \"Lab 2A\" and \
\"Lab 2B.\" This means you should hand in the exercises from these two labs \
together in one report. These lab assignments will be due the week after you \
work on them. For example, the exercises in labs 2A and 2B will be due in \
lab the next week, when you'll start working on lab 3. Your TA will \
generally remind you when labs are due, but if you have any questions you \
should ask.
There's another type of colored box that you'll see as well:\
\>", "Text"],
Cell["\<\
Boxes with a gray background generally contain important information, \
warnings about potential pitfalls, or hints on how to use certain commands.\
\>", "Text",
CellFrame->True,
Background->GrayLevel[0.849989]],
Cell["\<\
In fact, here's the first \"real\" gray box, with an important message that \
you should keep in mind throughout the semester:\
\>", "Text"],
Cell[TextData[{
StyleBox["The computer labs are an important part of this course!",
FontWeight->"Bold"],
" \n\nWith only two lectures per week, your instructors have to pick \
lecture material very carefully. Sometimes they might leave out certain \
concepts with the knowledge that they will be covered in the labs. In other \
words, these labs are one of the ways you will learn the material in this \
course.\n\nYou should also note that the lab assignments make up a \
significant part of your grade, so you should not take them lightly. Many of \
you probably never had to read your calculus book. At most, you may have \
glanced through the examples to find out how to do a certain homework \
problem. (Lest you think I'm accusing you, let me admit right now that I and \
most of your instructors probably did exactly the same thing in ",
StyleBox["our",
FontSlant->"Italic"],
" Calculus classes!) ",
"This approach will ",
StyleBox["not",
FontSlant->"Italic"],
" work well with these labs. If you look at the exercises first, you might \
find yourself completely lost. We ",
StyleBox["highly",
FontSlant->"Italic"],
" recommend you read each lab thoroughly before trying the exercises. In \
some cases this might mean re-reading a paragraph a number of times before it \
makes sense.\n\nYour solutions to lab exercises will be written up much more \
carefully than normal homework assignments. This isn't a writing-intensive \
course, so you don't have to turn in ten pages per problem, but we do expect \
clear writing, reasonable mathematical justification for your work, pictures, \
and so on. A good rule of thumb is that your solution should be a like a \
detailed textbook example. Your TA will show you examples of what we expect \
before you hand in your first lab assignment."
}], "Text",
CellFrame->True,
Background->GrayLevel[0.833326]],
Cell[TextData[{
"If you scroll down, you'll see that there doesn't seem to be much of \
anything there. That's because the other sections in this lab are ",
StyleBox["collapsed",
FontSlant->"Italic"],
". If you look on the right side of this window, you'll see that there are \
little blue lines which bracket the text and the colored boxes. These blue \
brackets represent ",
StyleBox["cells",
FontSlant->"Italic"],
", which are the basic units of a ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" notebook. Cells can contain things such as text, commands, formulas, and \
pictures. Cells can also be grouped together in sections, which is done by \
having a big bracket which includes all of the cells. You should see a long \
blue line to the right of all these cells; this is the \"section bracket.\"\n\
\nIf you were to double click on it, this Introduction would collapse. \
(Don't do this quite yet!) All you would see is the cell with the title of \
the section, the little blue bracket for that cell, and then another blue \
bracket to the right. This second bracket would have a little arrow on the \
bottom. Any time you see this arrow on a cell it means there are cells below \
which have been collapsed and are hidden from view. To get them back, you \
just double click on the outer bracket (the one with the arrow on it). Try \
collapsing this Introduction section, and then open it back up again. If you \
can't get it back, ask your TA for help.\n\nUsually when you open a lab, all \
of the sections (including the Introduction) will be collapsed. This lets \
you see sort of a \"Table of Contents\" so you know what you'll be doing. We \
left the introduction to this lab open so that you wouldn't open the first \
lab and not know what to do.\n\nOne last note before you start working: a few \
semesters ago we spent a lot of time revising these labs, and we'd really \
appreciate feedback from you. If you think a lab really helped you \
understand a topic, let us know. If you think a lab is boring and dull, and \
needs to be changed, tell us. (And you don't have to wait until the end of \
the semester to give us these comments.) We have lots of ideas about what \
should be done in the labs, but the final measure of success is whether or \
not you learn from them, so your opinion really does matter!\n\nNow you can \
go on to the actual lab. Remember, double click on the outer bracket of a \
section or sub-section to expand it."
}], "Text",
TextJustification->0]
}, Open ]],
Cell[CellGroupData[{
Cell[TextData[{
StyleBox["Introduction to ",
FontSize->16],
StyleBox["Mathematica",
FontSize->16,
FontSlant->"Italic"],
StyleBox[" - Arithmetic, Functions, and Graphs",
FontSize->16]
}], "Section"],
Cell[TextData[{
"As we alluded to above, ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" is a very powerful program. If you own a graphing calculator, you may as \
well put it away. Even a TI-89 or TI-92 is out of its league here. ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" can do everything they can do, and then some. And some more. And then a \
lot more. The purpose of this lab is to get you comfortable with ",
StyleBox["Mathematica",
FontSlant->"Italic"],
". We'll start with the easy stuff -- such as how to add two numbers -- and \
move on to more complicated things. In the next section we'll show you how \
to do single variable calculus with ",
StyleBox["Mathematica",
FontSlant->"Italic"],
", i.e. everything you learned how to do last year."
}], "Text"],
Cell[CellGroupData[{
Cell["Arithmetic and Variables", "Subsection"],
Cell[TextData[{
"As mentioned above, the basic unit of a ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" notebook is a ",
StyleBox["cell",
FontSlant->"Italic"],
". You're currently reading a text cell, which we can use to document what \
we're doing, but the real work is done in \"input\" cells. To run a command \
(or \"evaluate a cell\") you have to use the keyboard or the mouse to \
position the cursor anywhere in the input line and hit either (1) \
Shift+Enter, where \"Enter\" is the normal Enter key, or (2) the Enter key on \
the numeric keypad. If you use option (2), you do ",
StyleBox["not",
FontSlant->"Italic"],
" have to press the shift key. \n\nPractice by evaluating these cells:"
}], "Text"],
Cell[BoxData[
RowBox[{"2", "+", "2"}]], "Input"],
Cell[BoxData[
RowBox[{"35", "/", "7"}]], "Input"],
Cell[TextData[{
"From now on, whenever you run across a command as you read, you can assume \
it's meant as an example for you. You should evaluate it, even if you're not \
specifically told to do so.\n",
"\n",
StyleBox["Mathematica",
FontSlant->"Italic"],
" uses the normal operators +, -, /, and * for arithmetic operations, and ^ \
for exponents."
}], "Text"],
Cell[BoxData[{
RowBox[{"3", "*", "3"}], "\[IndentingNewLine]",
RowBox[{"3", " ", "^", "2"}]}], "Input"],
Cell[TextData[{
"As you can see, you can put multiple commands in a single input cell by \
hitting Enter (without the shift key!) and putting a new command on the next \
line. ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" will return the output in the same order. If you want to suppress the \
output of a command, put a semicolon after it. (If you use a semicolon, you \
can put the next command on the same line, so the third line of input here is \
valid:)"
}], "Text"],
Cell[BoxData[{
RowBox[{
RowBox[{"9", "/", "3"}], ";"}], "\[IndentingNewLine]",
RowBox[{"6", "^", "2"}]}], "Input"],
Cell[BoxData[
RowBox[{
RowBox[{"12", "*", "12"}], ";", " ",
RowBox[{"5", "+", "1"}], ";", " ",
RowBox[{"3", "/", "2"}]}]], "Input"],
Cell[TextData[{
StyleBox["Mathematica",
FontSlant->"Italic"],
" does most of its work symbolically, which is why the last output was a \
fraction instead of the decimal 1.5. Special constants like \[Pi] and \
\[ExponentialE] (the symbol for ",
StyleBox["e",
FontSlant->"Italic"],
") are treated as such; ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" does not replace \[Pi] with a number such as 3.14159. You can enter these \
constants like this:"
}], "Text"],
Cell[BoxData[{"Pi", "\[IndentingNewLine]", "E"}], "Input"],
Cell["\<\
You can use variables and assign values to them. For reasons that will be \
clear later, you should only use lower case letters in your variable names.\
\>", "Text"],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"a", "=", "2"}], ";", " ",
RowBox[{"b", "=", "3"}], ";"}],
" "}], "\[IndentingNewLine]", "a", "\[IndentingNewLine]", "b", "\
\[IndentingNewLine]",
RowBox[{"a", "+", "b"}]}], "Input"],
Cell["\<\
If you want to multiply variables be very careful to remember the * in \
between them.\
\>", "Text"],
Cell[BoxData[
RowBox[{"a", "*", "b"}]], "Input"],
Cell["\<\
Evaluate this next cell to see what happens if you forget the *.\
\>", "Text"],
Cell[BoxData["ab"], "Input"],
Cell[TextData[{
"Mathematica returns \"ab\" because there is nothing between the letters in \
the input cell, so it doesn't know you're trying to multiply two different \
variables together. Instead, it assumes you're asking for the value of a new \
variable named \"ab.\" You haven't given \"ab\" a value yet, so Mathematica \
just returns the variable itself.\n\nIf you're done using variables you can \
erase them from memory using the ",
StyleBox["Clear[ ]",
FontWeight->"Bold"],
" command. This is sometimes useful before you use variables, as well; you \
can clear them just in case they were used for something else before"
}], "Text",
CellChangeTimes->{{3.442061710034564*^9, 3.4420617103499947`*^9}}],
Cell[BoxData[
RowBox[{"Clear", "[",
RowBox[{"a", ",", "b"}], "]"}]], "Input"]
}, Closed]],
Cell[CellGroupData[{
Cell["Functions", "Subsection"],
Cell[TextData[{
"In order to do anything really interesting, we need to use functions. \
Functions which are part of ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" are always capitalized, and always use square brackets, [ and ], around \
their arguments. For example, here's the square root function:"
}], "Text"],
Cell[BoxData[
RowBox[{"Sqrt", "[", "5", "]"}]], "Input"],
Cell[TextData[{
"Remember, ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" does things symbolically unless we tell it otherwise, so it returns ",
Cell[BoxData[
FormBox[
SqrtBox["5"], TraditionalForm]]],
" instead of 2.23607. If you want to see a decimal approximation of a \
number, use the function ",
StyleBox["N",
FontWeight->"Bold"],
":"
}], "Text"],
Cell[BoxData[
RowBox[{"N", "[",
RowBox[{"Sqrt", "[", "5", "]"}], "]"}]], "Input"],
Cell["\<\
If you get an answer to a problem and want a numeric value for it, you don't \
have to type the answer again. You can use the symbol %, which refers back \
to the most recent output:\
\>", "Text"],
Cell[BoxData[
RowBox[{"Sqrt", "[", "10", "]"}]], "Input"],
Cell[BoxData[
RowBox[{"N", "[", "%", "]"}]], "Input"],
Cell[TextData[{
"The other way to force ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" to give you a decimal answer is to start out with a decimal number, i.e. \
\"5.0\" instead of \"5\" \[LongDash] in fact, you can simply type \"5.\" as \
shown here:"
}], "Text"],
Cell[BoxData[
RowBox[{"Sqrt", "[", "5.", "]"}]], "Input"],
Cell[TextData[{
"You could probably guess the names of some other common functions, such as \
",
StyleBox["Sin",
FontWeight->"Bold"],
", ",
StyleBox["Cos",
FontWeight->"Bold"],
", ",
StyleBox["Tan",
FontWeight->"Bold"],
", ",
StyleBox["Log",
FontWeight->"Bold"],
", and ",
StyleBox["Exp",
FontWeight->"Bold"],
". (For people who haven't taken computer science classes, Exp[number] is a \
common notation for ",
Cell[BoxData[
FormBox[
SuperscriptBox["e", "number"], TraditionalForm]]],
".) To see if you understand how to use functions, you should try to \
evaluate sine and cosine at 0, \[Pi]/2, and \[Pi] in another notebook \
window."
}], "Text"],
Cell[TextData[{
StyleBox["Warning!",
FontSize->14,
FontWeight->"Bold"],
" You must remember that ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" functions are capitalized and use ",
StyleBox["square",
FontWeight->"Bold"],
" brackets. Also remember that you ",
StyleBox["must",
FontWeight->"Bold"],
" capitalize Pi if you want the number \[Pi]. For example, all of these \
commands are incorrect:\n\n",
StyleBox["Sin(0)\ncos[0]\nTan[pi]\nsin(pi)",
FontFamily->"Courier",
FontWeight->"Bold"],
StyleBox["\n",
FontFamily->"Courier"],
"\nThe last one is really bad; there are ",
StyleBox["three",
FontSlant->"Italic"],
" mistakes! (See if you can find them.)\n\nForgetting to capitalize \
functions like ",
StyleBox["Sin",
FontWeight->"Bold"],
" and ",
StyleBox["Cos,",
FontWeight->"Bold"],
" and using ( ) instead of [ ], are ",
StyleBox["by far",
FontSlant->"Italic"],
" the most common mistakes students make well into the semester. During the \
first few weeks of the course, it's very common for people to call us to \
their computer and say, \"This isn't working,\" and the problem is that they \
typed ",
StyleBox["sin",
FontWeight->"Bold"],
" instead of ",
StyleBox["Sin",
FontWeight->"Bold"],
", or ",
StyleBox["Sin(Pi)",
FontWeight->"Bold"],
" instead of ",
StyleBox["Sin[Pi],",
FontWeight->"Bold"],
" etc. \n\nIf you have a problem with the computer, you should always feel \
free to ask us for help. Especially during these first few weeks, however, \
you will usually save yourself (and us) some time by carefully \
double-checking your brackets and capitalization; that's very likely the \
problem. We realize it takes a while to get use to how syntax-sensitive ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" is, but never fear\[LongDash]in a few weeks you will get used to the \
syntax and everything will go much smoother."
}], "Text",
CellFrame->True,
Background->GrayLevel[0.849989]],
Cell[TextData[{
"Some ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" functions can actually grind out algebra problems for you. For example, \
suppose you're trying to find the intersection of the parabola y=",
Cell[BoxData[
FormBox[
SuperscriptBox[
RowBox[{"(",
RowBox[{"x", "-", "1"}], ")"}], "2"], TraditionalForm]]],
"+2 with the line y = x + 5. You could set these two equations equal and \
solve for x, or you can have ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" do it for you: (Note that we have replaced = with ==. You must do this \
or ",
StyleBox["Solve",
FontWeight->"Bold"],
" won't work.)"
}], "Text"],
Cell[BoxData[
RowBox[{"Solve", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"x", "-", "1"}], ")"}], "^", "2"}], " ", "+", "2"}], " ",
"\[Equal]", " ",
RowBox[{"x", "+", "5"}]}], ",", " ", "x"}], "]"}]], "Input"],
Cell[TextData[{
"Another useful function is ",
StyleBox["Simplify",
FontWeight->"Bold"],
", which can take ugly expressions and make them much nicer."
}], "Text"],
Cell[BoxData[
RowBox[{
RowBox[{"6", "x",
RowBox[{
RowBox[{"(",
RowBox[{"x", "+", "2"}], ")"}], "/",
RowBox[{"Sqrt", "[", "2", "]"}]}]}], " ", "+",
RowBox[{
RowBox[{"(",
RowBox[{"6", "+", " ", "Pi"}], ")"}], "/",
RowBox[{"Sqrt", "[", "2", "]"}]}], "-",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", " ",
RowBox[{"Pi", "/", "2"}]}]}]], "Input"],
Cell[BoxData[
RowBox[{"Simplify", "[", "%", "]"}]], "Input"],
Cell[BoxData[
RowBox[{"Simplify", "[",
RowBox[{
RowBox[{
RowBox[{"Cos", "[", "x", "]"}], "^", "2"}], " ", "+", " ",
RowBox[{
RowBox[{"Sin", "[", "x", "]"}], "^", "2"}]}], "]"}]], "Input"],
Cell["\<\
Often we'll ask you to simplify your answers before you hand in an \
assignment. Even if we forget, you still should!\
\>", "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell["Documentation Center", "Subsection",
CellChangeTimes->{{3.4420617225899353`*^9, 3.442061727461833*^9}}],
Cell[TextData[{
"There is one very important resource for you, called the Help Browser. You \
can find it under the Help menu above. If you want to know how to do \
something you should check there first. Sometimes the help files are a \
little hard to understand, especially if you don't have much experience with \
",
StyleBox["Mathematica",
FontSlant->"Italic"],
", so you can always ask your TA for help. However, if you haven't looked \
it up, you should be prepared for us to answer with, \"Check the \
Documentation Center and let me know if it doesn't make sense.\"\n\nAs a \
test, open the Documentation Center and see if you can figure out how to get \
",
StyleBox["Mathematica ",
FontSlant->"Italic"],
"to find \[VerticalSeparator]x\[VerticalSeparator], the absolute value of x. \
(Suggestion: search for \"absolute value.\") Check your work by computing \
the absolute values of 3 and -3.\n\nHere's a tip: many pages in the \
Documentation Center include examples, which can be very instructive. To see \
these examples you have to click on the little triangles to expand those \
sections."
}], "Text",
CellChangeTimes->{{3.442061748495924*^9, 3.442061824378501*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["Defining your Own Functions", "Subsection"],
Cell[TextData[{
"Very often we'll want to work with our own functions, such as ",
Cell[BoxData[
FormBox[
RowBox[{
RowBox[{"f", "(", "x", ")"}], "=",
SuperscriptBox["x", "2"]}], TraditionalForm]]],
". We can do this by using the following input:"
}], "Text"],
Cell[BoxData[
RowBox[{
RowBox[{"f", "[", "x_", "]"}], "=",
RowBox[{"x", "^", "2"}]}]], "Input"],
Cell[TextData[{
"Note the underscore after the x on the left hand side. You ",
StyleBox["must",
FontSlant->"Italic"],
" include the underscore after the x on the left hand side inside the \
bracket, but you should ",
StyleBox["never",
FontSlant->"Italic"],
" include it on the right hand side! You don't really need to know the \
reason for this, but roughly speaking, the underscore tells ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" that the thing inside the brackets is a variable that can take on any \
value."
}], "Text"],
Cell[TextData[{
"Forgetting the underscore is another very common problem during the first \
month of the class. If you're having a problem with a function that you \
defined on your own, double check that you've used the underscore correctly. \
If you left out the underscore, you'll probably have to clear the variable \
name (as in ",
StyleBox["Clear[x]",
FontWeight->"Bold"],
") before redefining the function."
}], "Text",
CellFrame->True,
Background->GrayLevel[0.849989]],
Cell[TextData[{
"You can choose your own favorite name for a function when you define it, \
but you should only use lowercase letters. The reason for this, and for why \
we recommend you only use lowercase variables, is that all of the internal ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" functions are capitalized. If you only use lowercase functions, you don't \
have to worry about a conflict with something that is already defined.\n\n\
Once we've defined a function, we can do all sorts of cool things with it. \
You can input numbers or symbols -- or even whole expressions -- into a \
function:"
}], "Text"],
Cell[BoxData[{
RowBox[{"f", "[", "4", "]"}], "\[IndentingNewLine]",
RowBox[{"f", "[", "Pi", "]"}], "\[IndentingNewLine]",
RowBox[{"f", "[",
RowBox[{"(",
RowBox[{"1", "+", "t"}], ")"}], "]"}], "\[IndentingNewLine]",
RowBox[{"f", "[",
RowBox[{"Sin", "[",
RowBox[{"t", "*", "Pi"}], "]"}], "]"}]}], "Input"],
Cell[TextData[{
"Functions can have more than one argument, and in fact most of our \
functions this semester will. (Hence the name of the class, \"Multivariable \
Calculus.\") Also note that when you define a function, ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" returns the definition as output unless you use a semicolon after it:"
}], "Text"],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"g", "[",
RowBox[{"u_", ",", "v_"}], "]"}], "=",
RowBox[{"u", "/", "v"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"g", "[",
RowBox[{"2", ",", "3"}], "]"}], "\[IndentingNewLine]",
RowBox[{"g", "[",
RowBox[{
RowBox[{"5", "Pi"}], ",",
RowBox[{
RowBox[{"(",
RowBox[{"x", "-", "9"}], ")"}], "^", "6"}]}], "]"}]}], "Input"],
Cell[CellGroupData[{
Cell["Example", "Subsubsection"],
Cell[TextData[{
"It's not imperative that you do this problem, but if you have the time it \
would probably be very helpful. Recall that if you want to solve the \
equation ",
Cell[BoxData[
FormBox[
RowBox[{
RowBox[{
SuperscriptBox["ax", "2"], "+", "bx", " ", "+", " ", "c"}], " ", "=",
" ", "0"}], TraditionalForm]]],
", you can use the quadratic formula, which says \n\n",
StyleBox["x = ",
FontSize->14],
Cell[BoxData[
FormBox[
StyleBox[
FractionBox[
RowBox[{
RowBox[{"-", "b"}], " ", "\[PlusMinus]", " ",
FormBox[
SqrtBox[
FormBox[
RowBox[{
SuperscriptBox["b", "2"], "-",
RowBox[{"4", "ac"}]}],
TraditionalForm]],
TraditionalForm]}],
RowBox[{"2", "a"}]],
FontSize->18], TraditionalForm]]],
". \n\nDefine a function f[a_,b_,c_] which returns one root, and another \
function g[a_,b_,c_] which returns the other root. (There are two roots \
because of the \[PlusMinus] sign.) To see if you've done everything \
correctly, try to find the two roots of ",
Cell[BoxData[
FormBox[
RowBox[{
RowBox[{
RowBox[{"2",
SuperscriptBox["x", "2"]}], "+",
RowBox[{"8", "x"}], "-", "1"}], "=", "0"}], TraditionalForm]]],
". (The numeric approximations of the roots, found using the ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" function ",
StyleBox["N[ ]",
FontWeight->"Bold"],
", are -4.12132 and 0.12132.)"
}], "Text"]
}, Open ]]
}, Closed]],
Cell[CellGroupData[{
Cell["Vectors", "Subsection"],
Cell[TextData[{
"Depending on your textbooks, you have probably seen vectors written in \
various ways, such as (1,2), ",
Cell[BoxData[
FormBox[
OverscriptBox[
RowBox[{"(",
RowBox[{"1", ",", "2"}], ")"}], "\[RightVector]"], TraditionalForm]]],
", or \[LeftAngleBracket]1,2\[RightAngleBracket]. In ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" vectors are written with curly brackets. Here we define two vectors, ",
Cell[BoxData[
FormBox[
OverscriptBox["v", "\[RightVector]"], TraditionalForm]]],
" and ",
Cell[BoxData[
FormBox[
OverscriptBox["u", "\[RightVector]"], TraditionalForm]]],
". We add them, we multiply ",
Cell[BoxData[
FormBox[
OverscriptBox["v", "\[RightVector]"], TraditionalForm]]],
" by a scalar number, and we compute the dot product ",
Cell[BoxData[
FormBox[
OverscriptBox["v", "\[RightVector]"], TraditionalForm]]],
"\[CenterDot]",
Cell[BoxData[
FormBox[
OverscriptBox["u", "\[RightVector]"], TraditionalForm]]],
". (The dot product is written as a period.) Make sure the output here \
makes sense to you. Note that we've used semicolons after the definition \
of",
Cell[BoxData[
FormBox[
OverscriptBox["v", "\[RightVector]"], TraditionalForm]]],
" and ",
Cell[BoxData[
FormBox[
OverscriptBox["u", "\[RightVector]"], TraditionalForm]]],
", so they are not displayed."
}], "Text"],
Cell[BoxData[{
RowBox[{
RowBox[{"v", "=",
RowBox[{"{",
RowBox[{"1", ",", "2"}], "}"}]}], ";", " ",
RowBox[{"u", "=",
RowBox[{"{",
RowBox[{"4", ",", "4"}], "}"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"v", "+", "u"}], "\[IndentingNewLine]",
RowBox[{"2", "v"}], "\[IndentingNewLine]",
RowBox[{"v", ".", "u"}]}], "Input"],
Cell[TextData[{
"Three-dimensional vectors are possible, and in fact we can make a vector \
with as many dimensions as we like. Here is a three dimensional vector, and \
two nine dimensional vectors as well. To see that ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" actually treats these as vectors, you should insert a command into this \
cell to compute ",
Cell[BoxData[
FormBox[
RowBox[{
OverscriptBox["v", "\[RightVector]"], "\[CenterDot]",
OverscriptBox["w", "\[RightVector]"]}], TraditionalForm]]],
"."
}], "Text"],
Cell[BoxData[{
RowBox[{"u", "=",
RowBox[{"{",
RowBox[{"4", ",", "2", ",",
RowBox[{"-", "1"}]}], "}"}]}], "\[IndentingNewLine]",
RowBox[{"v", "=",
RowBox[{"{",
RowBox[{
"1", ",", "2", ",", "3", ",", "4", ",", "5", ",", "6", ",", "7", ",", "8",
",", "9"}], "}"}]}], "\[IndentingNewLine]",
RowBox[{"w", "=",
RowBox[{"{",
RowBox[{
"0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0",
",", "1"}], "}"}]}]}], "Input"],
Cell[TextData[{
StyleBox["Review of Brackets in ",
FontWeight->"Bold"],
StyleBox["Mathematica",
FontWeight->"Bold",
FontSlant->"Italic"],
"\n\nRemember, using the wrong kind of brackets is the number one cause of \
problems for most students. To help you keep them straight, let's review:\n\n\
",
StyleBox["( and )",
FontWeight->"Bold"],
" : used to enter mathematical expressions, e.g. (x+1)^2, or 1/(x-2).\n\n",
StyleBox["[ and ]",
FontWeight->"Bold"],
" : used with functions, e.g. f[x_] = x^2, or Sin[x].\n\n",
StyleBox["{ and }",
FontWeight->"Bold"],
" : used to denote vectors, e.g. {2,-3}, or {x, Sin[x]}.\n\n(The last \
example is a ",
StyleBox["vector-valued function",
FontSlant->"Italic"],
", a function of x whose value is a vector.)"
}], "Text",
CellFrame->True,
Background->GrayLevel[0.849989]]
}, Closed]],
Cell[CellGroupData[{
Cell["Loading New Commands", "Subsection"],
Cell[TextData[{
StyleBox["Mathematica",
FontSlant->"Italic"],
" has so many commands that some computers would slow to a crawl if \
everything were automatically loaded. To make things a little faster, many \
commands in ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" are contained in \"packages.\" Occasionally this semester we're going to \
use some of these commands. Rather than have you learn the complexities of \
loading packages, we've assembled everything into one notebook, called \
\"math2374.nb,\" which contains commands which automatically load every \
package we'll need this semester.\n\nThere aren't any extra packages required \
for this lab, so you don't need the math2374.nb file yet. Later this \
semester your TA will show you how to download and run the file. For the \
record, you can follow these directions:\n\n(1) Download math2374.nb from the \
course web page.\n\n(2) Open math2374.nb in ",
StyleBox["Mathematica",
FontSlant->"Italic"],
". Do this now by choosing \"Open\" under the File menu.\n\n(3) Click on \
the button which says, \"Click here to Load the Math 2374 Commands.\"\n\nOnce \
everything works, a gray box will appear with a confirmation message. At \
this point you can close math2374.nb if you like, to avoid cluttering up your \
mailbox. Don't bother saving the changes; the only change is the appearance \
of the box, and you probably don't want to save multiple copies of that \
anyway!"
}], "Text",
CellChangeTimes->{{3.409325295117556*^9, 3.40932529534059*^9}, {
3.40932550459217*^9, 3.409325644999607*^9}, {3.409326226786976*^9,
3.409326228842386*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["Drawing Graphs", "Subsection"],
Cell[TextData[{
"There are ",
StyleBox["many",
FontSlant->"Italic"],
" commands you can use to produce pictures in ",
StyleBox["Mathematica",
FontSlant->"Italic"],
". Today we're going to learn two of them, and you will be introduced to \
others in the rest of lab 1 and in lab 2.\n\nIf we have a function y=f(x), \
the easiest way to graph it is with the ",
StyleBox["Plot",
FontWeight->"Bold"],
" command. The syntax is ",
StyleBox["Plot[",
FontWeight->"Bold"],
" function, {x, xmin, xmax}",
StyleBox["]",
FontWeight->"Bold"],
". Note that expressions such as {x, xmin, xmax} will be very common this \
semester. Basically it means you want to let x range from xmin to xmax."
}], "Text"],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"f", "[", "x_", "]"}], "=",
RowBox[{"x", "^", "2"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"f", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "1"}], ",", "3"}], "}"}]}], "]"}]}], "Input"],
Cell[TextData[{
"You don't have to name a function before you can graph it. You can simply \
enter the function into the ",
StyleBox["Plot",
FontWeight->"Bold"],
" command."
}], "Text"],
Cell[BoxData[
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"x", " ", "*",
RowBox[{"Sin", "[",
RowBox[{"1", "/", "x"}], "]"}]}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "0.3"}], ",", "0.3"}], "}"}]}], "]"}]], "Input"],
Cell["You can name plots so you can refer to them later as well:", "Text"],
Cell[BoxData[{
RowBox[{"plot1", "=",
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"Sin", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",", "0", ",",
RowBox[{"2", "Pi"}]}], "}"}]}], "]"}]}], "\[IndentingNewLine]",
RowBox[{"plot2", "=",
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"Cos", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",", "0", ",",
RowBox[{"2", "Pi"}]}], "}"}]}], "]"}]}]}], "Input"],
Cell[TextData[{
"If you end a ",
StyleBox["Plot",
FontWeight->"Bold"],
" command with a semi-colon, ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" will create the graph, but the output will be surpressed. This is useful \
if you want to construct multiple graphs for later use. For example, here \
are the same ",
StyleBox["Plot",
FontWeight->"Bold"],
" commands from above, with semi-colons instead."
}], "Text",
CellChangeTimes->{{3.409325676056955*^9, 3.409325778104255*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"plot1", "=",
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"Sin", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",", "0", ",",
RowBox[{"2", "Pi"}]}], "}"}]}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"plot2", "=",
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"Cos", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",", "0", ",",
RowBox[{"2", "Pi"}]}], "}"}]}], "]"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.409325765388139*^9, 3.409325765566768*^9}}],
Cell[TextData[{
"If you later decide you actually wanted to see the first graph, just ask ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" to show you plot1:"
}], "Text",
CellChangeTimes->{{3.409325788941339*^9, 3.409325809621117*^9}}],
Cell[BoxData["plot1"], "Input",
CellChangeTimes->{{3.409325783696211*^9, 3.409325785322375*^9}}],
Cell[TextData[{
"You can also use the ",
StyleBox["Show",
FontWeight->"Bold"],
" command:"
}], "Text",
CellChangeTimes->{{3.409325820715033*^9, 3.409325826541169*^9}}],
Cell[BoxData[
RowBox[{"Show", "[", "plot2", "]"}]], "Input",
CellChangeTimes->{{3.409325828041954*^9, 3.409325829866596*^9}}],
Cell[TextData[{
"The ",
StyleBox["Show",
FontWeight->"Bold"],
" command is also useful for combined different graphs. You can give the \
command the names of multiple plots, and it will show them together:"
}], "Text",
CellChangeTimes->{{3.409325779572087*^9, 3.409325782045253*^9}, {
3.409325814487222*^9, 3.409325856085892*^9}}],
Cell[BoxData[
RowBox[{"Show", "[",
RowBox[{"plot1", ",", "plot2"}], "]"}]], "Input",
CellChangeTimes->{{3.409325343449441*^9, 3.409325351652108*^9}}],
Cell[CellGroupData[{
Cell[TextData[StyleBox["Options",
FontWeight->"Bold"]], "Subsubsection"],
Cell[TextData[{
"Occasionally you will want to use optional arguments when drawing graphs. \
Options generally come at the end of a command and have the form \"OptionName\
\[RightArrow]Setting.\" [You can type the \[RightArrow] as (hyphen)(greater \
than), \[Dash]\[Succeeds]]. For example, the option Axes\[RightArrow]False \
will prevent ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" from showing the x- and y- axes in a graph. This option works with ",
StyleBox["Plot",
FontWeight->"Bold"],
" and ",
StyleBox["Show",
FontWeight->"Bold"],
". Try adding it to the ",
StyleBox["Show",
FontWeight->"Bold"],
" command above and re-evaluating it. (You need to add a comma after \
\"plot2\" before you can add the option.) Did the axes disappear?\n\nYou'll \
learn more options in Lab 1B next week."
}], "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell["Plotting Implicit Functions", "Subsubsection"],
Cell[TextData[{
"In order to use ",
StyleBox["Plot",
FontWeight->"Bold"],
", you need to be able to solve your equation for y. If you want to graph \
an equation such as ",
Cell[BoxData[
FormBox[
RowBox[{
RowBox[{
RowBox[{
SuperscriptBox["x", "2"], "+",
SuperscriptBox["y", "2"]}], "=", "1"}], ","}], TraditionalForm]]],
" we need to use something different. You might recall that equations like \
these are called ",
StyleBox["implicit",
FontSlant->"Italic"],
" functions, because we can't ",
StyleBox["explicitly",
FontSlant->"Italic"],
" solve for y in terms of x. If you try to solve this equation for y, you \
get y = \[PlusMinus]",
Cell[BoxData[
FormBox[
SqrtBox[
RowBox[{"1", "-",
SuperscriptBox["x", "2"]}]], TraditionalForm]]],
", and ",
StyleBox["Plot",
FontWeight->"Bold"],
" will complain if you give it a function with a \[PlusMinus] in it. (Try \
it and see! You can copy and paste the function into a ",
StyleBox["Plot",
FontWeight->"Bold"],
" command, so you don't have to figure out how to type the \[PlusMinus] \
symbol.)\n\nTo plot the graph of an implicit function we can use a command \
called ",
StyleBox["ContourPlot",
FontWeight->"Bold"],
". (In older editions of Mathematica implicit functions were graphed with \
",
StyleBox["ImplicitPlot",
FontWeight->"Bold"],
", whose name made more sense, but nowadays ",
StyleBox["ImplicitPlot",
FontWeight->"Bold"],
" is obsolete.)"
}], "Text",
CellChangeTimes->{{3.409325380082925*^9, 3.409325488583071*^9}}],
Cell[BoxData[
RowBox[{"ContourPlot", "[",
RowBox[{
RowBox[{
RowBox[{
SuperscriptBox["x", "2"], "+",
SuperscriptBox["y", "2"]}], "\[Equal]", "1"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "1"}], ",", "1"}], "}"}], ",",
RowBox[{"{",
RowBox[{"y", ",",
RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "]"}]], "Input"],
Cell[TextData[{
"The syntax is very similar to the ",
StyleBox["Plot",
FontWeight->"Bold"],
" command, except you have to give ranges for both x and y! Also notice \
that the equal sign in the original equation is replaced by == when you type \
the function into the ",
StyleBox["ImplicitPlot",
FontWeight->"Bold"],
" command.\n\nTo test yourself, try to plot the ellipse given by the \
following equation:"
}], "Text"],
Cell[BoxData[
RowBox[{
RowBox[{
FractionBox[
SuperscriptBox["x", "2"],
SuperscriptBox["3", "2"]], "+",
FractionBox[
RowBox[{" ",
SuperscriptBox["y", "2"]}],
SuperscriptBox["4", "2"]]}], "=", " ", "1"}]], "DisplayFormula"]
}, Closed]]
}, Open ]],
Cell[CellGroupData[{
Cell["Saving Notebooks", "Subsection"],
Cell[TextData[{
"Once you're finished working, you'll usually want to save your notebook so \
you don't lose your work. You can do this through the File menu with either \
\"Save\" or \"Save As.\" ",
StyleBox["Please note",
FontWeight->"Bold"],
": output, and particularly graphics output, takes up a tremendous amount \
of disk space and, if you save notebooks with graphics, they will quickly get \
to be so large that you will use up your disk quota and be barred from using \
the computer. This is especially true in later labs, where we will create \
animations. If you save a notebook with an animation, it can take up several \
megabytes of disk space.\n\nSo, before you save a notebook, you should always \
go to the Cell menu and choose \"Delete All output.\" This will leave all of \
your commands intact, but delete all of the answers and graphics from ",
StyleBox["Mathematica",
FontSlant->"Italic"],
". If you load a notebook that was saved after deleting all output, you can \
run all of the commands automatically by going to the Kernel menu again and \
choosing Evaluation : Evaluate Notebook."
}], "Text",
CellChangeTimes->{{3.409326098816974*^9, 3.409326116213823*^9}}]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell[TextData[StyleBox["Single Variable Calculus with Mathematica",
FontSize->16]], "Section"],
Cell[TextData[{
"Some of what we'll do this semester in Multivariable calculus is more or \
less the same as what you learned to do last year with functions of one \
variable. In the last part of this introduction we'll show you how to use ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" to do single variable calculus."
}], "Text"],
Cell[CellGroupData[{
Cell["Limits", "Subsection"],
Cell[TextData[{
"You should have learned something about limits during your first year of \
calculus. We won't focus on them very much this year, but in a few weeks \
you'll have to use them to compute so-called \"partial derivatives\" by the \
definition. ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" can compute limits using a function named, not surprisingly, ",
StyleBox["Limit",
FontWeight->"Bold"],
".\n\nFirst let's define a function and plot its graph around x=0."
}], "Text"],
Cell[BoxData[{
RowBox[{
RowBox[{"f", "[", "x_", "]"}], "=",
RowBox[{
RowBox[{"Sin", "[", "x", "]"}], "/", "x"}]}], "\[IndentingNewLine]",
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"f", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "Pi"}], ",", "Pi"}], "}"}]}], "]"}]}], "Input"],
Cell[TextData[{
"Although you can't tell by looking at the graph, you know that f[0] is \
undefined because you can't divide by zero. The limit of this function as x\
\[RightArrow]0 is a very important limit in calculus; your teacher may have \
spent a fair amount of time proving that it's equal to one. ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" can compute this very quickly:"
}], "Text"],
Cell[BoxData[
RowBox[{"Limit", "[",
RowBox[{
RowBox[{"f", "[", "x", "]"}], ",",
RowBox[{"x", "->", "0"}]}], "]"}]], "Input"],
Cell[TextData[{
"We need to be a little careful because ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" isn't really computing a two-sided limit. In this limit it didn't matter \
because, as you can see by examining the picture, the limit is equal to 1 \
whether you approach x=0 from the left side or from the right side. Let's \
look at a function where it ",
StyleBox["will",
FontSlant->"Italic"],
" matter!"
}], "Text"],
Cell[BoxData[{
RowBox[{
RowBox[{"f", "[", "x_", "]"}], "=",
RowBox[{
RowBox[{"Abs", "[", "x", "]"}], "/", "x"}]}], "\[IndentingNewLine]",
RowBox[{"Plot", "[",
RowBox[{
RowBox[{"f", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"-", "1"}], ",", "1"}], "}"}]}], "]"}]}], "Input"],
Cell[TextData[{
"First, you should look at the function definition and its graph to make \
sure you understand what's going on; f(x) = 1 whenever x is positive, f(x) = \
-1 whenever x is negative, and f(0) is undefined. Now check what ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" thinks the limit of f(x) is as x\[RightArrow]0:"
}], "Text"],
Cell[BoxData[
RowBox[{"Limit", "[",
RowBox[{
RowBox[{"f", "[", "x", "]"}], ",",
RowBox[{"x", "\[Rule]", "0"}]}], "]"}]], "Input"],
Cell[TextData[{
"So you can see that, by default, ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" computes limits by approaching from the right hand side. You should use \
the Help Browser to find out how to compute this limit from the left hand \
side, so the answer is -1. (Look up \"limit.\")"
}], "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell["Derivatives", "Subsection"],
Cell[TextData[{
StyleBox["Mathematica",
FontSlant->"Italic"],
" can differentiate just about everything you can throw at it. There are a \
few different commands you can use, but the easiest is just named ",
StyleBox["D",
FontWeight->"Bold"],
"."
}], "Text"],
Cell[BoxData[
RowBox[{"D", "[",
RowBox[{
RowBox[{"x", "^", "6"}], ",", " ", "x"}], "]"}]], "Input"],
Cell[TextData[{
"The first argument of ",
StyleBox["D",
FontWeight->"Bold"],
" is the function you wish to differentiate. The second argument is the \
variable. Obviously in this example it's clear that the variable has to be \
x, but you need to tell ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" anyway. Here's an example where ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" will automatically do the product and quotient rules for you:"
}], "Text"],
Cell[BoxData[{
RowBox[{
RowBox[{"f", "[", "x_", "]"}], "=",
RowBox[{
RowBox[{"Sin", "[", "x", "]"}],
RowBox[{
RowBox[{"Cos", "[",
RowBox[{"-",
RowBox[{"x", "^", "2"}]}], "]"}], "/",
RowBox[{"ArcTan", "[",
RowBox[{"1", "/", "x"}], "]"}]}]}]}], "\[IndentingNewLine]",
RowBox[{"D", "[",
RowBox[{
RowBox[{"f", "[", "x", "]"}], ",", "x"}], "]"}]}], "Input"],
Cell[TextData[{
"That's fairly ugly, and this is a good example of when you should try to \
use ",
StyleBox["Simplify",
FontWeight->"Bold"],
" to make your answers nicer. (In this case, it turns out, it doesn't help \
much.)\n\n",
StyleBox["D",
FontWeight->"Bold"],
" can also do multiple derivatives. If you want the ",
Cell[BoxData[
FormBox[
SuperscriptBox["n", "th"], TraditionalForm]]],
"derivative with respect to x, replace the argument \"x\" with {x,n}:"
}], "Text"],
Cell[BoxData[
RowBox[{"D", "[",
RowBox[{
RowBox[{"x", "^", "6"}], ",",
RowBox[{"{",
RowBox[{"x", ",", "3"}], "}"}]}], "]"}]], "Input"],
Cell[BoxData[
RowBox[{"D", "[",
RowBox[{
RowBox[{"Log", "[", "x", "]"}], ",",
RowBox[{"{",
RowBox[{"x", ",", "4"}], "}"}]}], "]"}]], "Input"],
Cell["\<\
If you have a function of one variable, you can also use the \"prime\" \
notation as a shortcut to compute derivatives:\
\>", "Text",
CellChangeTimes->{{3.40932591268033*^9, 3.409325941129724*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"f", "[", "x_", "]"}], "=",
RowBox[{"x", "^", "4"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"f", "'"}], "[", "x", "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"f", "''"}], "[", "x", "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"f", "'''"}], "[", "x", "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"f", "''''"}], "[", "x", "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"f", "'''''"}], "[", "x", "]"}]}], "Input",
CellChangeTimes->{{3.409325942537409*^9, 3.409325963244009*^9}}],
Cell["\<\
Most of the functions in this class will have more than one variable, so this \
shortcut isn't always useful.\
\>", "Text",
CellChangeTimes->{{3.409325988700607*^9, 3.40932600310342*^9}}]
}, Closed]],
Cell[CellGroupData[{
Cell["Integration", "Subsection"],
Cell[TextData[{
StyleBox["Mathematica",
FontSlant->"Italic"],
" can do both indefinite and definite integrals using the same command, ",
StyleBox["Integrate",
FontWeight->"Bold"],
". ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" will automatically try u-substitutions, perform integration by parts, and \
do all kinds of other tricks. For example, to compute\n\n\t\t",
Cell[BoxData[
FormBox[
RowBox[{"\[Integral]",
RowBox[{
SuperscriptBox["x", "2"],
RowBox[{"Sin", "[", "x", "]"}],
RowBox[{"\[DifferentialD]", "x"}]}]}], TraditionalForm]],
FontSize->16],
"\n\nyou would type:"
}], "Text"],
Cell[BoxData[
RowBox[{"Integrate", "[",
RowBox[{
RowBox[{
RowBox[{"x", "^", "2"}], " ",
RowBox[{"Sin", "[", "x", "]"}]}], ",", "x"}], "]"}]], "Input"],
Cell[TextData[{
"But if you wanted to compute the definite integral\n\n\t\t",
Cell[BoxData[
FormBox[
RowBox[{
SubsuperscriptBox["\[Integral]", "0", "\[Pi]"],
RowBox[{
SuperscriptBox["x", "2"],
RowBox[{"Sin", "[", "x", "]"}],
RowBox[{"\[DifferentialD]", "x"}]}]}], TraditionalForm]],
FontSize->16],
"\n"
}], "Text"],
Cell["you would replace \"x\" with \"{x,0,Pi}\":", "Text"],
Cell[BoxData[
RowBox[{"Integrate", "[",
RowBox[{
RowBox[{
RowBox[{"x", "^", "2"}], " ",
RowBox[{"Sin", "[", "x", "]"}]}], ",", " ",
RowBox[{"{",
RowBox[{"x", ",", "0", ",", "Pi"}], "}"}]}], "]"}]], "Input"]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell[TextData[StyleBox["Pseudo-Exercises",
FontSize->16]], "Section"],
Cell[TextData[{
"These are some exercises from single variable calculus for you to work on \
so that you get used to the commands you've learned above. It's one thing to \
read about ",
StyleBox["Integrate",
FontWeight->"Bold"],
" or ",
StyleBox["Plot",
FontWeight->"Bold"],
"; it's another to use them. You do ",
StyleBox["not",
FontSlant->"Italic"],
" have to turn these problems in. We're not interested in seeing if you can \
do single variable calculus. (Or, more accurately, we're already assuming \
you can, and if you can't you should talk to us quickly. A little rust is \
ok, but if you don't know what a tangent line is, we may have a problem.)\n\n\
When you are done with these exercises, you are finished, and you can start \
Lab 1B if you wish. (But tell your TA you are finished, and s/he might ask \
to see your work for these exercises and the tasks given in the text of the \
lab above.)"
}], "Text"],
Cell[TextData[{
StyleBox["Exercise 1",
FontSize->14,
FontWeight->"Bold"],
"\n\nThere are two points on the circle ",
Cell[BoxData[
FormBox[
RowBox[{
RowBox[{
SuperscriptBox["x", "2"], "+",
SuperscriptBox["y", "2"]}], "=", "4"}], TraditionalForm]]],
" where y = 1/2. Find those points, and then find the lines which are \
tangent to the circle at those two points. Graph the circle along with the \
two lines to verify that they are indeed tangent. \n\nYou may use ",
StyleBox["Solve",
FontWeight->"Bold"],
" to find the points, or do it by hand if you wish. It's probably easiest \
to find the equations to the tangent lines by hand. You will have to use ",
StyleBox["ContourPlot",
FontWeight->"Bold"],
" to graph the circle, and you can use ",
StyleBox["Plot",
FontWeight->"Bold"],
" to plot the lines. Then you can use ",
StyleBox["Show",
FontWeight->"Bold"],
" to display all three graphs together.\n\n",
StyleBox["Exercise 2",
FontSize->14,
FontWeight->"Bold"],
StyleBox["\n",
FontSize->14],
"\nConsider the following functions:\n\nf(x) = 4 + ",
Cell[BoxData[
FormBox[
RowBox[{"Sin", "[",
RowBox[{"\[Pi]", " ", "x"}], "]"}], TraditionalForm]]],
" / 2\n\ng(x) = ",
Cell[BoxData[
FormBox[
SuperscriptBox[
RowBox[{"(",
RowBox[{"x", "-", "2"}], ")"}], "2"], TraditionalForm]]],
"\n\nFind the area of the region enclosed by the graphs of these two \
functions.\n\nHint: First you need to find the points where the graphs of f \
and g intersect. ",
StyleBox["Solve",
FontWeight->"Bold"],
" doesn't help here, because it doesn't work with trigonometric functions. \
You should plot both functions, see if you can estimate visually where the \
graphs intersect, and then verify this by plugging in the appropriate values \
of x into f and g. Then you need to use ",
StyleBox["Integrate",
FontWeight->"Bold"],
" to find the area."
}], "Text",
CellFrame->True,
CellChangeTimes->{{3.442061837744852*^9, 3.442061839378462*^9}},
Background->GrayLevel[0.849989]],
Cell[CellGroupData[{
Cell["Credits", "Subsection"],
Cell[TextData[{
"This lab was written entirely from scratch in January 2002. Our previous \
Lab 1 started with three dimensional graphs and went from there, without much \
of an introduction to ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" itself. (And students who had lab before lecture didn't know what a 3D \
plot was, anyway.) I made minor modifications in January 2004 to reflect the \
changes in lab exercises and the use of math2374.nb. More modifications were \
made in January 2007 to make the lab compatible with ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" 6.0.\n\nThis lab is copyright 2002, 2004 by Jonathan Rogness \
(rogness@math.umn.edu) and is protected by the Creative Commons \
Attribution-NonCommercial-ShareAlike License. You can find more information \
on this license at http://creativecommons.org/licenses/by-nc-sa/1.0/\n\n\
Although it's not specifically required by the license, I'd appreciate it if \
you let me know if you use parts of our labs, just so I can keep track of it. \
Please send me any questions or comments!"
}], "Text",
CellChangeTimes->{{3.409326036662891*^9, 3.40932605253547*^9}}]
}, Closed]]
}, Closed]]
},
ScreenStyleEnvironment->"Working",
WindowSize->{607, 692},
WindowMargins->{{36, Automatic}, {Automatic, 10}},
FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (April 20, 2007)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)
(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[568, 21, 491, 16, 93, "Text"],
Cell[CellGroupData[{
Cell[1084, 41, 78, 1, 63, "Section"],
Cell[1165, 44, 2423, 38, 416, "Text"],
Cell[3591, 84, 265, 8, 76, "Text"],
Cell[3859, 94, 929, 16, 191, "Text"],
Cell[4791, 112, 223, 5, 57, "Text"],
Cell[5017, 119, 150, 3, 41, "Text"],
Cell[5170, 124, 1886, 34, 342, "Text"],
Cell[7059, 160, 2528, 40, 446, "Text"]
}, Open ]],
Cell[CellGroupData[{
Cell[9624, 205, 208, 8, 63, "Section"],
Cell[9835, 215, 802, 18, 101, "Text"],
Cell[CellGroupData[{
Cell[10662, 237, 46, 0, 34, "Subsection"],
Cell[10711, 239, 729, 16, 131, "Text"],
Cell[11443, 257, 49, 1, 27, "Input"],
Cell[11495, 260, 50, 1, 27, "Input"],
Cell[11548, 263, 369, 9, 71, "Text"],
Cell[11920, 274, 106, 2, 43, "Input"],
Cell[12029, 278, 485, 10, 71, "Text"],
Cell[12517, 290, 119, 3, 43, "Input"],
Cell[12639, 295, 140, 4, 27, "Input"],
Cell[12782, 301, 478, 13, 56, "Text"],
Cell[13263, 316, 58, 0, 43, "Input"],
Cell[13324, 318, 176, 3, 41, "Text"],
Cell[13503, 323, 238, 7, 73, "Input"],
Cell[13744, 332, 110, 3, 26, "Text"],
Cell[13857, 337, 49, 1, 27, "Input"],
Cell[13909, 340, 88, 2, 26, "Text"],
Cell[14000, 344, 28, 0, 27, "Input"],
Cell[14031, 346, 718, 12, 131, "Text"],
Cell[14752, 360, 81, 2, 27, "Input"]
}, Closed]],
Cell[CellGroupData[{
Cell[14870, 367, 31, 0, 26, "Subsection"],
Cell[14904, 369, 324, 7, 65, "Text"],
Cell[15231, 378, 57, 1, 31, "Input"],
Cell[15291, 381, 373, 13, 68, "Text"],
Cell[15667, 396, 85, 2, 31, "Input"],
Cell[15755, 400, 208, 4, 47, "Text"],
Cell[15966, 406, 58, 1, 31, "Input"],
Cell[16027, 409, 54, 1, 31, "Input"],
Cell[16084, 412, 273, 7, 47, "Text"],
Cell[16360, 421, 58, 1, 31, "Input"],
Cell[16421, 424, 678, 25, 83, "Text"],
Cell[17102, 451, 1976, 59, 448, "Text"],
Cell[19081, 512, 659, 20, 101, "Text"],
Cell[19743, 534, 268, 9, 31, "Input"],
Cell[20014, 545, 167, 5, 47, "Text"],
Cell[20184, 552, 390, 13, 31, "Input"],
Cell[20577, 567, 61, 1, 31, "Input"],
Cell[20641, 570, 206, 6, 31, "Input"],
Cell[20850, 578, 142, 3, 47, "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell[21029, 586, 110, 1, 26, "Subsection"],
Cell[21142, 589, 1196, 22, 206, "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell[22375, 616, 49, 0, 26, "Subsection"],
Cell[22427, 618, 275, 8, 47, "Text"],
Cell[22705, 628, 101, 3, 31, "Input"],
Cell[22809, 633, 547, 14, 101, "Text"],
Cell[23359, 649, 486, 11, 117, "Text"],
Cell[23848, 662, 629, 11, 155, "Text"],
Cell[24480, 675, 324, 8, 92, "Input"],
Cell[24807, 685, 360, 7, 83, "Text"],
Cell[25170, 694, 400, 13, 72, "Input"],
Cell[CellGroupData[{
Cell[25595, 711, 32, 0, 30, "Subsubsection"],
Cell[25630, 713, 1477, 47, 222, "Text"]
}, Open ]]
}, Closed]],
Cell[CellGroupData[{
Cell[27156, 766, 29, 0, 26, "Subsection"],
Cell[27188, 768, 1380, 42, 135, "Text"],
Cell[28571, 812, 350, 10, 92, "Input"],
Cell[28924, 824, 548, 14, 86, "Text"],
Cell[29475, 840, 480, 14, 72, "Input"],
Cell[29958, 856, 836, 24, 243, "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell[30831, 885, 42, 0, 26, "Subsection"],
Cell[30876, 887, 1635, 29, 407, "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell[32548, 921, 36, 0, 26, "Subsection"],
Cell[32587, 923, 714, 20, 101, "Text"],
Cell[33304, 945, 313, 10, 43, "Input"],
Cell[33620, 957, 191, 6, 41, "Text"],
Cell[33814, 965, 251, 8, 27, "Input"],
Cell[34068, 975, 74, 0, 26, "Text"],
Cell[34145, 977, 451, 14, 43, "Input"],
Cell[34599, 993, 499, 14, 56, "Text"],
Cell[35101, 1009, 568, 18, 43, "Input"],
Cell[35672, 1029, 243, 6, 26, "Text"],
Cell[35918, 1037, 97, 1, 27, "Input"],
Cell[36018, 1040, 173, 6, 26, "Text"],
Cell[36194, 1048, 127, 2, 27, "Input"],
Cell[36324, 1052, 339, 8, 41, "Text"],
Cell[36666, 1062, 154, 3, 27, "Input"],
Cell[CellGroupData[{
Cell[36845, 1069, 73, 1, 25, "Subsubsection"],
Cell[36921, 1072, 835, 20, 131, "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell[37793, 1097, 52, 0, 19, "Subsubsection"],
Cell[37848, 1099, 1560, 48, 175, "Text"],
Cell[39411, 1149, 367, 12, 33, "Input"],
Cell[39781, 1163, 429, 11, 86, "Text"],
Cell[40213, 1176, 255, 9, 43, "DisplayFormula"]
}, Closed]]
}, Open ]],
Cell[CellGroupData[{
Cell[40517, 1191, 38, 0, 34, "Subsection"],
Cell[40558, 1193, 1204, 20, 245, "Text"]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell[41811, 1219, 95, 1, 33, "Section"],
Cell[41909, 1222, 341, 7, 56, "Text"],
Cell[CellGroupData[{
Cell[42275, 1233, 28, 0, 34, "Subsection"],
Cell[42306, 1235, 501, 11, 119, "Text"],
Cell[42810, 1248, 326, 10, 52, "Input"],
Cell[43139, 1260, 406, 8, 83, "Text"],
Cell[43548, 1270, 135, 4, 31, "Input"],
Cell[43686, 1276, 437, 11, 83, "Text"],
Cell[44126, 1289, 324, 10, 52, "Input"],
Cell[44453, 1301, 352, 7, 65, "Text"],
Cell[44808, 1310, 140, 4, 31, "Input"],
Cell[44951, 1316, 318, 7, 65, "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell[45306, 1328, 33, 0, 26, "Subsection"],
Cell[45342, 1330, 267, 8, 47, "Text"],
Cell[45612, 1340, 106, 3, 31, "Input"],
Cell[45721, 1345, 476, 13, 83, "Text"],
Cell[46200, 1360, 401, 13, 52, "Input"],
Cell[46604, 1375, 491, 14, 101, "Text"],
Cell[47098, 1391, 150, 5, 31, "Input"],
Cell[47251, 1398, 157, 5, 31, "Input"],
Cell[47411, 1405, 208, 4, 47, "Text"],
Cell[47622, 1411, 544, 14, 132, "Input"],
Cell[48169, 1427, 198, 4, 47, "Text"]
}, Closed]],
Cell[CellGroupData[{
Cell[48404, 1436, 33, 0, 26, "Subsection"],
Cell[48440, 1438, 638, 20, 145, "Text"],
Cell[49081, 1460, 166, 5, 31, "Input"],
Cell[49250, 1467, 350, 12, 91, "Text"],
Cell[49603, 1481, 58, 0, 29, "Text"],
Cell[49664, 1483, 231, 7, 31, "Input"]
}, Closed]]
}, Closed]],
Cell[CellGroupData[{
Cell[49944, 1496, 70, 1, 33, "Section"],
Cell[50017, 1499, 937, 20, 146, "Text"],
Cell[50957, 1521, 2054, 58, 397, "Text"],
Cell[CellGroupData[{
Cell[53036, 1583, 29, 0, 34, "Subsection"],
Cell[53068, 1585, 1154, 20, 281, "Text"]
}, Closed]]
}, Closed]]
}
]
*)
(* End of internal cache information *)