Calculus III, Lab One
Problem 0: Introduction to Mathematica
Directions: Read and complete the exercises in the following Mathematica Tutorial. This should get you familiar with the basics you will need for the next three problems. There is no need to include a write up of Problem 0. You may include brief general comments about Problem 0 in the conclusion if you wish.
Where to find Mathematica
Mathematica is available in many computer labs on campus. The undergrad computer lab, ECCR 143 is one of these labs. The other labs in the engineering center also have Mathematica loaded on their computers. On PCs, you can run Mathematica by opening the "Start" menu and running it from the list of programs. You can find other ITS labs with Mathematica by looking on the ITS Web Page.
When you begin to type in a notebook, your typing appears in a "cell". Cells can be formatted in different ways. "Input" cells are the default. This is the "Style" (format) you will use to input functions and equations that you want Mathematica to evaluate. Other types of styles include "Text", which allows you to add comments is your notebook, as well as "Title", "Subtitle", and other text formats to allow you to perform rudimentary word processing in Mathematica. However, it is not recommended that you use Mathematica to produce your entire lab write-up, as the word processing features are not very advanced.
To change a cell's style, select the bracket or "handle" at the right of the cell to select it, then open the "Format" menu and select "Style". You will see a list of styles to choose from. Be careful - if you want Mathematica to evaluate a formula, the cell that contains the formula must have the "Input" style only, do not mix styles within one cell.
Before you start to use Mathematica, learn the following four rules:
1) To evaluate input, press SHIFT and ENTER simultaneously.Mathematica has an extensive help function that you can refer to. Access help by selecting "Help", "Help Browser" and typing in the command or function you are curious about.2) Built in function, such as sin(x), cos(x) and exp(x), always start with a CAPITAL letter. Mathematica is case sensitive!
3) Constants such as e and pi must be typed into Mathematica as E and Pi. Notice the capital letters!
4) Any argument of a functions must be put within square brackets [ ]. For example, the functions sin(x), cos(x) and exp(x) are entered in Mathematica as Sin[x], Cos[x] and Exp[x].
Below follows a table with the syntax for the most common operations and functions:
|
Operation, function or constant |
Mathematica command |
|
+ (addition) |
+ |
|
- (subtraction) |
- |
|
X (multiplication) |
* |
|
/ (division) |
/ |
|
the power operator |
^ |
|
| x | (absolute value of x) |
Abs[x] |
|
the square root of x |
Sqrt[x] |
|
ex |
Exp[x] |
|
ln x (natural logarithm of x) |
Log[x] |
|
log10 x (base 10 logarithm of x) |
Log[10,x] |
|
sine x |
Sin[x] |
|
cosine x |
Cos[x] |
|
tangent x |
Tan[x] |
|
cotangent x |
Cot[x] |
|
arcsine x |
ArcSin[x] |
|
arccosine x |
ArcCos[x] |
|
arctangent x |
ArcTan[x] |
|
arccotangent x |
ArcCot[x] |
|
e |
E |
|
pi |
Pi |
The parentheses () are used to group expressions together. It is a common mistake to confuse the usage of parentheses () and square brackets []. The following examples illustrate how they should be used. Study the example carefully and make sure you understand when to use parentheses and when to use square brackets.
|
Example 1 (You do not have to type these commands in
Mathematica, just read the example and make sure you understand the usage
of () and [].) The expression
(x+y)2 is entered in Mathematica as
|
|
Exercise 1 |
Plot[f(x), {x,xmin,xmax} ] |
|
Exercise 2 a) In Mathematica, plot the function
tan(x) from x = -10 to x = 10 by entering
Plot[Tan[x],{x,-10,10}, PlotRange -> {-5, 5}]
|
Created by Kristian
Sandberg
Department of Applied Mathematics
University of Colorado at
Boulder
Modified by David Beltran-del-Rio