galgebra icon indicating copy to clipboard operation
galgebra copied to clipboard

expression like 1/<Mv> raise exception

Open mammalwong opened this issue 10 months ago • 2 comments

The current Mv class missing an implementation of the __ rtruediv __ method, it makes a simple expression like 1/I (where I is the pseudoscalar multivector) raise exception because the integer/float class clearly can't handle division by a Mv object. It is not a functional issue but a great QoL improvement if the Mv class implements the __ rtruediv __ method.

mammalwong avatar Apr 23 '24 07:04 mammalwong

@mammalwong Can you also post minimal working example for this issue? Thanks!

utensil avatar May 09 '24 14:05 utensil

To reproduce:

ga = Ga('e', g=[1,1,1], coords=S.symbols(f"0:{3}", real=True), wedge=False)
ex,ey,ez = ga.mv()
1/ex

throws exception:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-11-0aacfa68a149> in <cell line: 3>()
      1 ga = Ga('e', g=[1,1,1], coords=S.symbols(f"0:{3}", real=True), wedge=False)
      2 ex,ey,ez = ga.mv()
----> 3 1/ex

TypeError: unsupported operand type(s) for /: 'int' and 'Mv'

mammalwong avatar May 09 '24 14:05 mammalwong