geometric algebra neglect denominator in inv() when Format(ipy=True)

31 views
Skip to first unread message

chaowen guo

unread,
Apr 3, 2015, 9:55:17 PM4/3/15
to sy...@googlegroups.com
A test example:

import sympy.galgebra
sympy.galgebra.Format(ipy=True)
base=sympy.galgebra.MV.setup('e*1|2')
str(sympy.galgebra.MV.I.inv())

output: '-\\bm{e_{1}\\W e_{2}}'
and the output just print the numerator and neglect denominator

because the correct answer is:

str(sympy.galgebra.MV.Iinv)
output: '- \\frac{1}{\\lp e_{1}\\cdot e_{1}\\rp  \\lp e_{2}\\cdot e_{2}\\rp  - \\lp e_{1}\\cdot e_{2}\\rp ^{2}}\\bm{e_{1}\\W e_{2}}'
now it has numerator and denominator

Chaowen GUO

Mike Boyle

unread,
Apr 4, 2015, 11:10:10 AM4/4/15
to sy...@googlegroups.com
This bug apparently shows up with some help from the formatting method.  In particular, if you take out the 

sympy.galgebra.Format(ipy=True)

line, you get the correct answer.

The formatting code in galgebra is a bit of a mess, and in fact the whole project is moving out of sympy to its own project.  Anyway, I've opened up a bug report about this on github.  In the meantime, I suggest you just stick to ugly formatting.

Alan Bromborsky

unread,
Apr 7, 2015, 1:37:58 PM4/7/15
to sy...@googlegroups.com
Using galgebra at github.com/brombo/galgebra

and

from ga import Ga
base = Ga('e*1|2')
I = base.I()
Iinv = I.inv()
print 'I =',I
print '1/I =',Iinv
print 'I*(1/I) =',I*Iinv

I get

I = e_1^e_2/sqrt(Abs((e_1.e_1)*(e_2.e_2) - (e_1.e_2)**2))
1/I = -sqrt(Abs((e_1.e_1)*(e_2.e_2) - (e_1.e_2)**2))*e_1^e_2/((e_1.e_1)*(e_2.e_2) - (e_1.e_2)**2)
I*(1/I) = 1

Somethings have changed quite a bit.  Look at the documentation at github.com/brombo/galgebra

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/24b155aa-dc45-4666-87a7-29313b4000fe%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages