pygae / galgebra

Symbolic Geometric Algebra/Calculus package for SymPy :crystal_ball:
https://galgebra.rtfd.io/
BSD 3-Clause "New" or "Revised" License
233 stars 62 forks source link

expression like 1/<Mv> raise exception #512

Open mammalwong opened 7 months ago

mammalwong commented 7 months ago

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.

utensil commented 6 months ago

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

mammalwong commented 6 months ago

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'