Sympy tensor module

67 views
Skip to first unread message

Alan Bromborsky

unread,
Jun 10, 2010, 3:54:46 PM6/10/10
to sympy
Hopefully my version of sympy with the tensor module is now at github
under brombo/sympy-tensor. There is html documentation if you "make
html" in the doc directory and an example at
sympy-tensor/sympy/tensor/examples. Please play with it and give me
feedback.

Øyvind Jensen

unread,
Jun 12, 2010, 8:06:07 AM6/12/10
to sympy
I'm at commit d0acf2e92ebbd921b492f4db430d967bc7bea091 and try to run
the examples, but I get an error:

[oy@ubuntulaptop sympy (alan)]$ python sympy/tensor/examples/
testtensor.py
Traceback (most recent call last):
File "sympy/tensor/examples/testtensor.py", line 3, in <module>
from sympy.tensor.tensor import *
ImportError: No module named tensor.tensor

Alan Bromborsky

unread,
Jun 12, 2010, 8:33:06 AM6/12/10
to sy...@googlegroups.com
Did you do both 'sudo python setup.py install' and 'sudo python
setupegg.py install' or in the example you can change

import sys
from sympy.tensor.tensor import *
#sys.path.append('../')
#from tensor import *

to

import sys
#from sympy.tensor.tensor import *
sys.path.append('../')
from tensor import *


The problem I see with regard to using the functions associated with
'Expr' is the problem with the tensor contraction operation. If it were
not for contraction subclassing 'Expr' would be a great idea. I would
welcome any ideas on how to make 'Expr' compatible with contraction.
Could there be a problem in subclassing 'Expr' when the required
operators are more that just +,-,*, and / ?

Øyvind Jensen

unread,
Jun 12, 2010, 8:58:18 AM6/12/10
to sy...@googlegroups.com
I'm running it in my working directory without installing it. I added a
__init__.py file with just the line "import tensor", and now it works.

[oy@ubuntulaptop sympy (alan)]$ cat sympy/tensor/__init__.py
import tensor

>
> The problem I see with regard to using the functions associated with
> 'Expr' is the problem with the tensor contraction operation. If it were
> not for contraction subclassing 'Expr' would be a great idea. I would
> welcome any ideas on how to make 'Expr' compatible with contraction.
> Could there be a problem in subclassing 'Expr' when the required
> operators are more that just +,-,*, and / ?
>

What is the specific problem with the tensor contraction?

Øyvind

Alan Bromborsky

unread,
Jun 12, 2010, 9:33:08 AM6/12/10
to sy...@googlegroups.com
> �yvind
>
>
How do you make substitute check and see if the co and contra-variant
ranks of the tensor being substituted are the same as the original?

Øyvind Jensen

unread,
Jun 12, 2010, 9:51:18 AM6/12/10
to sy...@googlegroups.com
> >
> How do you make substitute check and see if the co and contra-variant
> ranks of the tensor being substituted are the same as the original?
>
You could try to overload Basic._eval_subs()

Alan Bromborsky

unread,
Jun 12, 2010, 10:32:29 AM6/12/10
to sy...@googlegroups.com
I wonder how many of the 'Expr' and 'Basic' class methods I can actually
use in 'Tensor' without modification?
Reply all
Reply to author
Forward
0 new messages