On Sat, Nov 1, 2014 at 4:14 AM, Francesco Bonazzi <[email protected]> wrote: > > > On Friday, October 31, 2014 5:53:23 PM UTC+1, Jamie Titus wrote: >> >> Hello all, >> >> I was wondering if anybody knew what the status of the Tensor module is - >> i.e., is work being done on it, what is the known functionality, and what is >> the intended functionality. For the past week I have been attempting to use >> Sympy for basic General Relativity (homework problems really), and it has >> not gone well. > > > Yes, unfortunately there's still a lot to do before it can be used, just > consider that it is completely unable to express derivatives. > >> >> My naive review of the documentation suggests that I should be able to use >> Einstein Notation, since I am completely unfamiliar with Penrose's abstract >> index notation (and it doesn't seem to be as useful computationally, >> frankly, though the wikipedia article on it is very short). > > > The idea behind the abstract index notation is simple: the structure of > contracted indices is basis-independent, A(i0, -i0) has the same value in > all coordinate systems, so someone may want to reason about the index > structure (and contractions) without working on a coordinate basis. > >> However, I keep encountering errors when I try to do basic operations such >> as add or multiply tensors, and I am never quite sure if they are bugs or >> features. A minimal example is that when you attempt to symmetrize a tensor >> you just get back double the tensor components, i.e., given a TensorHead A, >> and indices i0, i1, A(i0, i1) + A(i1, i0) should be manifestly symmetric, >> but it just results in 2*A(i0, i1). If necessary I can provide minimal >> working examples in code. I wasn't sure if this is the right place for that. > > > Whenever you add tensor expressions, the canonicalizer is automatically > called. Given the set of all permissible permutations of indices (and anti > commutations by inverting the sign of the tensor), the canonicalizer picks > the one which would come first alphabetically, that is A(i1, i0) becomes > A(i0, i1). Thus A(i0, i1) + A(i0, i1) gets simplified to 2*A(i0, i1). > > It is not clear whether this is the desired behaviour, also considering that > such an excessive use of the canonicalizer seriously slows down performance.
When in doubt, don't do automatic simplification. You can always have simplify() or doit() or whatever canonicalize the expression. If an expression doesn't auto-simplify it is always possible to force it to simplify later, but if it always auto-simplifies, it is impossible to make it not do so. I wrote some thoughts on this at https://github.com/sympy/sympy/wiki/Automatic-Simplification a while back. This case clearly violates the rule that it should be fast, and the rule that it should be something that no one would ever not want to do. Aaron Meurer > >> >> I honestly found the Tensor module very confusing from the standpoint of >> somebody who is interested in solving simple GR problems, so I'd like to try >> to understand the rationale behind it and make things clearer for other >> users. > > > Currently, it simply handles basic polynomials of tensors in expanded form. > I added the .data property to do some reasoning with component data, but I'm > not very glad with it. I think that the tensor module need an extension to > support indices representing coordinate systems and basis elements of those > coordinate systems. This would require to add support for repeated indices > to the canonicalizer. > > Anyways, if you would like to do some calculations, I suggest you have a > look at sympy.diffgeom. Here an example of how to derive the Schwarzschild > metric with diffgeom: > > http://krastanov.files.wordpress.com/2012/07/schwarzschild.pdf > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/d7d0eaa7-e616-407e-a27b-a1c4ff2ff6c1%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6LLEsxFK3GmXoS_-0nGhg7if_3Biane%2BXL0WKz3LvHQBg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
