tensor(deprecated)/create - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : tensor(deprecated)/create

tensor

 create
 create a new tensor_type object

 Calling Sequence create( index_character, components)

Parameters

 index_character - list of positive ones (1) and negative ones (-1) specifying the contravariant/covariant character of the indices of the new tensor components - components of the tensor: array for tensors of nonzero rank, an algebraic for zero-rank tensors

Description

Important: The tensor package has been deprecated. Use the superseding commands DifferentialGeometry[evalDG] and Physics[Define] instead.

 • The function create([1,-1], compts_array) returns a tensor_type with "index_char" field set to [1,-1] and "compts" field set to compts_array (where compts_array is either an array or the name of an array).
 • The contravariant indices (represented by 1) are those indices that appear as superscripts, whereas the covariant indices (represented by -1) are those that appear as subscripts.
 • The function create([], a*b/(c+d)) returns a tensor_type representing a scalar (zero-rank tensor) with fields "index_char" and "compts" set to $\left[\right]$ and $\frac{ab}{c+d}$ respectively.
 • When called, create checks its arguments for correct type and for the consistency between the index character and the components fields using a call to type/tensor_type.  Upon passing those checks, the appropriate tensor_type is returned.
 • Note that this function is not a necessity but is provided as a convenient way of create new tensors.
 • This function is part of the tensor package, and so can be used in the form create(..) only after performing the command with(tensor), or with(tensor,create).  This function can always be accessed in the long form tensor[create](..).

Examples

Important: The tensor package has been deprecated. Use the superseding commands DifferentialGeometry[evalDG] and Physics[Define] instead.

 > $\mathrm{with}\left(\mathrm{tensor}\right):$

Create a 2-tensor of mixed character with components stored in the array "cmpts".

 > $\mathrm{cmpts}≔\mathrm{array}\left(\left[\left[a,b,c\right],\left[d,e,f\right],\left[g,h,i\right]\right]\right)$
 ${\mathrm{cmpts}}{≔}\left[\begin{array}{ccc}{a}& {b}& {c}\\ {d}& {e}& {f}\\ {g}& {h}& {i}\end{array}\right]$ (1)
 > $\mathrm{create}\left(\left[-1,1\right],\mathrm{cmpts}\right)$
 ${table}{}\left(\left[{\mathrm{index_char}}{=}\left[{-1}{,}{1}\right]{,}{\mathrm{compts}}{=}{\mathrm{cmpts}}\right]\right)$ (2)

Create a zero-rank tensor with "component" arctan(y/x).

 > $\mathrm{create}\left(\left[\right],\mathrm{arctan}\left(\frac{y}{x}\right)\right)$
 ${table}{}\left(\left[{\mathrm{index_char}}{=}\left[\right]{,}{\mathrm{compts}}{=}{\mathrm{arctan}}{}\left(\frac{{y}}{{x}}\right)\right]\right)$ (3)

Create a 2-tensor of mixed character by directly entering the components.

 > $\mathrm{create}\left(\left[-1,1\right],\mathrm{array}\left(\left[\left[a,b,c\right],\left[d,e,f\right],\left[g,h,i\right]\right]\right)\right)$
 ${table}{}\left(\left[{\mathrm{index_char}}{=}\left[{-1}{,}{1}\right]{,}{\mathrm{compts}}{=}\left[\begin{array}{ccc}{a}& {b}& {c}\\ {d}& {e}& {f}\\ {g}& {h}& {i}\end{array}\right]\right]\right)$ (4)

Create the contravariant Euclidean 3-space metric (2-tensor) in spherical-polar coordinates.

 > $A≔\mathrm{create}\left(\left[1,1\right],\mathrm{array}\left(\left[\left[1,0,0\right],\left[0,\frac{1}{{r}^{2}},0\right],\left[0,0,\frac{1}{{r}^{2}{\mathrm{sin}\left(\mathrm{\theta }\right)}^{2}}\right]\right]\right)\right)$
 ${A}{≔}{table}{}\left(\left[{\mathrm{index_char}}{=}\left[{1}{,}{1}\right]{,}{\mathrm{compts}}{=}\left[\begin{array}{ccc}{1}& {0}& {0}\\ {0}& \frac{{1}}{{{r}}^{{2}}}& {0}\\ {0}& {0}& \frac{{1}}{{{r}}^{{2}}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}}\end{array}\right]\right]\right)$ (5)

 See Also