git can help you find where things came from. Using git log -S"r+=str(idx)" —all and git describe <most recent commit given from that>, it looks like it used to be in an example file called tensors.py that was removed at the end of 2008, before the release of 0.6.4.
On May 26, 2010, at 7:10 PM, [email protected] wrote: > Hi Ondrej, > > This code is taken from something you put together which was called > tensors.py in 0.6.3, at least that is where I found it on my system, > since I still have 0.6.3 on my disk. I am currently using 0.6.6.6. I > extracted the imports and the class defs from there and put it in a > file certekten.py so I could isolate the defs. It is not clear to me > all your experiment had in mind. What I need to do first is to: > > 1. figure out how to design classes which allow the definition of > arbitrary mixed rank tensors: TensorDefine(tensorname,rankindices) > where tensorname is just a desired symbol name and rankindices is > something like [pcovariant,qcontravariant] or > [icov1,icov2,...,icontra1,icontra2,...]. The resulting object should > be a symbol decorated with the collection of p contravariant and q > covariant indices. > 2. the rendering (prettyprinting) should produce these with latex type > upper and lower indices...like g^{ij} and g_{kl} for example. The guide here should help you with the pretty printing: http://docs.sympy.org/modules/printing.html Aaron Meurer > 3. Rules need to be introduced so that contraction (==sum over > repeated contravariant and covariant indices) should be handled > correctly. > 4. derivative operations should be handled e.g. by distribution over > sums, Leibniz product rule symbolically handled, e.g. \partial > ( tensor1 * tensor2) ) = (\partial tensor1) * tensor2 + tensor1 * > (\partial tensor2), etc, etc. > > plus probably many others. I have looked at scheme implementations > and while I am not very conversant with scheme, it does appear that > Sussman and coworker(s) at MIT have done the differential geometry > stuff. I don't think it focuses on indicial gymnastics but it does > seem to define generic objects which are "up" and "down" as well as > covariant derivative, Ricci tensor, Riemann tensor, the components of > the symmetric connection, etc. I was looking at the scheme way > because I am interested in what kind of data structures they end up > defining for tensor kinds of objects with an eye of maybe using those > as a guide/suggestion as to how tensor objects may be adequately > 'classed' in python/sympy. > > I have also spent some time recently looking over the sympy core code > trying to get better educated with a hope to see what might be good > ways to go in defining tensor objects... but due to my relative > inexperience I can not seem to see how to translate the properties I > think I want into correctly defined python/sympy. > > I am fully aware of your relativity.py example code, which is fine for > what it does. However, there the indices are all integers and the > differentiation is explicit diff, not what is needed in the much more > formal expression handling of tensor algebra and calculus. > > I would appreciate help from the sympy community on how to do these > things. > > Comer > > On May 26, 6:18 pm, Ondrej Certik <[email protected]> wrote: >> On Wed, May 26, 2010 at 12:43 PM, [email protected] >> >> <[email protected]> wrote: >>> Hi, >> >>> I am trying to understand some apparently old code written by Ondrej >>> trying to implement what I think are indicial tensor expressions. I >>> list below the class definitions and then try to give an example. The >>> example results in an error. I believe I recall that Ondrej says that >>> these definitions don't work, but I am trying to understand them and >>> want to try to create some appropriate classes which can contain >>> indicial tensors. >> >> Where is this code from? I think I wrote something like this, but it's >> quite some time ago, so I forgot which issue it is. >> >> It'd be awesome if you wanted to do some support for tensors in sympy. >> The only example, that is known to work is the >> >> python examples/advanced/relativity.py >> >> and I just tried it and it seems to work. So that shows how to get >> something working, and what we need now is some general support for >> tensors. >> >> 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. > -- 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.
