<tt>mkobj()</tt> Examples



next up previous contents index
Next: The Index Up: Using mkobj() Previous: Other properties

mkobj() Examples

  Following are some simple examples of the creation of an indexed object, and the use of symmetries to canonicalize the index.

 
#: mkobj('q,'(1 1));    % q is a rank-2 contravariant tensor.

  a b
 q

	% w is like q, but is also symmetric.
#: mkobj('w,'(1 1),'((1 1 2)));

  a b
 w

	% r is covariant, and is also flagged implicit.
#: mkobj ('r,'(-1 -1),'(),'t);	

 r
  a b

#: q[b,a];  	% this index will be unchanged.

  b a
 q

#: w[b,a];      % because w is symmetric, the index is mapped to a
% canonical form.
  a b
 w

#: q[1,2];  % There are no components in q, so zero is returned.

 0

#: r[1,2];  % Since r is implicit, the implicit value is returned.

 r
  1 2

Finally, if mkobj() is given a single name as an argument,   without even an empty index-type list, a ``bare'' declaration is made. The name is given the minimum number of properties that allow it to be correctly parsed with an index; it is assumed that the object will be correctly made later, usually during an indexed assignment. This use is somewhat sloppy, however, and is not encouraged.



John Harper
Wed Nov 16 13:34:23 EST 1994