On Sat, Mar 21, 2009 at 2:04 PM, [email protected]
<[email protected]> wrote:
>
> Ondrej,
>
> I have taken the tensor.py script and have stripped out most of it,
> wanting to see just how far it gets before crashing. Here is what I
> have:
Which tensor.py have you taken?
>
>
> from sympy import exp, Symbol, sin, Rational, Derivative, dsolve
>
> from sympy.core import Basic, Function
> from sympy.matrices import Matrix
>
> class Indexed(Basic):
> def __init__(self, A, idxlist):
> self._args = [A, idxlist]
>
> def __str__(self):
> r = str(self[0])
> for idx in self[1]:
> r+=str(idx)
> return r
>
> class Idx(Symbol):
> def __init__(self, name, dim = 4, up = True):
> Symbol.__init__(self, name)
> #self._args.extend([dim,up])
> self._name = name
> self._dim = dim
> self._up = up
>
> def __str__(self):
> if self._up:
> r = "^"
> else:
> r = "_"
> return r+self._name
>
> �...@property
> def up(self):
> return Idx(self._name, self._dim, True)
>
> �...@property
> def dn(self):
> return Idx(self._name, self._dim, False)
>
> def values(self):
> return range(self._dim)
>
>
> mu = Idx("mu")
> nu = Idx("nu") <<====== by the way this was "mu" in the orginal,so I
> changed it.
> i = Idx("i")
> m = Idx("m")
> k = Idx("k")
> l = Idx("l")
> g = Indexed(Symbol("A"), [mu,nu])
>
> print g[i.up,m.up]
> #print g
>
> As you can see I deleted the schwarzschild metric stuff as I am only
> interested in the indicial performance. This did not illuminate
> anything really. Here is what I get when I run it:
>
> debian:~/sympy-0.6.3> python examples/indexed.py
> Traceback (most recent call last):
> File "examples/indexed.py", line 62, in ?
> print g[i.up,m.up]
> TypeError: unsubscriptable object
>
> I am hoping to see
>
> im
> g
>
> although I did not use pprint..,
>
> In any event, can you please explain a bit more about what you would
> expect this example to produce?
I don't know which example you mean. the relativity.py example works fine.
Ondrej
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---