I've just found the sympy GA module, and I must say it looks really neat! 
I'd like to use it for automatic differentiation and equation solving in 
high-dimensional conformal geometric algebra. While experimenting with the 
module, I've run into a few problems though. I'm not familiar with sympy 
internals, so before I dive into the source of this module to fix things, 
I'd like to see if anyone can tell me if these are really bugs or if I'm 
misunderstanding something.

All examples below are run in isympy, just pulled from github. I 
initialized with:
from sympy.galgebra.GA import *
e1,e2,e3= MV.setup('e1 e2 e3', '1 0 0, 0 1 0, 0 0 1')


   1. Division:
   
   When I perform e1 / e1, I get an error: "TypeError: unsupported operand 
   type(s) for /: 'MV' and 'MV'". Is this not implemented? For non-null 
   vectors (i.e. x >> x != 0), the inverse is x / (x >> x). The inverse of a 
   product of invertible vectors is just the reverse product of the inverses. 
   For an invertible blade A, this reduces to A / (A >> A). 
   2. Solving equations:
   
   I tried to solve some basic equations, e.g.
   >> solve( (x - e1) * e2, x)
   _1*e1e2/e2
   
   This is correct, but strangely it involves division which doesn't appear 
   to work when typed into the terminal. Other examples that act strange:
   >> solve( (x - e1) >> e2, x)
   []
   >> solve( (x - e1) | e2, x)
   [0]
   
   Even though | and >> should both implement contraction.
   3. Efficiency:
   I tried MV.setup on some high-dimensional algebras, and noticed that it 
   takes very long to initialize beyond n=8. The multivector basis is 2^n, so 
   a slowdown is to be expected, but 2^8 = 256, which seems a bit low. Would 
   it be possible to speed up the implementation, e.g. using 
bitarray<https://pypi.python.org/pypi/bitarray> to 
   represent the presence or absence of a multivector basis element, and 
   compute products using a combination of scalar multiplication on numpy 
   arrays and bitwise operations on bitarrays?
   4. Notation for outer product and powers:
   I find the notation '**' for the wedge product confusing. Consider 
   typing this into a terminal:
   >> e1*e1
   e1**2
   >> e1**2
   2*e1
   
   Why is the result of e1*e1 (e1 squared) written in the usual python 
   exponentiation notation e1**2, while at the same time we cannot use that 
   notation to perform exponentiation? I think it would be best to use ** for 
   exponentiation, since that is the python standard. We can use ^ for the 
   wedge, which is visually most natural anyway.
   5. Contraction with scalar doesn't work.
   When I compute e1 >> 2, or any other contraction with a scalar, I get 
   None. The correct results is 0 when a (multi)vector is contracted onto a 
   scalar. When a scalar is contracted onto a multivector, the result should 
   be the same as scalar multiplication.


If I can make it all work I might be interested in implementing a module 
for conformal GA, and one for linking sympy to GAViewer. The latter would 
make it possible to visualize results from symbolic computations in a 3D 
viewer.

Thanks in advance for any help!

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to