I think I did not explain what I was after. I should clarify that I am not an expert on geometric algebra, but I am captivated by its generality and uniformity.
Geometric algebra subsumes complex numbers, quaternions, and trickier concepts like the distinction between a vector and a so-called âpseudovectorâ.
I believe itâs useful and necessary to regard of the state of affairs for doing spatial mathematics as a âlegacy systemâ. People do spatial math using quaternions, cross products, triple products, and so on. There is an existing language, and from a certain perspective GA is a better language since the structure of all of these operations and objects exist within non-projective 2^3-dimensional geometric algebra (I guess notated G_{3,0,0}). There are uniform and systematic names for complex numbers, dual numbers, quaternions, etc.
But what about migration? A person can have never heard of geometric algebra, but still build a physics simulator using the language they already know. Pedagogically, I think itâs probably the right strategy to teach someone about complex numbers before you teach them about geometric algebra. The former is just a special case of the latter, and special cases matter.
So whatâs the migration path? I have a function from a library that is not GA-aware and it operates with Base.Complex
. There is another library that is âGA-awareâ and because of that, more general. How do I make them interoperate?
I respect, and might even personally agree with
This is going to be my default algebra for everything, and I will rarely if ever use other ones.
but I donât think it addresses âtaking quaternions seriouslyâ. I think Jiahaoâs talk on Taking Vector Transposes Seriously was truly amazing for me to understand the spirit behind âtaking [math thing] seriouslyâ. The effort is strongly informed by history, practice, notation, and other programming languages to develop the taxonomy of âtype 1â and âtype 2â systems. To further the analogy, there are systems which as far as I can tell completely subsume the discussion on transposes in linear algebra. But itâs important to make this special case work well.
To be more concrete, if geometric algebra is the solution, I want something like the following to work. Itâs likely that it shouldnât work as I wrote it, but instead with the introduction of some shim type that wraps a certain kind of Multivector
in a type so that it behaves like Complex
.
(On Grassmann a79bff6d, the head of the default branch at time of writing)
julia> using Grassmann
julia> basis"-" # make something that behaves like complex numbers
(â¨-âŠ, v, vâ)
julia> imⲠ= v1
vâ
julia> 2 + 3imâ˛
2 + 3vâ
julia> (2 + 3imâ˛) * (5 + 7imâ˛)
-11 + 29vâ
julia> real(2 + 3imâ˛)
2 + 3vâ
julia> imag(2 + 3imâ˛)
ERROR: BoundsError: attempt to access (0, 1)
at index [3]
Stacktrace:
[1] getindex(::Tuple, ::Int64) at ./tuple.jl:24
[2] getindex at /Users/goretkin/.julia/packages/StaticArrays/l7lu2/src/SVector.jl:39 [inlined]
[3] imag(::MultiVector{â¨-âŠ,Int64,2}) at /private/tmp/dev/Grassmann/src/parity.jl:246
[4] top-level scope at REPL[15]:1
[5] eval(::Module, ::Any) at ./boot.jl:331
[6] eval_user_input(::Any, ::REPL.REPLBackend) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
[7] run_backend(::REPL.REPLBackend) at /Users/goretkin/.julia/packages/Revise/BqeJF/src/Revise.jl:1184
[8] top-level scope at none:0
julia> (2 + 3imâ˛) * (5 + 7im)
10 + 14im + (15 + 21im)vâ