Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork39
⟨Grassmann-Clifford-Hodge⟩ multilinear differential geometric algebra
License
chakravala/Grassmann.jl
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
⟨Grassmann-Clifford-Hodge⟩ multilinear differential geometric algebra
TheGrassmann.jl package provides tools for computations based on multi-linear algebra and spin groups using the extended geometric algebra known as Grassmann-Clifford-Hodge algebra.Algebra operations include exterior, regressive, inner, and geometric, along with the Hodge star and boundary operators.Code generation enables concise usage of the algebra syntax.DirectSum.jl multivector parametric type polymorphism is based on tangent vector spaces and conformal projective geometry.Additionally, the universal interoperability between different sub-algebras is enabled byAbstractTensors.jl, on which the type system is built.The design is based onTensorAlgebra{V}
abstract type interoperability fromAbstractTensors.jl with aK
-module type parameterV
fromDirectSum.jl.Abstract vector space type operations happen at compile-time, resulting in a differential geometric algebra of multivectors.
____ ____ ____ _____ _____ ___ ___ ____ ____ ____ / T| \ / T / ___/ / ___/| T T / T| \ | \ Y __j| D )Y o |( \_ ( \_ | _ _ |Y o || _ Y| _ Y | T || / | | \__ T \__ T| \_/ || || | || | | | l_ || \ | _ | / \ | / \ || | || _ || | || | | | || . Y| | | \ | \ || | || | || | || | | l___,_jl__j\_jl__j__j \___j \___jl___j___jl__j__jl__j__jl__j__j
ThisGrassmann
package for the Julia language was created bygithub.com/chakravala for mathematics and computer algebra research with differential geometric algebras.These projects and repositories were started entirely independently and are available as free software to help spread the ideas to a wider audience.Please consider donating to show your thanks and appreciation to this project atliberapay,GitHub Sponsors,Patreon,Tidelift,Bandcamp or contribute (documentation, tests, examples) in the repositories.
- Requirements
- DirectSum.jl parametric type polymorphism
- Grassmann.jl API design overview
- Visualization examples
- References
Mathematical foundations and definitions specific to theGrassmann.jl implementation provide an extensible platform for computing with a universal language for finite element methods based on a discrete manifold bundle.Tools built on these foundations enable computations based on multi-linear algebra and spin groups using the geometric algebra known as Grassmann algebra or Clifford algebra.This foundation is built on aDirectSum.jl parametric type system for tangent bundles and vector spaces generating the algorithms for local tangent algebras in a global context.With this unifying mathematical foundation, it is possible to improve efficiency of multi-disciplinary research using geometric tensor calculus by relying on universal mathematical principles.
- AbstractTensors.jl: Tensor algebra abstract type interoperability setup
- DirectSum.jl: Tangent bundle, vector space and
Submanifold
definition - Grassmann.jl: ⟨Grassmann-Clifford-Hodge⟩ multilinear differential geometric algebra
using Grassmann, Makie;@basisS"∞+++"streamplot(vectorfield(exp((π/4)*(v12+v∞3)),V(2,3,4),V(1,2,3)),-1.5..1.5,-1.5..1.5,-1.5..1.5,gridsize=(10,10))
More information and tutorials are available athttps://grassmann.crucialflow.com/dev
Grassmann.jl is a package for theJulia language, which can be obtained from their website or the recommended method for your operating system (GNU/Linux/Mac/Windows). Go todocs.julialang.org for documentation.Availability of this package and its subpackages can be automatically handled with the Julia package managerusing Pkg; Pkg.add("Grassmann")
or
pkg> add Grassmann
If you would like to keep up to date with the latest commits, instead use
pkg> add Grassmann#master
which is not recommended if you want to use a stable release.When themaster
branch is used it is possible that some of the dependencies also require a development branch before the release. This may include, but not limited to:
This requires a merged version ofComputedFieldTypes
athttps://github.com/vtjnash/ComputedFieldTypes.jl
Interoperability ofTensorAlgebra
with other packages is enabled byDirectSum.jl andAbstractTensors.jl.
The package is compatible viaRequires.jl withReduce.jl,Symbolics.jl,SymPy.jl,SymEngine.jl,AbstractAlgebra.jl,GaloisFields.jl,LightGraphs.jl,UnicodePlots.jl,Makie.jl,GeometryBasics.jl,Meshes.jl,
Sponsor this atliberapay,GitHub Sponsors,Patreon, orBandcamp,Tidelift,Tidelift (Learn more).
TheAbstractTensors
package is intended for universal interoperation of the abstractTensorAlgebra
type system.AllTensorAlgebra{V}
subtypes have type parameterV
, used to store aSubmanifold{M}
value, which is parametrized byM
theTensorBundle
choice.This means that different tensor types can have a commonly shared underlyingK
-module parametric type expressed by definingV::Submanifold{M}
.EachTensorAlgebra
subtype must be accompanied by a correspondingTensorBundle
parameter, which is fully static at compile time.Due to the parametric type system for theK
-module types, the compiler can fully pre-allocate and often cache.
LetV
be aK
-module of rankn
be specified by instance with the tuple(n,P,g,ν,μ)
withP
specifying the presence of the projective basis andg
is a metric tensor specification.The typeTensorBundle{n,P,g,ν,μ}
encodes this information asbyte-encoded data available at pre-compilation,whereμ
is an integer specifying the order of the tangent bundle (i.e. multiplicity limit of the Leibniz-Taylor monomials).Lastly,ν
is the number of tangent variables, bases for the vectors and covectors; and bases for differential operators and scalar functions.The purpose of theTensorBundle
type is to specify theK
-module basis at compile time.When assigned in a workspace,V = Submanifold(::TensorBundle)
.
The metric signature of theSubmanifold{V,1}
elements of a vector spaceV
can be specified with theV"..."
by using+
or-
to specify whether theSubmanifold{V,1}
element of the corresponding index squares to +1 or -1.For example,S"+++"
constructs a positive definite 3-dimensionalTensorBundle
, so constructors such asS"..."
andD"..."
are convenient.
It is also possible to change the diagonal scaling, such as withD"1,1,1,0"
, although theSignature
format has a more compact representation if limited to +1 and -1.It is also possible to change the diagonal scaling, such as withD"0.3,2.4,1"
.Fully generalMetricTensor
as a type with non-diagonal components requires a matrix, e.g.MetricTensor([1 2; 2 3])
.
Declaring an additional point at infinity is done by specifying it in the string constructor with∞
at the first index (i.e. Riemann sphereS"∞+++"
).The hyperbolic geometry can be declared by∅
subsequently (i.e. hyperbolic projectionS"∅+++"
).Additionally, thenull-basis based on the projective split for conformal geometric algebra would be specified withS"∞∅+++"
.These two declared basis elements are interpreted in the type system.Thetangent(V,μ,ν)
map can be used to specifyμ
andν
.
To assignV = Submanifold(::TensorBundle)
along with associated basiselements of theDirectSum.Basis
to the local Julia session workspace, it is typical to useSubmanifold
elements created by the@basis
macro,
julia>using Grassmann;@basisS"-++"# macro or basis"-++"(⟨-++⟩, v, v₁, v₂, v₃, v₁₂, v₁₃, v₂₃, v₁₂₃)
the macro@basis V
delcares a local basis in Julia.As a result of this macro, allSubmanifold{V,G}
elements generated withM::TensorBundle
become available in the local workspace with the specified naming arguments.The first argument provides signature specifications, the second argument is the variable name forV
theK
-module, and the third and fourth argument are prefixes of theSubmanifold
vector names (and covector names).Default isV
assignedSubmanifold{M}
andv
is prefix for theSubmanifold{V}
.
It is entirely possible to assign multiple different bases having different signatures without any problems.The@basis
macro arguments are used to assign the vector space name toV
and the basis elements tov...
, but other assigned names can be chosen so that their local names don't interfere:If it is undesirable to assign these variables to a local workspace, the versatile constructs ofDirectSum.Basis{V}
can be used to contain or access them, which is exported to the user as the methodDirectSum.Basis(V)
.
julia> DirectSum.Basis(V)DirectSum.Basis{⟨-++⟩,8}(v, v₁, v₂, v₃, v₁₂, v₁₃, v₂₃, v₁₂₃)
V(::Int...)
provides a convenient way to define aSubmanifold
by using integer indices to reference specific direct sums within ambientV
.
Additionally, a universal unit volume element can be specified in terms ofLinearAlgebra.UniformScaling
, which is independent ofV
and has its interpretation only instantiated by context ofTensorAlgebra{V}
elements being operated on.Interoperability ofLinearAlgebra.UniformScaling
as a pseudoscalar element which takes on theTensorBundle
form of any otherTensorAlgebra
element is handled globally.This enables the usage ofI
fromLinearAlgebra
as a universal pseudoscalar element defined at every pointx
of a manifold, which is mathematically denoted byI
= I(x) and specified by the g(x) bilinear tensor field.
Grassmann.jl is a foundation which has been built up from a minimalK
-module algebra kernel on which an entirely custom algbera specification is designed and built from scratch on the base Julia language.
Definition.TensorAlgebra{V,K}
whereV::Submanifold{M}
for a generatingK
-module specified by aM::TensorBundle
choice
TensorBundle
specifies generators ofDirectSum.Basis
algebraInt
value induces a Euclidean metric of counted dimensionSignature
usesS"..."
with + and - specifying the metricDiagonalForm
usesD"..."
for defining any diagonal metricMetricTensor
can accept non-diagonal metric tensor array
TensorGraded{V,G,K}
has gradeG
element of exterior algebraChain{V,G,K}
has a complete basis for gradeG
withK
-moduleSimplex{V}
alias column-moduleChain{V,1,Chain{V,1,K}}
TensorTerm{V,G,K} <: TensorGraded{V,G,K}
single coefficientZero{V}
is a zero value which preservesV
in its algebra typeSubmanifold{V,G,B}
is a gradeG
basis with sorted indicesB
Single{V,G,B,K}
whereB::Submanifold{V}
is paired toK
AbstractSpinor{V,K}
subtypes are special Clifford sub-algebrasCouple{V,B,K}
is the sum ofK
scalar withSingle{V,G,B,K}
PseudoCouple{V,B,K}
is pseudoscalar +Single{V,G,B,K}
Spinor{V,K}
has complete basis for theeven
Z2-graded termsCoSpinor{V,K}
has complete basis forodd
Z2-graded terms
Multivector{V,K}
has complete exterior algebra basis withK
-module
Definition.TensorNested{V,T}
subtypes are linear transformations
TensorOperator{V,W,T}
linear operator mapping withT::DataType
Endomorphism{V,T}
linear endomorphism map withT::DataType
DiagonalOperator{V,T}
diagonal endomorphism withT::DataType
DiagonalMorphism{V,<:Chain{V,1}}
diagonal map on grade 1 vectorsDiagonalOutermorphism{V,<:Multivector{V}}
on full exterior algebra
Outermorphism{V,T}
extendsEndomorphism{V}
to full exterior algebraProjector{V,T}
linear map withF(F) = F
definedDyadic{V,X,Y}
linear map withDyadic(x,y)
=x ⊗ y
Grassmann.jl was first to define a comprehensiveTensorAlgebra{V}
type system from scratch around the idea of theV::Submanifold{M}
value to express algebra subtypes for a specifiedK
-module structure.
Definition. Common unary operations onTensorAlgebra
elements
Manifold
returns the parameterV::Submanifold{M}
K
-modulemdims
dimensionality of the pseudoscalarV
of thatTensorAlgebra
gdims
dimensionality of the gradeG
ofV
for thatTensorAlgebra
tdims
dimensionality ofMultivector{V}
for thatTensorAlgebra
grade
returnsG
forTensorGraded{V,G}
whilegrade(x,g)
is selectionistensor
returns true forTensorAlgebra
elementsisgraded
returns true forTensorGraded
elementsisterm
returns true forTensorTerm
elementscomplementright
Euclidean metric Grassmann right complementcomplementleft
Euclidean metric Grassmann left complementcomplementrighthodge
Grassmann-Hodge right complementreverse(x)*I
complementlefthodge
Grassmann-Hodge left complementI*reverse(x)
metric
applies themetricextensor
as outermorphism operatorcometric
applies complementmetricextensor
as outermorphismmetrictensor
returnsg
bilinear form associated toTensorAlgebra{V}
metrictextensor
returns outermorphism form forTensorAlgebra{V}
involute
grade permutes basis perk
withgrade(x,k)*(-1)^k
reverse
permutes basis perk
withgrade(x,k)*(-1)^(k(k-1)/2)
clifford
conjugate of an element is compositeinvolute ∘ reverse
even
part selects(x + involute(x))/2
and is defined by even gradeodd
part selects(x - involute(x))/2
and is defined by odd gradereal
part selects(x + reverse(x))/2
and is defined by positive squareimag
part selects(x - reverse(x))/2
and is defined by negative squareabs
is the absolute valuesqrt(reverse(x)*x)
andabs2
is thenreverse(x)*x
norm
evaluates a positive definite norm metric on the coefficientsunit
applies normalization defined asunit(t) = t/abs(t)
scalar
selects grade 0 term of anyTensorAlgebra
elementvector
selects grade 1 terms of anyTensorAlgebra
elementbivector
selects grade 2 terms of anyTensorAlgebra
elementtrivector
selects grade 3 terms of anyTensorAlgebra
elementpseudoscalar
max. grade term of anyTensorAlgebra
elementvalue
returns internalValues
tuple of aTensorAlgebra
elementvaluetype
returns type of aTensorAlgebra
element value's tuple
Binary operations commonly used inGrassmann
algebra syntax
+
and-
carry over from theK
-module structure associated toK
wedge
is exterior product∧
andvee
is regressive product∨
>
is the right contraction and<
is the left contraction of the algebra*
is the geometric product and/
usesinv
algorithm for division⊘
is thesandwich
and>>>
is its alternate operator orientation
Custom methods related to tensor operators and roots of polynomials
inv
returns the inverse andadjugate
returns transposed cofactordet
returns the scalar determinant of an endomorphism operatortr
returns the scalar trace of an endomorphism operatortranspose
operator has swapping of row and column indicescompound(F,g)
is the graded multilinearEndomorphism
outermorphism(A)
transformsEndomorphism
intoOutermorphism
operator
make linear representation of multivector outermorphismcompanion
matrix of monic polynomiala0 + a1*z + ... + an*z^n + z^(n+1)
roots(a...)
of polynomial with coefficientsa0 + a1*z + ... + an*z^n
rootsreal
of polynomial with coefficientsa0 + a1*z + ... + an*z^n
rootscomplex
of polynomial with coefficientsa0 + a1*z + ... + an*z^n
monicroots(a...)
of monic polynomiala0 + a1*z + ... + an*z^n + z^(n+1)
monicrootsreal
of monic polynomiala0 + a1*z + ... + an*z^n + z^(n+1)
monicrootscomplex
of monic polynomiala0 + a1*z + ... + an*z^n + z^(n+1)
characteristic(A)
polynomial coefficients fromdet(A-λ*I)
eigvals(A)
are the eigenvalues[λ1,...,λn]
so thatA*ei = λi*ei
eigvalsreal
are real eigenvalues[λ1,...,λn]
so thatA*ei = λi*ei
eigvalscomplex
are complex eigenvalues[λ1,...,λn]
soA*ei = λi*ei
eigvecs(A)
are the eigenvectors[e1,...,en]
so thatA*ei = λi*ei
eigvecsreal
are real eigenvectors[e1,...,en]
so thatA*ei = λi*ei
eigvecscomplex
are complex eigenvectors[e1,...,en]
soA*ei = λi*ei
eigen(A)
spectral decomposition sum ofλi*Proj(ei)
withA*ei = λi*ei
eigenreal
spectral decomposition sum ofλi*Proj(ei)
withA*ei = λi*ei
eigencomplex
spectral decomposition sum ofλi*Proj(ei)
soA*ei = λi*ei
eigpolys(A)
normalized symmetrized functions ofeigvals(A)
eigpolys(A,g)
normalized symmetrized function ofeigvals(A)
vandermonde
facilitates(inv(X'X)*X')*y
for polynomial coefficientscayley(V,∘)
returns product table forV
and binary operation∘
Accessingmetrictensor(V)
produces a linear mapg
which can be extended to an outermorphism given bymetricextensor
.To apply themetricextensor
to anyGrassmann
element, the functionmetric
can be used on the element,cometric
applies a complement metric.
Due toGeometryBasics.jlPoint
interoperability, plotting and visualizing withMakie.jl is easily possible. For example, thevectorfield
method creates an anonymousPoint
function that applies a versor outermorphism:
using Grassmann, Makiebasis"2"# Euclideanstreamplot(vectorfield(exp(π*v12/2)),-1.5..1.5,-1.5..1.5)streamplot(vectorfield(exp((π/2)*v12/2)),-1.5..1.5,-1.5..1.5)streamplot(vectorfield(exp((π/4)*v12/2)),-1.5..1.5,-1.5..1.5)streamplot(vectorfield(v1*exp((π/4)*v12/2)),-1.5..1.5,-1.5..1.5)@basisS"+-"# Hyperbolicstreamplot(vectorfield(exp((π/8)*v12/2)),-1.5..1.5,-1.5..1.5)streamplot(vectorfield(v1*exp((π/4)*v12/2)),-1.5..1.5,-1.5..1.5)
using Grassmann, Makie@basisS"∞+++"f(t)= (↓(exp(π*t*((3/7)*v12+v∞3))>>>↑(v1+v2+v3)))lines(V(2,3,4).(points(f)))@basisS"∞∅+++"f(t)= (↓(exp(π*t*((3/7)*v12+v∞3))>>>↑(v1+v2+v3)))lines(V(3,4,5).(points(f)))
using Grassmann, Makie;@basisS"∞+++"streamplot(vectorfield(exp((π/4)*(v12+v∞3)),V(2,3,4)),-1.5..1.5,-1.5..1.5,-1.5..1.5,gridsize=(10,10))
using Grassmann, Makie;@basisS"∞+++"f(t)=↓(exp(t*v∞*(sin(3t)*3v1+cos(2t)*7v2-sin(5t)*4v3)/2)>>>↑(v1+v2-v3))lines(V(2,3,4).(points(f)))
using Grassmann, Makie;@basisS"∞+++"f(t)=↓(exp(t*(v12+0.07v∞*(sin(3t)*3v1+cos(2t)*7v2-sin(5t)*4v3)/2))>>>↑(v1+v2-v3))lines(V(2,3,4).(points(f)))
- Michael Reed,Differential geometric algebra with Leibniz and Grassmann, JuliaCon (2019)
- Michael Reed,Foundatons of differential geometric algebra (2021)
- Michael Reed,Multilinear Lie bracket recursion formula (2024)
- Michael Reed,Differential geometric algebra: compute using Grassmann.jl and Cartan.jl (2025)
- Emil Artin,Geometric Algebra (1957)
- John Browne,Grassmann Algebra, Volume 1: Foundations (2011)
- C. Doran, D. Hestenes, F. Sommen, and N. Van Acker,Lie groups as spin groups, J. Math Phys. (1993)
- David Hestenes,Universal Geometric Algebra, Pure and Applied (1988)
- David Hestenes, Renatus Ziegler,Projective Geometry with Clifford Algebra, Acta Appl. Math. (1991)
- David Hestenes,Tutorial on geometric calculus. Advances in Applied Clifford Algebra (2013)
- Lachlan Gunn, Derek Abbott, James Chappell, Ashar Iqbal,Functions of multivector variables (2011)
- Aaron D. Schutte,A nilpotent algebra approach to Lagrangian mechanics and constrained motion (2016)
- Vladimir and Tijana Ivancevic,Undergraduate lecture notes in DeRahm-Hodge theory. arXiv (2011)
- Peter Woit,Clifford algebras and spin groups, Lecture Notes (2012)
developed by /\ / \ ___ ___ __ __ _ _ / /\ \ / _ \ / __) / \/ /| | | | / /__\ \ | |_) )> _) ( () < | |_| | /________\| __/ \___) \__/\_\| ._,_| ______ | | | | \ ___) |_| |_| \ \ __ __ __ __ ___ ___ ___ ___ > > \ \ / / / \/ /( )( )/ __) / _ \ / /__ \ v / ( () < | | | | > _) | |_) ) /_____) > < \__/\_\ \_) \_)\___)| __/ / ^ \ | | /_/ \_\ |_| https://crucialflow.com https://github.com/chakravala _ _ _ | | | | | | ___| |__ __ _| | ___ __ __ ___ ____ _| | __ _ / __| '_ \ / _` | |/ / '__/ _` \ \ / / _` | |/ _` | | (__| | | | (_| | <| | | (_| |\ V / (_| | | (_| | \___|_| |_|\__,_|_|\_\_| \__,_| \_/ \__,_|_|\__,_|
This project exists thanks to all the people who contribute. [Contribute].
Become a financial contributor and help us sustain our community. [Contribute]
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
About
⟨Grassmann-Clifford-Hodge⟩ multilinear differential geometric algebra
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.