Yeah, Wild subclasses from Expr, alas. The logpy solution is to have a dispatched isvar function.
It seems to me that the all tensor indices are in some sense wild. Shouldn't A[i, -i] unify to A[j, -j] ? On Wed, Apr 2, 2014 at 9:41 AM, F. B. <[email protected]> wrote: > OK, after the last PR has been merged, I did some tests on the indices and > there are still problems with .match( ) and .replace( ), while .subs( ), > .replace(..., simultaneous=False), and .xreplace( ) seem to work. The > current problem is that wilds are not allowed in the expression tree, > because the object containing the tensor indices tries to access internal > properties of the indices, which Wild does not possess, thus raising an > error. > > I did a grep of the unify module, and it looks like .match and .replace > are not used, so this should not be an urgent issue. > > I don't know whether it's worth to address this issue, but I envisioned an > attempt to leave the current procedural programming style to approach a > more functional style. There should also be a refactory in order to allow > operators such as the partial derivative to act on tensor expressions, > possible ideas: > > - create a DummyTensorIndex type, similar to TensorIndex, dummy > indices would be stored into the arg-tree as instances of DummyTensorIndex > instead of TensorIndex. > - it makes no sense anymore to consider the index order until the > operators are unevaluated, e.g. > PartialDerivative(A(i)*B(j, k)*A(-k) + C(-k, j, i)*A(k), A(h)) > > has a (i, j, -h) index signature, but it makes no sense to consider > the index order. Yet one could wish to multiply the unevaluated operator by > a tensor and perform a contraction, e.g. > D(-h)*PartialDerivative(A(i)*B(j, k)*A(-k) + C(-k, j, i)*A(k), A(h)) > This should be a TensMul object, but it cannot possess positional > info. Solving this issue would also pave the way to unexpanded tensor > expressions. > - Should DummyTensorIndex and TensorIndex have a wild=True/False > parameter to solve the issue of matching contracted indices? > > In any case, introducing operators requires some refactory of the current > index algorithms. Fortunately there is now a separate TIDS class used to > stored all such algorithms. > > -- > 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/eb0fdec5-18e6-47c3-b631-e3a791ab2f6e%40googlegroups.com<https://groups.google.com/d/msgid/sympy/eb0fdec5-18e6-47c3-b631-e3a791ab2f6e%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > 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/CAJ8oX-GLsX9W_brk-W3Toh0notH6CswJAmmyv8X5otdoE0FcfQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
