Learn R Programming

clifford (version 1.0-8)

Ops.clifford: Arithmetic Ops Group Methods for clifford objects

Description

Allows arithmetic operators to be used for multivariate polynomials such as addition, multiplication, integer powers, etc.

Usage

# S3 method for clifford
Ops(e1, e2)
clifford_negative(C)
geoprod(C1,C2)
clifford_times_scalar(C,x)
clifford_plus_clifford(C1,C2)
clifford_eq_clifford(C1,C2)
clifford_inverse(C)
cliffdotprod(C1,C2)
fatdot(C1,C2)
lefttick(C1,C2)
righttick(C1,C2)
wedge(C1,C2)
scalprod(C1,C2=rev(C1),drop=TRUE)
eucprod(C1,C2=C1,drop=TRUE)
maxyterm(C1,C2=as.clifford(0))
C1 %.% C2
C1 %dot% C2
C1 %^% C2
C1 %X% C2
C1 %star% C2
C1 % % C2
C1 %euc% C2
C1 %o% C2
C1 %_|% C2
C1 %|_% C2

Value

The high-level functions documented here return a clifford

object. The low-level functions are not really intended for the end-user.

Arguments

e1,e2,C,C1,C2

Objects of class clifford or coerced if needed

x

Scalar, length one numeric vector

drop

Boolean, with default TRUE meaning to return the constant coerced to numeric, and FALSE meaning to return a (constant) Clifford object

Author

Robin K. S. Hankin

Details

The function Ops.clifford() passes unary and binary arithmetic operators “+”, “-”, “*”, “/” and “^” to the appropriate specialist function. Function maxyterm() returns the maximum index in the terms of its arguments.

The package has several binary operators:

Geometric productA*B = geoprod(A,B)
AB=_r,s A_r B_ssee PDFInner productA %.% B = cliffdotprod(A,B)
A B=_r 0 s 0^s 0 A_r B_s_|s-r|see PDFOuter productA %^% B = wedge(A,B)
A B=_r,s A_r B_s_s+rsee PDFFat dot productA %o% B = fatdot(A,B)
A B=_r,s A_r B_s_|s-r|see PDFLeft contractionA %_|% B = lefttick(A,B)
A B=_r,s A_r B_s_s-rsee PDFRight contractionA %|_% B = righttick(A,B)
A B=_r,s A_r B_s_r-ssee PDFCross productA %X% B = cross(A,B)
A B=12_j(AB-BA)see PDFScalar productA %star% B = star(A,B)
A B=_r,s A_r B_s_0see PDFEuclidean productA %euc% B = eucprod(A,B)

In R idiom, the geometric product geoprod(.,.) has to be indicated with a “*” (as in A*B) and so the binary operator must be %*%: we need a different idiom for scalar product, which is why %star% is used.

Because geometric product is often denoted by juxtaposition, package idiom includes a % % b for geometric product.

Binary operator %dot% is a synonym for %.%, which causes problems for rmarkdown.

Function clifford_inverse() returns an inverse for nonnull Clifford objects Cl(p,q) for p+q 5p+5 <= 5, and a few other special cases. The functionality is problematic as nonnull blades always have an inverse; but function is.blade() is not yet implemented. Blades (including null blades) have a pseudoinverse, but this is not implemented yet either.

The scalar product of two clifford objects is defined as the zero-grade component of their geometric product:

A B= AB_0NB: notation used by both Perwass and Hestenes omitted; see PDF

In package idiom the scalar product is given by A %star% B or scalprod(A,B). Hestenes and Perwass both use an asterisk for scalar product as in “A*BA*B”, but in package idiom, the asterisk is reserved for geometric product.

Note: in the package, A*B is the geometric product.

The Euclidean product (or Euclidean scalar product) of two clifford objects is defined as

A B= A B^= AB^_0Perwass omitted: see PDF

where B^? denotes Conjugate [as in Conj(a)]. In package idiom the Euclidean scalar product is given by eucprod(A,B) or A %euc% B, both of which return A * Conj(B).

Note that the scalar product A A? can be positive or negative [that is, A %star% A may be any sign], but the Euclidean product is guaranteed to be non-negative [that is, A %euc% A is always positive or zero].

Dorst defines the left and right contraction (Chisholm calls these the left and right inner product) as A Bsee PDF and A Bsee PDF. See the vignette for more details.

Division, as in idiom x/y, is defined as x*clifford_inverse(y). Function clifford_inverse() uses the method set out by Hitzer and Sangwine but is limited to p+q 5p+q <= 5.

Many of the functions documented here use low-level helper functions that wrap C code. For example, fatdot() uses c_fatdotprod(). These are documented at lowlevel.Rd.

References

E. Hitzer and S. Sangwine 2017. “Multivector and multivector matrix inverses in real Clifford algebras”. Applied Mathematics and Computation 311:375-389

Examples

Run this code

u <- rcliff(5)
v <- rcliff(5)
w <- rcliff(5)

u
v
u*v

u+(v+w) == (u+v)+w            # should be TRUE by associativity of "+"
u*(v*w) == (u*v)*w            # should be TRUE by associativity of "*"
u*(v+w) == u*v + u*w          # should be TRUE by distributivity

# Now if x,y are _vectors_ we have:

x <- as.1vector(sample(5))
y <- as.1vector(sample(5))
x*y == x%.%y + x%^%y
x %^% y == x %^% (y + 3*x)  
x %^% y == (x*y-x*y)/2        # should be TRUE 

#  above are TRUE for x,y vectors (but not for multivectors, in general)


## Inner product "%.%" is not associative:
x <- rcliff(5,g=2)
y <- rcliff(5,g=2)
z <- rcliff(5,g=2)
x %.% (y %.% z) == (x %.% y) %.% z

## Other products should work as expected:

x %|_% y   ## left contraction
x %_|% y   ## right contraction
x %o% y    ## fat dot product


Run the code above in your browser using DataLab