Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.434.

`defcon (tensor_1)`

`defcon (tensor_1, tensor_2, tensor_3)`

gives ** tensor_1** the property that the contraction of a product of

**and**

`tensor_1`

**results in**

`tensor_2`

**with the appropriate indices. If only one argument,**

`tensor_3`

**, is given, then the contraction of the product of**

`tensor_1`

**with any indexed object having the appropriate indices (say**

`tensor_1`

**) will yield an indexed object with that name, i.e.**

`my_tensor`

**, and with a new set of indices reflecting the contractions performed. For example, if**

`my_tensor`

**, then**

`imetric:g`

**will implement the raising and lowering of indices through contraction with the metric tensor. More than one defcon can be given for the same indexed object; the latest one given which applies in a particular contraction will be used.**

`defcon(g)`

**is a list of those indexed objects which have been given contraction properties with**

`contractions`

**.**

`defcon`

`remcon (tensor_1, ..., tensor_n)`

`remcon (all)`

Removes all the contraction properties from the ** (tensor_1, ..., tensor_n)**.

**removes all contraction properties from all indexed objects.**

`remcon(all)`

`contract (expr)`

Carries out the tensorial contractions in ** expr** which may be any combination of sums and products. This function uses the information given to the

**function. For best results,**

`defcon`

**should be fully expanded.**

`expr`

**is the fastest way to expand products and powers of sums if there are no variables in the denominators of the terms. The**

`ratexpand`

**switch should be**

`gcd`

**if GCD cancellations are unnecessary.**

`false`

`indexed_tensor (tensor)`

Must be executed before assigning components to a ** tensor** for which a built in value already exists as with

**,**

`ichr1`

**,**

`ichr2`

**. See the example under**

`icurvature`

**.**

`icurvature`

`components (tensor, expr)`

Permits one to assign an indicial value to an expression expr giving the values of the components of ** tensor**. These are automatically substituted for the

**whenever it occurs with all of its indices. The**

`tensor`

**must be of the form**

`tensor`

**where either list may be empty.**

`t([...],[...])`

**can be any indexed expression involving other objects with the same free indices as**

`expr`

**. When used to assign values to the metric tensor wherein the components contain dummy indices one must be careful to define these indices to avoid the generation of multiple dummy indices. Removal of this assignment is given to the function**

`tensor`

**.**

`remcomps`

It is important to keep in mind that components cares only about the valence of a tensor, not about any particular index ordering. Thus assigning components to, say, ** x([i,-j],[]), x([-j,i],[])**, or

**all produce the same result, namely components being assigned to a tensor named**

`x([i],[j])`

**with valence**

`x`

**.**

`(1,1)`

Components can be assigned to an indexed expression in four ways, two of which involve the use of the ** components** command:

**1**) As an indexed expression. For instance:

`(%i1) `**load (itensor)$**
(%i2) **components(g([],[i,j]),e([],[i])*p([],[j]))$**
(%i3) **ishow(g([],[i,j]))$**
i j
(%t3) e p

**2**) As a matrix:

`(%i4) `**lg:-ident(4)$lg[1,1]:1$ lg;**
[ 1 0 0 0 ]
[ ]
[ 0 - 1 0 0 ]
(%o6) [ ]
[ 0 0 - 1 0 ]
[ ]
[ 0 0 0 - 1 ]
(%i7) **components(g([i,j],[]),lg);**
(%o7) done
(%i8) **ishow(g([i,j],[]))$**
(%t8) g
i j
(%i9) **g([1,1],[]);**
(%o9) 1
(%i10) **g([4,4],[]);**
(%o10) - 1

**3**) As a function. You can use a Maxima function to specify the components of a

tensor based on its indices. For instance, the following code assigns ** kdelta** to

**if**

`h`

**has the same number of covariant and contravariant indices and no derivative indices, and**

`h`

**otherwise:**

`g`

`(%i11) `**h(l1,l2,[l3]):=if length(l1)=length(l2) and length(l3)=0
then kdelta(l1,l2) else apply(g,append([l1,l2], l3))$**
(%i12) **ishow(h([i],[j]))$**
j
(%t12) kdelta
i
(%i13) **ishow(h([i,j],[k],l))$**
k
(%t13) g
i j,l

**4**) Using Maxima’s pattern matching capabilities, specifically the ** defrule** and

**commands:**

`applyb1`

`(%i14) `**matchdeclare(l1,listp);**
(%o14) done
(%i15) **defrule(r1,m(l1,[]),(i1:idummy(),
g([l1[1],l1[2]],[])*q([i1],[])*e([],[i1])))$**
(%i16) **defrule(r2,m([],l1),(i1:idummy(),
w([],[l1[1],l1[2]])*e([i1],[])*q([],[i1])))$**
(%i17) **ishow(m([i,n],[])*m([],[i,m]))$**
i m
(%t17) m m
i n
(%i18) **ishow(rename(applyb1(%,r1,r2)))$**
%1 %2 %3 m
(%t18) e q w q e g
%1 %2 %3 n

`showcomps (tensor)`

Shows component assignments of a ** tensor**, as made using the

**command. This function can be particularly useful when a matrix is assigned to an indicial tensor using**

`components`

**, as demonstrated by the following example:**

`components`

`(%i1) `**load(ctensor)$**
(%i2) **load(itensor)$**
(%i3) **lg:matrix([sqrt(r/(r-2*m)),0,0,0],[0,r,0,0],
[0,0,sin(theta)*r,0],[0,0,0,sqrt((r-2*m)/r)]);**
[ r ]
[ sqrt(-------) 0 0 0 ]
[ r - 2 m ]
[ ]
[ 0 r 0 0 ]
(%o3) [ ]
[ 0 0 r sin(theta) 0 ]
[ ]
[ r - 2 m ]
[ 0 0 0 sqrt(-------) ]
[ r ]
(%i4) **components(g([i,j],[]),lg);**
(%o4) done
(%i5) **showcomps(g([i,j],[]));**
[ r ]
[ sqrt(-------) 0 0 0 ]
[ r - 2 m ]
[ ]
[ 0 r 0 0 ]
(%t5) g = [ ]
i j [ 0 0 r sin(theta) 0 ]
[ ]
[ r - 2 m ]
[ 0 0 0 sqrt(-------) ]
[ r ]
(%o5) false

The ** showcomps** command can also display components of a

**of rank higher than 2.**

`tensor`

⭕