The grade of a clifford object
grade.Rd
The grade of a term is the number of basis vectors in it.
Usage
grade(C, n, drop=TRUE)
grade(C, n) <- value
grades(x)
gradesplus(x)
gradesminus(x)
gradeszero(x)
Details
A term is a single expression in a Clifford object. It has a
coefficient and is described by the basis vectors it comprises. Thus
The grade of a term is the number of basis vectors in it. Thus
the grade of
for any Clifford object
We have
Function grades()
returns an (unordered) vector specifying the
grades of the constituent terms. Function grades<-()
allows
idiom such as grade(x,1:2) <- 7
to operate as expected [here to
set all coefficients of terms with grades 1 or 2 to value 7].
Function gradesplus()
returns the same but counting only basis
vectors that square to gradesminus()
counts only
basis vectors that square to signature()
controls which basis vectors square to
From Perwass, page 57, given a bilinear form
and a basis blade
Function gradeszero()
counts only the basis vectors squaring to
zero (I have not seen this anywhere else, but it is a logical
suggestion).
If the signature is zero, then the Clifford algebra reduces to a
Grassmann algebra and products match the wedge product of exterior
calculus. In this case, functions gradesplus()
and
gradesminus()
return NA
.
Function grade(C,n)
returns a clifford object with just the
elements of grade g
, where g %in% n
.
Idiom like grade(C,r) <- value
, where r
is a non-negative
integer (or vector of non-negative integers) should behave as expected.
It has two distinct cases: firstly, where value
is a length-one
numeric vector; and secondly, where value
is a clifford object:
Firstly,
grade(C,r) <- value
withvalue
a length-one numeric vector. This changes the coefficient of all grade-r
terms tovalue
. Note thatdisordR
discipline must be respected, so ifvalue
has length exceeding one, adisordR
consistency error might be raised.Secondly,
grade(C,r) <- value
withvalue
a clifford object. This should operate as expected: it will replace the grade-r
components ofC
withvalue
. Ifvalue
has any grade component not inr
, a “grade mismatch” error will be returned. Thus, only the grade-r
components ofC
may be modified with this construction. It is semi vectorised: ifr
is a vector, it is interpreted as a set of grades to replace.
The zero grade term, grade(C,0)
, is given more naturally by
const(C)
.
Function c_grade()
is a helper function that is documented at
Ops.clifford.Rd
.
Note
In the C code, “term” has a slightly different meaning, referring to the vectors without the associated coefficient.
Examples
a <- clifford(sapply(seq_len(7),seq_len),seq_len(7))
a
#> Element of a Clifford algebra, equal to
#> + 1e_1 + 2e_12 + 3e_123 + 4e_1234 + 5e_12345 + 6e_123456 + 7e_1234567
grades(a)
#> A disord object with hash 185ca524fb71fa2ae28566b137978e475c1aa00f and elements
#> [1] 1 2 3 4 5 6 7
#> (in some order)
grade(a,5)
#> Element of a Clifford algebra, equal to
#> + 5e_12345
a <- clifford(list(0,3,7,1:2,2:3,3:4,1:3,1:4),1:8)
b <- clifford(list(4,1:2,2:3),c(101,102,103))
grade(a,1) <- 13*e(6)
grade(a,2) <- grade(b,2)
grade(a,0:2) <- grade(b,0:2)*7
signature(2,2)
x <- rcliff()
drop(gradesplus(x) + gradesminus(x) + gradeszero(x) - grades(x))
#> [1] 0 0 0 0 0 0 0 0 0 0
a <- rcliff()
a == Reduce(`+`,sapply(unique(grades(a)),function(g){grade(a,g)}))
#> [1] TRUE