Generic Names



next up previous contents index
Next: Other Functions Up: The General Relativity Previous: Covariant derivatives of

Generic Names

    As noted above, each GR function creates an object with a name of the form <metric>_<name>, so that any number of metrics and their families may exist in the system simultaneously. Each object has a unique name, and each function returns the object appropriate for the metric currently in use. However, these names are not particularly convenient for general usage such as building indexed expressions. Thus, a set of ``generic'' names has been created that allow the user to easily access the objects in the family of the current metric.

A generic name is a psuedo-indexed object: it has some properties of indexed objects that allow it to be parsed with an index, but it never has explicit or implicit values, and it has some extra properties that mark it as generic. Specifically, the generic property of a generic name contains the type of metric to look at, and the name of the property key on that metric to examine. That key is the name of the function that created the actual object of interest, and is the place where that function stored the name of its output. For example, the generic name R has a generic property that refers to the tensor metric and the key riemann, which is where the function riemann() stores the name of its output.

The system, when it encounters a generic name, immediately examines the generic property to locate the target object. If the metric is changed, the system will look at the new metric and the generic name will refer to some other object. Thus, the same generic name is used for the same class of object for many different metrics. If the target object does not exist and the generic reference is not part of an indexed assignment, it will return unevaluated and will do so until the object is made, or the metric is changed to one for which the desired object has been created. The user can therefore set up expressions involving generic objects, assign them to REDUCE algebraic variables before any metrics are created, and then use them after some metrics are made to evaluate the same expression for each metric. For example,

 
#: kr := R[a,b,c,d]*R[@a,@b,@c,@d];   % R has no target yet

         a b c d
  kr := R        R
                  a b c d

#: % create some metrics and compute their Riemann tensors ...

#: setmetric(g1)$

#: seval(kr);

  <output>

#: setmetric(g2)$

#: seval(kr);

  <output> 
will evaluate the Kretschmann scalar for the metrics g1 and g2. Of course, if the output of the expression was also indexed, then a new object would have to be created each time the expression was evaluated.

If, when an expression containing unresolved generic references is included in an indexed assignment (such as the call to seval() above), and the target objects have not yet been created, they will be automatically computed since each generic object also carries information on how to make its target. However, it is generally better if the user calls the generating functions directly, since the target objects can be simpified and examined before being involved in a potentially expensive computation (see §5.1 for more information).

There are a large number of generic names pre-defined in REDTEN; for the GR package the commonly used ones are g for the metric, c1 and c2 for the Christoffel symbols, R for the Riemann tensor, ric and ricsc for the Ricci tensor and scalar respectively, C for the Weyl tensor and G for the Einstein tensor. More than one generic name can point to the same target, thus ri also refers to the Riemann tensor, and ei refers to the Einstein tensor. The function generics() will show the user what generic names exist, and whether there is a target object present.

The only generic names actually created in REDTEN are those whose targets are a parent object. Shifted objects and any other objects whose names include a _ symbol (eg. covariant derivatives) are handled by examining the fragments of their names. If the portion of the name before the _ symbol is a generic name, the target name replaces the initial portion of the name. Hence, if the current-metric is g1 and the target of R is g1_R then the target of R_b is g1_R_b. All functions that take an indexed object as input will accept a generic name (actually, the name is resolved before the function gets it), and the output of these functions will involve the target name.



next up previous contents index
Next: Other Functions Up: The General Relativity Previous: Covariant derivatives of



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