- 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
⟨Leibniz-Grassmann-Clifford-Hestenes⟩ differential geometric algebra / multivector simplicial complex
TheGrassmann.jl package provides tools for doing computations based on multi-linear algebra, differential geometry, and spin groups using the extended tensor algebra known as Leibniz-Grassmann-Clifford-Hestenes geometric algebra.Combinatorial products include∧, ∨, ⋅, *, ⋆, ', ~, d, ∂
(which are the exterior, regressive, inner, and geometric products; along with the Hodge star, adjoint, reversal, differential and boundary operators).The kernelized operations are built up from composite sparse tensor products and Hodge duality, with high dimensional support for up to 62 indices using staged caching and precompilation. Code generation enables concise yet highly extensible definitions.TheDirectSum.jl multivector parametric type polymorphism is based on tangent bundle vector spaces and conformal projective geometry to make the dispatch highly extensible for many applications.Additionally, the universal interoperability between different sub-algebras is enabled byAbstractTensors.jl, on which the type system is built.
____ ____ ____ _____ _____ ___ ___ ____ ____ ____ / 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.
- TensorAlgebra design, Manifold code generation
- Grassmann elements and geometric algebra Λ(V)
- References
Mathematical foundations and definitions specific to theGrassmann.jl implementation provide an extensible platform for computing with geometric algebra at high dimensions, along with the accompanying support packages.The design is based on theTensorAlgebra
abstract type interoperability fromAbstractTensors.jl with aTensorBundle
parameter fromDirectSum.jl.Abstract tangent vector space type operations happen at compile-time, resulting in a differential conformal geometric algebra of hyper-dual multivector forms.
- DirectSum.jl: Abstract tangent bundle vector space types (unions, intersections, sums, etc.)
- AbstractTensors.jl: Tensor algebra abstract type interoperability with vector bundle parameter
- Grassmann.jl: ⟨Leibniz-Grassmann-Clifford-Hestenes⟩ differential geometric algebra of multivector forms
- Leibniz.jl: Derivation operator algebras for tensor fields
- Reduce.jl: Symbolic parser generator for Julia expressions using REDUCE algebra term rewriter
Mathematics ofGrassmann
can be used to study unitary groups used in quantum computing by building efficient computational representations of their algebras.Applicability of the Grassmann computational package not only maps to quantum computing, but has the potential of impacting countless other engineering and scientific computing applications.It can be used to work with automatic differentiation and differential geometry, algebraic forms and invariant theory, electric circuits and wave scattering, spacetime geometry and relativity, computer graphics and photogrammetry, and much more.
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))
Thus, computations involving fully general rotational algebras and Lie bivector groups are possible with a full trigonometric suite.Conformal geometric algebra is possible with the Minkowski plane, based on the null-basis.In general, multivalued quantum logic is enabled by the∧,∨,⋆
Grassmann lattice.Mixed-symmetry algebra withLeibniz.jl andGrassmann.jl, having the geometric algebraic product, yields automatic differentiation and Hodge-DeRahm co/homology as unveiled by Grassmann.Dirac-Clifford product yields generalized Hodge-Laplacian and Betti numbers with Euler characteristicχ
.
TheGrassmann.jl package and its accompanying support packages provide an extensible platform for high performance computing with geometric algebra at high dimensions.This enables the usage of many different types ofTensorAlgebra
along with variousTensorBundle
parameters and interoperability for a wide range of scientific and research applications.
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 is not limited to):
This requires a merged version ofComputedFieldTypes
athttps://github.com/vtjnash/ComputedFieldTypes.jl
Interoperability ofTensorAlgebra
with other packages is automatically enabled byDirectSum.jl andAbstractTensors.jl.
The package is compatible viaRequires.jl withReduce.jl,Symbolics.jl,SymPy.jl,SymEngine.jl,AbstractAlgebra.jl,Nemo.jl,GaloisFields.jl,LightGraphs.jl,Compose.jl,UnicodePlots.jl,Makie.jl,AbstractPlotting.jl,GeometryBasics.jl,Meshes.jl,MiniQhull.jl,QHull.jl,Delaunay.jl,Triangulate.jl,TetGen.jl,MATLAB.jl.
Sponsor this atliberapay,GitHub Sponsors,Patreon, orBandcamp; also available as part of theTidelift Subscription:
The maintainers of Grassmann and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use.Learn more.
TheDirectSum.jl package is a work in progress providing the necessary tools to work with an arbitraryManifold
specified by an encoding.Due to the parametric type system for the generatingTensorBundle
, the Julia compiler can fully preallocate and often cache values efficiently ahead of run-time.Although intended for use with theGrassmann.jl package,DirectSum
can be used independently.
Letn
be the rank of aManifold{n}
.The typeTensorBundle{n,ℙ,g,ν,μ}
usesbyte-encoded data available at pre-compilation, whereℙ
specifies the basis for up and down projection,g
is a bilinear form that specifies the metric of the space,andμ
is an integer specifying the order of the tangent bundle (i.e. multiplicity limit of Leibniz-Taylor monomials). Lastly,ν
is the number of tangent variables.
The metric signature of theSubmanifold{V,1}
elements of a vector spaceV
can be specified with theV"..."
constructor by using+
and-
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
.
julia> ℝ^3==V"+++"==Manifold(3)true
It is also possible to specify an arbitraryDiagonalForm
having numerical values for the basis with degeneracyD"1,1,1,0"
, although theSignature
format has a more compact representation.Further development will result in more metric types.
Declaring an additional plane 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. Minkowski spacetimeS"∅+++"
).Additionally, thenull-basis based on the projective split for confromal geometric algebra would be specified with∞∅
initially (i.e. 5D CGAS"∞∅+++"
). These two declared basis elements are interpreted in the type system.
Thetangent
map takesV
to its tangent space and can be applied repeatedly for higher orders, such thattangent(V,μ,ν)
can be used to specifyμ
andν
.The direct sum operator⊕
can be used to join spaces (alternatively+
), and the dual space functor'
is an involution which toggles a dual vector space with inverted signature.The direct sum of aTensorBundle
and its dualV⊕V'
represents the full mother spaceV*
.In addition to the direct-sum operation, several other operations are supported, such as∪,∩,⊆,⊇
for set operations.Due to the design of theTensorBundle
dispatch, these operations enable code optimizations at compile-time provided by the bit parameters.
Calling manifolds with sets of indices constructs the subspace representations.GivenM(s::Int...)
one can encodeSubmanifold{length(s),M,s}
with induced orthogonal space, such that computing unions of submanifolds is done by inspecting the parameters
.Operations onManifold
types is automatically handled at compile time.
More information aboutDirectSum
is available athttps://github.com/chakravala/DirectSum.jl
TheAbstractTensors
package is intended for universal interoperability of the abstractTensorAlgebra
type system.AllTensorAlgebra{V}
subtypes have type parameterV
, used to store aTensorBundle
value obtained fromDirectSum.jl.By itself, this package does not impose any specifications or structure on theTensorAlgebra{V}
subtypes and elements, aside from requiringV
to be aTensorBundle
.This means that different packages can create tensor types having a common underlyingTensorBundle
structure.
The key to making the whole interoperability work is that eachTensorAlgebra
subtype shares aTensorBundle
parameter (with allisbitstype
parameters), which contains all the info needed at compile time to make decisions about conversions. So other packages need only use the vector space information to decide on how to convert based on the implementation of a type. If external methods are needed, they can be loaded byRequires
when making a separate package withTensorAlgebra
interoperability.
SinceTensorBundle
choices are fundamental toTensorAlgebra
operations, the universal interoperability betweenTensorAlgebra{V}
elements with different associatedTensorBundle
choices is naturally realized by applying theunion
morphism to operations.Some of the method names like+,-,\otimes,\times,\cdot,*
forTensorAlgebra
elements are shared across different packages, with interoperability.
Additionally, a universal unit volume element can be specified in terms ofLinearAlgebra.UniformScaling
, which is independent ofV
and has its interpretation only instantiated by the context of theTensorAlgebra{V}
element being operated on.The universal 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.
More information aboutAbstractTensors
is available athttps://github.com/chakravala/AbstractTensors.jl
The GrassmannSubmanifold
elementsvₖ
andwᵏ
are linearly independent vector and covector elements ofV
, while the LeibnizOperator
elements∂ₖ
are partial tangent derivations andϵᵏ
are dependent functions of thetangent
manifold.An element of a mixed-symmetryTensorAlgebra{V}
is a multilinear mapping that is formally constructed by taking the tensor products of linear and multilinear maps.Highergrade
elements correspond toSubmanifold
subspaces, while higherorder
function elements become homogenous polynomials and Taylor series.
Combining the linear basis generating elements with each other using the multilinear tensor product yields a graded (decomposable) tensorSubmanifold
⟨w₁⊗⋯⊗wₖ⟩, wheregrade
is determined by the number of anti-symmetric basis elements in its tensor product decomposition.The algebra is partitioned into both symmetric and anti-symmetric tensor equivalence classes.For the oriented sets of the Grassmann exterior algebra, the parity of(-1)^P
is factored into transposition compositions when interchanging ordering of the tensor product argument permutations.The symmetrical algebra does not need to track this parity, but has higher multiplicities in its indices.Symmetric differential function algebra of Leibniz trivializes the orientation into a single class of index multi-sets, while Grassmann's exterior algebra is partitioned into two oriented equivalence classes by anti-symmetry.Full tensor algebra can be sub-partitioned into equivalence classes in multiple ways based on the element symmetry, grade, and metric signature composite properties.Both symmetry classes can be characterized by the same geometric product.
Higher-order composite tensor elements are oriented-multi-sets.Anti-symmetric indices have two orientations and higher multiplicities of them result in zero values, so the only interesting multiplicity is 1.The Leibniz-Taylor algebra is a quotient polynomial ring so thatϵₖ^(μ+1)
is zero.Grassmann's exterior algebra doesn't invoke the properties of multi-sets, as it is related to the algebra of oriented sets; while the Leibniz symmetric algebra is that of unoriented multi-sets.Combined, the mixed-symmetry algebra yield a multi-linear propositional lattice.The formal sum of equalgrade
elements is an orientedChain
and with mixedgrade
it is aMultivector
simplicial complex.Thus, various standard operations on the oriented multi-sets are possible including∪,∩,⊕
and the index operation⊖
, which is symmetric difference operation⊻
.
By virtue of Julia's multiple dispatch on the field type𝕂
, methods can specialize on the dimensionn
and gradeG
with aTensorBundle{n}
via theTensorAlgebra{V}
subtypes, such asSubmanifold{V,G}
,Single{V,G,B,𝕂}
,Couple{V,B,𝕂}
,Chain{V,G,𝕂}
,Spinor{V,𝕂}
, andMultivector{V,𝕂}
types.
The elements of theBasis
can be generated in many ways using theSubmanifold
elements created by the@basis
macro,
julia>using Grassmann;@basis ℝ'⊕ℝ^3# equivalent to basis"-+++"(⟨-+++⟩, v, v₁, v₂, v₃, v₄, v₁₂, v₁₃, v₁₄, v₂₃, v₂₄, v₃₄, v₁₂₃, v₁₂₄, v₁₃₄, v₂₃₄, v₁₂₃₄)
As a result of this macro, all of theSubmanifold{V,G}
elements generated by thatTensorBundle
become available in the local workspace with the specified naming.The first argument provides signature specifications, the second argument is the variable name for theTensorBundle
, and the third and fourth argument are the the prefixes of theSubmanifold
vector names (and covector basis names). By default,V
is assigned theTensorBundle
andv
is the prefix for theSubmanifold
elements.
It is entirely possible to assign multiple different bases with different signatures without any problems. In the following command, the@basis
macro arguments are used to assign the vector space name toS
instead ofV
and basis elements tob
instead ofv
, so that their local names do not interfere.Alternatively, if you do not wish to assign these variables to your local workspace, the versatileDirectSum.Basis
constructors can be used to contain them, which is exported to the user as the methodΛ(V)
.
The parametric type formalism inGrassmann
is highly expressive to enable the pre-allocation of geometric algebra computations for specific sparse-subalgebras, including the representation of rotational groups, Lie bivector algebras, and affine projective geometry.
Together withLightGraphs.jl,GraphPlot.jl,Cairo.jl,Compose.jl it is possible to convertGrassmann
numbers into graphs.
using Grassmann, Compose# environment: LightGraphs, GraphPlotx=Λ(ℝ^7).v123Grassmann.graph(x+!x)draw(PDF("simplex.pdf",16cm,16cm),x+!x)
Due toGeometryTypes.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)))
In order to work with aTensorAlgebra{V}
, it is necessary for some computations to be cached. This is usually done automatically when accessed.Staging of precompilation and caching is designed so that a user can smoothly transition between very high dimensional and low dimensional algebras in a single session, with varying levels of extra caching and optimizations.The parametric type formalism inGrassmann
is highly expressive and enables pre-allocation of geometric algebra computations involving specific sparse subalgebras, including the representation of rotational groups.
It is possible to reach elements with up toN=62
vertices from aTensorAlgebra
having higher maximum dimensions than supported by Julia natively.The 62 indices require full alpha-numeric labeling with lower-case and capital letters. This now allows you to reach up to4,611,686,018,427,387,904
dimensions with Juliausing Grassmann
. Then the volume element is
v₁₂₃₄₅₆₇₈₉₀abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
FullMultivector
allocations are only possible forN≤22
, but sparse operations are also available at higher dimensions.WhileDirectSum.Basis{V}
is a container for theTensorAlgebra
generators ofV
, theDirectSum.Basis
is only cached forN≤8
.For the range of dimensions8<N≤22
, theDirectSum.SparseBasis
type is used.
julia>Λ(22)DirectSum.SparseBasis{⟨++++++++++++++++++++++⟩,4194304}(v,..., v₁₂₃₄₅₆₇₈₉₀abcdefghijkl)
This is the largestSparseBasis
that can be generated with Julia, due to array size limitations.
To reach higher dimensions withN>22
, theDirectSum.ExtendedBasis
type is used.It is suficient to work with a 64-bit representation (which is the default). And it turns out that with 62 standard keyboard characters, this fits nicely.At 22 dimensions and lower there is better caching, with further extra caching for 8 dimensions or less.Thus, the largest Hilbert space that is fully reachable has 4,194,304 dimensions, but we can still reach out to 4,611,686,018,427,387,904 dimensions with theExtendedBasis
built in.FullMultivector
elements are not representable whenExtendedBasis
is used, but the performance of theSubmanifold
and sparse elements is possible as it is for lower dimensions for the currentSubAlgebra
andTensorAlgebra
types.The sparse representations are a work in progress to be improved with time.
- Michael Reed,Differential geometric algebra with Leibniz and Grassmann, JuliaCon (2019)
- 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)
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]
developed by /\ / \ ___ ___ __ __ _ _ / /\ \ / _ \ / __) / \/ /| | | | / /__\ \ | |_) )> _) ( () < | |_| | /________\| __/ \___) \__/\_\| ._,_| ______ | | | | \ ___) |_| |_| \ \ __ __ __ __ ___ ___ ___ ___ > > \ \ / / / \/ /( )( )/ __) / _ \ / /__ \ v / ( () < | | | | > _) | |_) ) /_____) > < \__/\_\ \_) \_)\___)| __/ / ^ \ | | /_/ \_\ |_| https://crucialflow.com https://github.com/chakravala _ _ _ | | | | | | ___| |__ __ _| | ___ __ __ ___ ____ _| | __ _ / __| '_ \ / _` | |/ / '__/ _` \ \ / / _` | |/ _` | | (__| | | | (_| | <| | | (_| |\ V / (_| | | (_| | \___|_| |_|\__,_|_|\_\_| \__,_| \_/ \__,_|_|\__,_|
About
⟨Grassmann-Clifford-Hodge⟩ multilinear differential geometric algebra