CartesianTensor(minix, dim, R)ΒΆ
carten.spad line 85 [edit on github]
minix: Integer
dim: NonNegativeInteger
CartesianTensor(minix, dim, R
) provides Cartesian tensors with components belonging to a commutative ring R
. These tensors can have any number of indices. Each index takes values from minix
to minix + dim - 1
.
- 0: %
from GradedModule(R, NonNegativeInteger)
- 1: %
from GradedAlgebra(R, NonNegativeInteger)
- *: (%, %) -> %
s*t
is the inner product of the tensorss
andt
which contracts the last index ofs
with the first index oft
, i.e.t*s = contract(t, rank t, s, 1)
t*s = sum(k=1..N, t[i1, .., iN, k]*s[k, j1, .., jM])
This is compatible with the use ofM*v
to denote the matrix-vector inner product.- *: (%, Integer) -> %
- *: (%, R) -> %
from GradedModule(R, NonNegativeInteger)
- *: (Integer, %) -> %
- *: (R, %) -> %
from GradedModule(R, NonNegativeInteger)
- +: (%, %) -> %
from GradedModule(R, NonNegativeInteger)
- -: % -> %
from GradedModule(R, NonNegativeInteger)
- -: (%, %) -> %
from GradedModule(R, NonNegativeInteger)
- coerce: % -> OutputForm
from CoercibleTo OutputForm
- coerce: DirectProduct(dim, R) -> %
coerce(v)
views a vector as a rank 1 tensor.
- coerce: List % -> %
coerce([t_1, ..., t_dim])
allows tensors to be constructed using lists.
- coerce: List R -> %
coerce([r_1, ..., r_dim])
allows tensors to be constructed using lists.- coerce: R -> %
from CoercibleFrom R
- coerce: SquareMatrix(dim, R) -> %
coerce(m)
views a matrix as a rank 2 tensor.
- contract: (%, Integer, %, Integer) -> %
contract(t, i, s, j)
is the inner product of tenorss
andt
which sums along thek1
-
th index oft
and thek2
-
th index ofs
. For example, ifr = contract(s, 2, t, 1)
for rank 3 tensors rank 3 tensorss
andt
, thenr
is the rank 4(= 3 + 3 - 2)
tensor given byr(i, j, k, l) = sum(h=1..dim, s(i, h, j)*t(h, k, l))
.
- contract: (%, Integer, Integer) -> %
contract(t, i, j)
is the contraction of tensort
which sums along thei
-
th andj
-
th indices. For example, ifr = contract(t, 1, 3)
for a rank 4 tensort
, thenr
is the rank 2(= 4 - 2)
tensor given byr(i, j) = sum(h=1..dim, t(h, i, h, j))
.
- degree: % -> NonNegativeInteger
from GradedModule(R, NonNegativeInteger)
- elt: % -> R
elt(t)
gives the component of a rank 0 tensor.
- elt: (%, Integer) -> R
elt(t, i)
gives a component of a rank 1 tensor.
- elt: (%, Integer, Integer, Integer, Integer) -> R
elt(t, i, j, k, l)
gives a component of a rank 4 tensor.
- kroneckerDelta: () -> %
kroneckerDelta()
is the rank 2 tensor defined bykroneckerDelta()(i, j)
= 1 if i = j
= 0 if i \~= j
- latex: % -> String
from SetCategory
- leviCivitaSymbol: () -> %
leviCivitaSymbol()
is the rankdim
tensor defined byleviCivitaSymbol()(i1, ...idim) = +1/0/-1
ifi1, ..., idim
is an even/is nota /is an odd permutation ofminix, ..., minix+dim-1
.
- product: (%, %) -> %
product(s, t)
is the outer product of the tensorss
andt
. For example, ifr = product(s, t)
for rank 2 tensorss
andt
, thenr
is a rank 4 tensor given byr(i, j, k, l) = s(i, j)*t(k, l)
.
- rank: % -> NonNegativeInteger
rank(t)
returns the tensorial rank oft
(that is, the number of indices). This is the same as the graded module degree.
- ravel: % -> List R
ravel(t)
produces a list of components from a tensor such thatunravel(ravel(t)) = t
.
- reindex: (%, List Integer) -> %
reindex(t, [i1, ..., idim])
permutes the indices oft
. For example, ifr = reindex(t, [4, 1, 2, 3])
for a rank 4 tensort
, thenr
is the rank for tensor given byr(i, j, k, l) = t(l, i, j, k)
.
- retract: % -> R
from RetractableTo R
- retractIfCan: % -> Union(R, failed)
from RetractableTo R
- sample: () -> %
sample()
returns an object of type %.
- transpose: % -> %
transpose(t)
exchanges the first and last indices oft
. For example, ifr = transpose(t)
for a rank 4 tensort
, thenr
is the rank 4 tensor given byr(i, j, k, l) = t(l, j, k, i)
.
- transpose: (%, Integer, Integer) -> %
transpose(t, i, j)
exchanges thei
-
th andj
-
th indices oft
. For example, ifr = transpose(t, 2, 3)
for a rank 4 tensort
, thenr
is the rank 4 tensor given byr(i, j, k, l) = t(i, k, j, l)
.
- unravel: List R -> %
unravel(t)
produces a tensor from a list of components such thatunravel(ravel(t)) = t
.
GradedAlgebra(R, NonNegativeInteger)
GradedModule(Integer, NonNegativeInteger)