Constructing a Tensor Versus Constructing a Matrix 

When creating a tensor, it is first important to understand the various subscripts.  For instance, in the following equations, tau[xy] would signify x-momentum moving in the y direction.  The second thing that we need to do is to implement Maple's tensor package. 

 

> with(tensor); -1
 

Warning, the previous binding of the name Jacobian has been removed and it now has an assigned value 

 

We will now create the general Tensor its components are completely general functions of x, y and z at this point.  The function create is used to do this.  The first array [-1,-1] which is passed to the function create specifies the covariant or contravariant nature of each index of the tensor.  You can read more about this by typinghelp( in Maple's command line.  The second array which is passed to create is an array consisting of each row that should be stored in the tensor, with each row being separated by comma. 

 

> `τTensor` := proc (x, y, z) options operator, arrow; create([-1, -1], array([[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z), `τyz`(x, y, ...
`τTensor` := proc (x, y, z) options operator, arrow; create([-1, -1], array([[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z), `τyz`(x, y, ...
`τTensor` := proc (x, y, z) options operator, arrow; create([-1, -1], array([[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z), `τyz`(x, y, ...
`τTensor` := proc (x, y, z) options operator, arrow; create([-1, -1], array([[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z), `τyz`(x, y, ...
`τTensor` := proc (x, y, z) options operator, arrow; create([-1, -1], array([[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z), `τyz`(x, y, ...
 

(Typesetting:-mprintslash)([`τTensor` := proc (x, y, z) options operator, arrow; create([(VectorCalculus:-`-`)(1), (VectorCalculus:-`-`)(1)], array([[`τxx`(x, y, z), `τxy`(x, y, z), `τ...
(Typesetting:-mprintslash)([`τTensor` := proc (x, y, z) options operator, arrow; create([(VectorCalculus:-`-`)(1), (VectorCalculus:-`-`)(1)], array([[`τxx`(x, y, z), `τxy`(x, y, z), `τ...
(Typesetting:-mprintslash)([`τTensor` := proc (x, y, z) options operator, arrow; create([(VectorCalculus:-`-`)(1), (VectorCalculus:-`-`)(1)], array([[`τxx`(x, y, z), `τxy`(x, y, z), `τ...
(Typesetting:-mprintslash)([`τTensor` := proc (x, y, z) options operator, arrow; create([(VectorCalculus:-`-`)(1), (VectorCalculus:-`-`)(1)], array([[`τxx`(x, y, z), `τxy`(x, y, z), `τ...
 

 

To get a better idea of what τ actually looks like we can simply type the new tensor's name in the command line as follows. 

 

> `τTensor`(x, y, z); 1
 

table([index_char = [-1, -1], compts = Matrix(%id = 147783068)])
table([index_char = [-1, -1], compts = Matrix(%id = 147783068)])
 

 

We could also create a matrix, which owing to its similarity to a tensor may actually prove more useful in a given application. 

 

> `τMatrix` := proc (x, y, z) options operator, arrow; Matrix(3, 3, [[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z), `τyz`(x, y, z)], [`&ta...
`τMatrix` := proc (x, y, z) options operator, arrow; Matrix(3, 3, [[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z), `τyz`(x, y, z)], [`&ta...
`τMatrix` := proc (x, y, z) options operator, arrow; Matrix(3, 3, [[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z), `τyz`(x, y, z)], [`&ta...
`τMatrix` := proc (x, y, z) options operator, arrow; Matrix(3, 3, [[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z), `τyz`(x, y, z)], [`&ta...
 

(Typesetting:-mprintslash)([`τMatrix` := proc (x, y, z) options operator, arrow; Matrix(3, 3, [[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z)...
(Typesetting:-mprintslash)([`τMatrix` := proc (x, y, z) options operator, arrow; Matrix(3, 3, [[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z)...
(Typesetting:-mprintslash)([`τMatrix` := proc (x, y, z) options operator, arrow; Matrix(3, 3, [[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z)...
(Typesetting:-mprintslash)([`τMatrix` := proc (x, y, z) options operator, arrow; Matrix(3, 3, [[`τxx`(x, y, z), `τxy`(x, y, z), `τxz`(x, y, z)], [`τyx`(x, y, z), `τyy`(x, y, z)...
 

 

To get a better idea of what τMatrix looks like we can simply type its name in the command line. 

 

> `τMatrix`(x, y, z); 1
 

Matrix(%id = 150216080) 

 

As you can see, this looks more like what we would expect to see.  In fact, Maple's built in functions seem to work more easily with matrices than with tensors.