Calculus II Mathematica Session: Test

Calculus II Mathematica Session: Test
To test that your Mathematica installation is working and to get an idea of how Mathematica works,
run through the following commands. Lines with text do not need to be evaluated.
I/O
To evaluate an input line in Mathematica, you need to go to the input line with the cursor and press
Shift + Return, e.g.
13 + 31
44
1 × 2 × 3 × 4 × 5 × 6 × 7 × 8 × 9 × 10
3 628 800
2^2^2^2
65 536
22
22
65 536
Predefined variables
There are a few useful things that are predefined, and thus have a universally assigned value, in Mathematica. For instance special constants:
Imaginary I:
I
ⅈ
I2
-−1
Pi:
Pi
π
N[Pi]
3.14159
Other letters that should not be used as variables etc: N (is used for numerical evaluation), C (is used
for complex numbers)
2
CalculusII-MMABasics.nb
Functions
Functions from R1 → R1 are defined as
f1[x_] = 8 x2
8 x2
The x-underscore means you’re treating x as a variable here.
Note: unlike maple you do NOT have to write multiplication signs out, Mathematica is smart enough to
treat expressions such as x y as x times y.
Note: unlike maple you do NOT have to put in semi-colons at the end of each line. Evaluation happens
once you press Shift and then in addition Return.
f1[0]
0
f1[2]
32
Special functions: Syntax is usually the function name as you know, starting with a capital letter:
Exp[x]
ⅇx
Sin[x]
sin(x)
Cos[x]
cos(x)
Tan[x]
tan(x)
ArcTan[x]
tan-−1 (x)
Differentiation, Integration, Plots, Taylor Expansion for 1-dimensional functions
DIFFERENTIATION
Syntax is D[ Function, Variable], so e.g.
D[f1[x], x]
16 x
INTEGRATION
The syntax for the indefinite integral is Integrate [ Function, Variable]
CalculusII-MMABasics.nb
INTEGRATION
The syntax for the indefinite integral is Integrate [ Function, Variable]
Integrate[f1[x], x]
8 x3
3
For a definite integral wrt x from a to b, include { x, a, b} instead, so e.g. integrate x from 0 to 3, the
syntax is:
Integrate[f1[x], {x, 0, 3}]
72
PLOTS
Like with definite integrals, to integrate wrt x from a to b include Plot[ Function, {x, a, b}]
Plot[f1[x], {x, -− 3, 3}]
70
60
50
40
30
20
10
-−3
-−2
-−1
1
2
3
TAYLOR SERIES:
The syntax is Series[Function, {Variable, ExpansionPoint, Order}]
ExpansionPoint= the point around which you want to do the Taylor series
Order= this is the Big O order.
E.g. if we want to expand the above function around x=1 to O((x-1)^2) we type
Series[f1[x], {x, 1, 2 }]
8 + 16 (x -− 1) + 8 (x -− 1)2 + O(x -− 1)3 
Warmup Exercise for you:
Repeat all the above operations for the exponential function.
3
4
CalculusII-MMABasics.nb