login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SandBoxGradedTensor revision 1 of 2

1 2
Editor: Bill Page
Time: 2011/02/28 14:42:27 GMT-8
Note: new

changed:
-
\begin{spad}
)abbrev domain GTEN GradedTensor
GradedTensor(n:NonNegativeInteger, m:NonNegativeInteger, R:CommutativeRing,dim:NonNegativeInteger): Join(GradedAlgebra(R, NonNegativeInteger), GradedModule(Integer, NonNegativeInteger), Eltable(Integer,R)) with
        coerce: DP(dim, R) -> GradedTensor(1,0,R,dim)
            ++ coerce(v) views a vector as a (1,0)-tensor.
        coerce: SM(dim, R)  -> GradedTensor(0,2,R,dim)
            ++ coerce(m) views a matrix as a (0,2)-tensor.
        coerce: List R -> GradedTensor(0,1,R,dim)
            ++ coerce([r_1,...,r_dim]) allows tensors to be constructed
            ++ using lists.
        coerce: List % -> GradedTensor(n,m+1,R,dim)
            ++ coerce([t_1,...,t_dim]) allows tensors to be constructed
            ++ using lists.
        rank: % -> [NonNegativeInteger,NonNegativeInteger]
            ++ rank(t) returns the tensorial rank of (n,m)-tensor t
            ++ [n,m] (that is, the number of contravariant and covariant
            ++ indices).
        elt: (%) -> R
            ++ elt(t) gives the component of a rank 0 tensor.
        elt: (%, Integer, Integer) -> R
            ++ elt(t,i,j) gives a component of a rank (2,0) (1,1) or (0,2)-tensor. E.g.
            ++ T(1,1), T(1,-1), T(-1,-1)
        elt: (%, I, I, I) -> R
            ++ elt(t,i,j,k) gives a component of a rank (3,0),(2,1),(1,2) or (0,3)-tensor.
            ++ E.g. T(1,1,1), T(1,1,-1), etc.
        elt: (%, I, I, I, I) -> R
            ++ elt(t,i,j,k,l) gives a component of a rank (4,0), (3,1),(2,2),(1,3) or (0,4)-tensor.
            ++ E.g. T(1,1,1,1), T(1,1,1,-1), etc.
        elt: (%, List I) -> R
            ++ elt(t,[i1,...,iN]) gives a component of a rank (n,m)-tensor when n+m=N.
            ++ E.g. T[1,1,1,1,1], T[1,1,1,1,-1], etc.
        -- This specializes the documentation from GradedAlgebra.
        product: (%,%) -> %
            ++ product(s,t) is the outer product of the tensors s and t.
            ++ For example, if \spad{r = product(s,t)} for rank 2 tensors s and t,
            ++ then \spad{r} is a rank 4 tensor given by
            ++     \spad{r(i,j,k,l) = s(i,j)*t(k,l)}.
        *: (%, %) -> %
            ++ s*t is the inner product of the tensors s and t which contracts
            ++ the last index of s with the first index of t, i.e.
            ++     \spad{t*s = contract(t,rank t, s, 1)}
            ++     \spad{t*s = sum(k=1..dim, t[i1,..,iN,-k]*s[k,j1,..,jM])}
            ++ This is compatible with the use of \spad{M*v} to denote
            ++ the matrix-vector inner product.
        contract:  (%, Integer, %, Integer) -> %
            ++ contract(t,i,s,j) is the inner product of tenors s and t
            ++     \spad{r(i1,i2,...,in,j1,j2,...jm) = sum(h=1..dim,s(i1,i2,ii=-h,...,in)*t(j1,j2,jj=h,...,jm))}.
        contract:  (%, Integer, Integer)    -> %
            ++ contract(t,i,j) is the contraction of tensor t which
            ++     \spad{r(i1,i2,...,in) = sum(h=1..dim,s(i1,i2,ii=-h,...,ij=h,...,in))}.
        transpose: % -> %
            ++ transpose(t) exchanges the first and last indices of t.
            ++     \spad{r(i,...,l) = t(l,...,i)}.
        transpose: (%, Integer, Integer) -> %
            ++ transpose(t,i,j) exchanges the \spad{i}-th and \spad{j}-th indices of t.
            ++     \spad{r(...,i,...,j,...) = t(...,j,...,i,...)}.
        reindex: (%, List Integer) -> %
            ++ reindex(t,[i1,...,in]) permutes the indices of t.
            ++     \spad{r(j1,j2,...,jn) = t(ji1,ji2,...,jin)}.
        kroneckerDelta:  () -> GradedTensor(1,1,R,dim)
            ++ kroneckerDelta() is the rank (1,1)-tensor defined by
            ++    \spad{kroneckerDelta()(i,j)}
            ++       \spad{= 1  if i = j}
            ++       \spad{= 0 if  i \~= j}
        leviCivitaSymbol: () -> GradedTensor(0,dim,R,dim)
            ++ leviCivitaSymbol() is the rank (0,\spad{dim})-tensor defined by
            ++ \spad{leviCivitaSymbol()(i1,...idim) = +1/0/-1}
            ++ if \spad{i1,...,idim} is an even/is nota /is an odd permutation
            ++ of \spad{minix,...,minix+dim-1}.
        ravel:     % -> List R
            ++ ravel(t) produces a list of components from a tensor such that
            ++   \spad{unravel(ravel(t)) = t}.
        unravel:   List R -> %
            ++ unravel(t) produces a tensor from a list of
            ++ components such that
            ++   \spad{unravel(ravel(t)) = t}.
        sample:    () -> %
            ++ sample() returns an object of type %.
  == add
    Rep == CartesianTensor(1,dim,R)
    --declarations
    x,y: %
\end{spad}

spad
)abbrev domain GTEN GradedTensor
GradedTensor(n:NonNegativeInteger, m:NonNegativeInteger, R:CommutativeRing,dim:NonNegativeInteger): Join(GradedAlgebra(R, NonNegativeInteger), GradedModule(Integer, NonNegativeInteger), Eltable(Integer,R)) with
        coerce: DP(dim, R) -> GradedTensor(1,0,R,dim)
            ++ coerce(v) views a vector as a (1,0)-tensor.
        coerce: SM(dim, R)  -> GradedTensor(0,2,R,dim)
            ++ coerce(m) views a matrix as a (0,2)-tensor.
        coerce: List R -> GradedTensor(0,1,R,dim)
            ++ coerce([r_1,...,r_dim]) allows tensors to be constructed
            ++ using lists.
        coerce: List % -> GradedTensor(n,m+1,R,dim)
            ++ coerce([t_1,...,t_dim]) allows tensors to be constructed
            ++ using lists.
        rank: % -> [NonNegativeInteger,NonNegativeInteger]
            ++ rank(t) returns the tensorial rank of (n,m)-tensor t
            ++ [n,m] (that is, the number of contravariant and covariant
            ++ indices).
        elt: (%) -> R
            ++ elt(t) gives the component of a rank 0 tensor.
        elt: (%, Integer, Integer) -> R
            ++ elt(t,i,j) gives a component of a rank (2,0) (1,1) or (0,2)-tensor. E.g.
            ++ T(1,1), T(1,-1), T(-1,-1)
        elt: (%, I, I, I) -> R
            ++ elt(t,i,j,k) gives a component of a rank (3,0),(2,1),(1,2) or (0,3)-tensor.
            ++ E.g. T(1,1,1), T(1,1,-1), etc.
        elt: (%, I, I, I, I) -> R
            ++ elt(t,i,j,k,l) gives a component of a rank (4,0), (3,1),(2,2),(1,3) or (0,4)-tensor.
            ++ E.g. T(1,1,1,1), T(1,1,1,-1), etc.
        elt: (%, List I) -> R
            ++ elt(t,[i1,...,iN]) gives a component of a rank (n,m)-tensor when n+m=N.
            ++ E.g. T[1,1,1,1,1], T[1,1,1,1,-1], etc.
        -- This specializes the documentation from GradedAlgebra.
        product: (%,%) -> %
            ++ product(s,t) is the outer product of the tensors s and t.
            ++ For example, if \spad{r = product(s,t)} for rank 2 tensors s and t,
            ++ then \spad{r} is a rank 4 tensor given by
            ++     \spad{r(i,j,k,l) = s(i,j)*t(k,l)}.
        *: (%, %) -> %
            ++ s*t is the inner product of the tensors s and t which contracts
            ++ the last index of s with the first index of t, i.e.
            ++     \spad{t*s = contract(t,rank t, s, 1)}
            ++     \spad{t*s = sum(k=1..dim, t[i1,..,iN,-k]*s[k,j1,..,jM])}
            ++ This is compatible with the use of \spad{M*v} to denote
            ++ the matrix-vector inner product.
        contract:  (%, Integer, %, Integer) -> %
            ++ contract(t,i,s,j) is the inner product of tenors s and t
            ++     \spad{r(i1,i2,...,in,j1,j2,...jm) = sum(h=1..dim,s(i1,i2,ii=-h,...,in)*t(j1,j2,jj=h,...,jm))}.
        contract:  (%, Integer, Integer)    -> %
            ++ contract(t,i,j) is the contraction of tensor t which
            ++     \spad{r(i1,i2,...,in) = sum(h=1..dim,s(i1,i2,ii=-h,...,ij=h,...,in))}.
        transpose: % -> %
            ++ transpose(t) exchanges the first and last indices of t.
            ++     \spad{r(i,...,l) = t(l,...,i)}.
        transpose: (%, Integer, Integer) -> %
            ++ transpose(t,i,j) exchanges the \spad{i}-th and \spad{j}-th indices of t.
            ++     \spad{r(...,i,...,j,...) = t(...,j,...,i,...)}.
        reindex: (%, List Integer) -> %
            ++ reindex(t,[i1,...,in]) permutes the indices of t.
            ++     \spad{r(j1,j2,...,jn) = t(ji1,ji2,...,jin)}.
        kroneckerDelta:  () -> GradedTensor(1,1,R,dim)
            ++ kroneckerDelta() is the rank (1,1)-tensor defined by
            ++    \spad{kroneckerDelta()(i,j)}
            ++       \spad{= 1  if i = j}
            ++       \spad{= 0 if  i \~= j}
        leviCivitaSymbol: () -> GradedTensor(0,dim,R,dim)
            ++ leviCivitaSymbol() is the rank (0,\spad{dim})-tensor defined by
            ++ \spad{leviCivitaSymbol()(i1,...idim) = +1/0/-1}
            ++ if \spad{i1,...,idim} is an even/is nota /is an odd permutation
            ++ of \spad{minix,...,minix+dim-1}.
        ravel:     % -> List R
            ++ ravel(t) produces a list of components from a tensor such that
            ++   \spad{unravel(ravel(t)) = t}.
        unravel:   List R -> %
            ++ unravel(t) produces a tensor from a list of
            ++ components such that
            ++   \spad{unravel(ravel(t)) = t}.
        sample:    () -> %
            ++ sample() returns an object of type %.
  == add
    Rep == CartesianTensor(1,dim,R)
    --declarations
    x,y: %
spad
   Compiling OpenAxiom source code from file 
      /var/zope2/var/LatexWiki/3509383703218956027-25px001.spad using 
      Spad compiler.
   GTEN abbreviates domain GradedTensor 
   Adding Integer modemaps
   Adding NonNegativeInteger modemaps
------------------------------------------------------------------------
   initializing NRLIB GTEN for GradedTensor 
   compiling into NRLIB GTEN 
   Adding $ modemaps
   Adding R modemaps
   Adding Rep modemaps
****** comp fails at level 1 with expression: ******
(I)
****** level 1  ******
$x:= I
$m:= (Type)
$f:=
((((|y| #) (|x| #) (* # # #) (+ # # #) ...)))
>> Apparent user error: unspecified error