galgebra
galgebra copied to clipboard
grade involution (brombo/galgebra#40)
@Nelli-Khlyustova commented on Oct 4, 2018
Is grade involution available for general multivector?
For example, I have V = g3.mv('V', "mv") which is
V + V__xe1 + V__ye2 + V__ze3 + V__xye1^e2 + V__xze1^e3 + V__yze2^e3 + V__xyze1^e2^e3
But I wan to get this:
V - V__xe1 - V__ye2 - V__ze3 + V__xye1^e2 + V__xze1^e3 + V__yze2^e3 - V__xyze1^e2^e3
How can I do this?
@mevangelista-alvarado commented on Jan 15 • edited
Hi @Nelli-Khlyustova maybe this function helps you, regards.
def involution(multivector): '''This method takes a multivector a make your involution, example involution(x*ey+y*ex^ey)=x*ey- y*ex^ey''' grades = multivector.grades for grade in grades: if grade % 2 == 1: multivector = multivector + (-2)*multivector.get_grade(grade) return multivector
From http://webcache.googleusercontent.com/search?q=cache:https://github.com/brombo/galgebra/issues/40
involution
should be implemented. See also my implementation at https://github.com/pygae/GAlgebra.jl/blob/874dd59844fee98b918d070d6265353dcd3c1547/src/mv.jl#L243 .
GitHub
Julia interface to GAlgebra via PyCall. Contribute to pygae/GAlgebra.jl development by creating an account on GitHub.
Should be able to do a (possibly) faster implementation along the lines of
return self.subs({
b: b if len(i) % 2 == 0 else -b
for i, b in zip(self.indexes.flat, self.blades.flat)
})
Yeah indeed.