README

Geometric Algebra in Raku

The MultiVector module in this repository is an attempt to implement basic Geometric Algebra in Raku.

With this module you can create vectors of arbitrary, albeit countable dimension. You can then add and substract them, as well as multiplying them by real scalars as you would do with any vectors, but you can also multiply and divide them as made possible by the geometric algebra.

The module exports three array constants @e, @i and @o which serve as normed bases for three orthogonal spaces respectively Euclidean, anti-Euclidean and null.

In addition to the usual overloading of arithmetic operators, the module also defines the infix operators āˆ§ and Ā· (vim digraphs "AN" and ".M") as the outer and scalar products. The scalar product is defined only on vectors (i.e. multivectors of grade one).

Synopsis

use MultiVector;

say @e[0];         # eā‚€
say @e[1]*@e[0];   # -eā‚€āˆ§eā‚
say 1 + @e[4];     # 1+eā‚„
say @i[3]āˆ§@e[2];   # -eā‚‚āˆ§iā‚ƒ
say @o[2]āˆ§@i[2];   # -iā‚‚āˆ§oā‚‚

say @e[1]Ā²;      # 1
say @i[1]Ā²;      # -1
say @o[1]Ā²;      # 0

say @o[0](@e[1] + 2*@o[0]);  # 2

External links

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.