Matrices with
Mathematica
Demo
Vectors and Matrices
ü
Basic Operations
In
Mathematica
vectors and matrices are represented as lists of numbers. For example, consider
the two vectors
In[1]:=
u
=
8
1, 0, 1
<
Out[1]=
8
1, 0, 1
<
In[2]:=
v
=
8
0, 1, 0
<
Out[2]=
8
0, 1, 0
<
When evaluating inner products of vectors in
Mathematica
it is not necessary to take the trans-
pose of the first vector. Thus, taking the inner product of
u
and
v
is performed as follows.
In[3]:=
u.v
Out[3]=
0
Therefore,
u
and
v
are
orthogonal
. Now let us consider the matrix from the first example in the
section on systems of first-order differential equations. Essentially, a matrix is entered as a list of
lists, or a list of vectors, with each row being entered as a vector.
In[4]:=
A
=
88
0, 1, 1
<
,
8
1, 0, 1
<
,
8
1, 1, 0
<<
;
The semicolon at the end of the input line tells
Mathematica
to suppress its standard output.
Instead, it is more convenient to output
A
in the usual matrix form as follows.
In[5]:=
MatrixForm
@
A
D
Out[5]//MatrixForm=
i
k
j
j
j
j
j
j
j
0
1
1
1
0
1
1
1
0
y
{
z
z
z
z
z
z
z
matrixdemo.nb
1