Scott wrote:
Does the geometric algebra module work interactively?
When I run the following code in an ipython shell it seem to not like
the basis format.
I can run the demo scripts form
http://docs.sympy.org/modules/galgebra/GA/GAsympy.html
with latex output with no trouble.
Cheers,
Scott
from sympy.galgebra.GA import *
basis = 'a0 a1 a2 n nbar'
metric = '# # # 0 0, # # # 0 0, # # # 0 0, 0 0 0 0 2, 0 0 0 2 0'
g=MV.setup(basis,metric)
AttributeError Traceback (most recent call
last)
/home/cb/<ipython console> in <module>()
/usr/lib/pymodules/python2.6/sympy/galgebra/GA.pyc in setup(basis,
metric, rframe, coords, debug, offset)
831 for coord in coords:
832 basislst.append(MV.basisroot
+'_'+str(coord))
--> 833 MV.define_basis(basislst)
834 if type(metric) == types.StringType:
835 MV.metric_str = True
/usr/lib/pymodules/python2.6/sympy/galgebra/GA.pyc in
define_basis(basis)
423 """
424 MV.vbasis = basis
--> 425 MV.vsyms = make_symbols(MV.vbasis)
426 MV.n = len(MV.vbasis)
427 MV.nrg = range(MV.n)
/usr/lib/pymodules/python2.6/sympy/galgebra/GA.pyc in
make_symbols(symnamelst)
204 tmp = sympy.Symbol(name)
205 sym_lst.append(tmp)
--> 206 setattr(MAIN_PROGRAM,name,tmp)
207 isym += 1
208 return(sym_lst)
AttributeError: 'str' object has no attribute 'a0'
Try the following:
In [1]: import sys
In [2]: from sympy.galgebra.GA import *
In [3]: set_main(sys.modules[__name__])
In [4]: basis = 'a0 a1 a2 n nbar'
In [5]: metric = '# # # 0 0, # # # 0 0, # # # 0 0, 0 0 0 0 2, 0 0 0 2 0'
In [6]: g=MV.setup(basis,metric)
In [7]:
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.