Mathematica For The Beginner
Mathematica For The Beginner
Mathematica For The Beginner
nb
Abstract
In this tutorial we will explain some elementary aspects of the computer algebra system Mathematica
3.0. The tutorial is mainly divided into five sections : Arithmetic and Numerical Calculations, Algebra,
Calculus, Graphing in Two and Three Dimensions, and Animations. In the first section Arithmetic and
Numerical Calculations, we will cover the topics such as exponentiation, square roots, logarithms,
absolute values, factoring integers, and approximating numbers to arbitrary precision. This section at
the same time provides the user a feel for the syntax of the Mathematica language. In the second
section covering Algebra, we will show how to factor, expand and simplify algebraic expressions. One
highlight in this section is how to use Mathematica to mimic the functional notation. In the same
section, we will show how to solve single equations and systems of equations. In the third section on
Calculus, we discuss differentiation, indefinite and definite integration, and limits of functions. The
fourth section covers one of the most important aspects of the tutorial, Two and Three Dimensional
Graphing. Starting with graphing a simple function, we will discuss in detail very many aspects of
graphing. Among them include various plot options in Mathematica, such as, "PlotStyle",
"AspectRatio", "Axes", "AxesLabel", "Frame", "PlotLabel", etc. We will also explain parametric and
implicit plotting as well. The final section is devoted to showing how to use Mathematica as an
animation tool.
Atcm98''.nb
1.
1. Fraction calculations
+3 s 2 4 s 5/ s + 2 s 3 +5 s 6/ ^ 2/
414/5
2. Approximations
N#Sqrt#2', 100'
1.414213562373095048801688724209698078569671875376948073176679737990732478\
462107038850387534327641573
N#Exp#1', 100'
2.718281828459045235360287471352662497757247093699959574966967627724076630\
353547594571382178525166427
5. Absolute values
Abs#E Pi'
-E + Pi
N#%'
0.423311
6. Logarithms
Atcm98''.nb
N#Log#100', 12'
4.60517018599
Log#2, 8'
3
7. Trigonometric functions
N#Sin#30''
-0.988032
Sin#30 Degree'
1
2
Cos#Pi s 4'
1
-----------Sqrt[2]
8. Complex numbers
+2 3 I/ +4 2 I/
14 + 8 I
Abs#14 8 I'
2 Sqrt[65]
2.
Algebra
1. Factoring polynomials
Factor#x ^ 8 1'
2
4
(-1 + x) (1 + x) (1 + x ) (1 + x )
Factor#x ^ 12 y ^ 12'
2
2
2
2
2
2
4
2 2
4
(x - y) (x + y) (x + y ) (x - x y + y ) (x + x y + y ) (x - x y + y )
Atcm98''.nb
2. Expanding polynomials.
Expand#+2 x 3 y/ ^ 10'
10
9
8 2
7 3
6 4
1024 x
- 15360 x y + 103680 x y - 414720 x y + 1088640 x y 5 5
4 6
3 7
2 8
1959552 x y + 2449440 x y - 2099520 x y + 1180980 x y 9
10
393660 x y + 59049 y
Factor#%'
10
(2 x - 3 y)
Simplify#1 s +1 x/ 1 s +1 x/'
-2
-----------2
-1 + x
s. x ! 3
44
g#x_, y_' :
+x 2 y/ s Sqrt#x ^ 2 y ^ 2'
g#3, 4'
-1
5. Making a table of values for a given function
Atcm98''.nb
Table#2 x ^ 2 3,
x, 5, 5, 0.5'
{47, 37.5, 29., 21.5, 15., 9.5, 5., 1.5, -1., -2.5, -3., -2.5, -1., 1.5, 5.
21.5, 29., 37.5, 47.}
7. Solving equations
Solve#3 x ^ 2 2 x 1
0, x'
1
{{x -> -(-)}, {x -> 1}}
3
x s. %
1
{-(-), 1}
3
Solve#x ^ 4 x ^ 3 6 x ^ 2 8 x 16
0, x'
NSolve#+2 x 1/ ^ 2 1
x ^ 3 2 x, x'
FindRoot#+2 x 1/ ^ 2 1
x ^ 3 2 x, x, 6'
{x -> 4.44949}
4,
13
14
{{x -> --,
- y -> --}}
17
17
3.
Calculus
1. Derivatives of functions
3 x 4 y
Atcm98''.nb
D#x ^ 4, x'
3
4 x
f'#x'
3
4 x
f''#x'
2
12 x
f'#5'
500
3. Limits of functions
Limit#+x ^ 2 4/ s +x 2/, x ! 2'
4
Limit#1 s x, x ! Infinity'
0
Atcm98''.nb
4.
Graphing Functions
3, 3'
8
6
4
2
-3 -2 -1
-Graphics-
2, 2,
4
3
2
1
-2
-1
-Graphics-
Plot#x ^ 2, x,
2, 2,
4
3
2
1
-2
-1
-Graphics-
Atcm98''.nb
-1
-Graphics-
-2
-5
-10
-Graphics-
4. Implicit plots
Graphics`ImplicitPlot`
ImplicitPlot#x ^ 2 y ^ 2
3
2
1
-3 -2 -1
-1
-2
-3
1 2 3
-Graphics-Graphics-
5. Parametric plots
9, x,
4, 4'
Atcm98''.nb
0.5
-1
-Graphics-
0.5
-0.5
-1
-Graphics-
4
2
0
-2
2 4 -4
-SurfaceGraphics-
0.4
0.2
0
-0.2
-0.4
-5
5
0
0
-5
-SurfaceGraphics-
Atcm98''.nb
5.
10
Animations
1. Animating a parabola
Do#Plot#k
x ^ 2, x, 2, 2, PlotRange ! 2, 2, 7, 7,
PlotStyle ! Thickness#1 s 120', RGBColor#1, 0, 0'',
k, 3, 3, 0.5'
6
4
2
-2 -1.5 -1 -0.5
-2
0.5
1.5
-4
-6
1.251.51.75 2 2.252.52.75 3
-1
-2
5
0
-5
-5
5
0
0
-5