galgebra icon indicating copy to clipboard operation
galgebra copied to clipboard

Add support for the right and left complement

Open eric-wieser opened this issue 4 years ago • 2 comments

The right complement of the basis blades can be found with

from galgebra.ga import GradedTuple

def right_complement_blades(ga):
    # relies on the lexicographic ordering of `ga.indices`
    blades = []
    for fwd_blades, rev_blades in zip(ga.blades, reversed(ga.blades)):
        blades_single_grade = []
        for fwd_blade, rev_blade in zip(fwd_blades, reversed(rev_blades)):
            sign = ga.wedge(fwd_blade, rev_blade) / ga.e.obj  # swap the order of the wedge for left complement
            blades_single_grade.append(sign * rev_blade)
        blades.append(tuple(blades_single_grade))
    return GradedTuple(blades)

With that in place, the complement of any multivector can be taken componentwise.

This would enable:

  • vee in PGA without incurring the metric
  • Generalized multivector derivatives

eric-wieser avatar Jan 03 '20 14:01 eric-wieser

👍

utensil avatar Jan 04 '20 14:01 utensil

Just commenting to note that the above code still works in 0.5.0. The rest of the puzzle is something like

from galgebra import metric

ga = ...

lookup = dict(zip(ga.blades.flat, right_complement_blades(ga).flat))

def right_complement(e):
    return a.Ga.mv(sum([
        coef * lookup[base]
        for coef, base in metric.linear_expand_terms(e.obj)], S.Zero))

eric-wieser avatar Mar 18 '21 19:03 eric-wieser