I actually do believe that a core for expressions with indices is possible here. But I don't have as much experience as Kasper, so I could be wrong.
On Wed, Mar 5, 2014 at 11:23 AM, Kasper Peeters <kasper.peet...@gmail.com>wrote: > So how do you propose Cadabra would work with SymPy or CSymPy? Would >> there be some core in Cadabra, that works well with SymPy, that people >> can use to >> build useful things upon it, or just use it for calculations? > > > The way this will work is that there are 'cadabra.Ex' objects which > represent cadabra > tensor expressions. These can be manipulated with cadabra algorithms. For > example, > > from cadabra import * > > Indices( Ex('{m,n,p,q,a,b}') ) > ex =Ex( 'A_{m n} ( C^{n p} + D^{n p} )' ) > rule=Ex( 'C^{a b} -> M_{m} D^{m a b}' ) > > substitute(ex, rule) > print(ex) > > would give > > A_{m n} ( M_{q} D^{q n p} + D^{n p} ) > > You can then assign scalar expressions to the components of tensors in > tensor expressions (again using a cadabra notation as above). And then you > can extract components of tensors as sympy expressions. To expand on the > above, > > Symbol( 'x, y' ) > assign:=Ex(' A_{0 1} = 3 x, A_{0 2} = y**2, D^{0 1 2} = x y, ...' ) > Extract( ex, assign, 'm=1, p=2' ) > > would give you a Sympy expression for the m=1, p=2 component of the > composite > tensor defined earlier (the notation in this last bit is not yet set in > stone, I am > experimenting with different options). > > So essentially all tensor computation happens within Cadabra, with its own > symbolic > tree for tensor expressions which is independent of Sympy), and if you > want to > do component computations you have a way to extract components from tensors > in the form of Sympy expressions. > > Hope that makes it a little bit more clear. > > Cheers, > Kasper > > -- > 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 sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > 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/1e9dd4a8-d2c6-4b86-982c-b7fe32f86252%40googlegroups.com<https://groups.google.com/d/msgid/sympy/1e9dd4a8-d2c6-4b86-982c-b7fe32f86252%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/groups/opt_out. > -- 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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. 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-G-LF52M7%3DHCeT26Fiu2m9FbTQJwg-VAp79pPvz5tXQrQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.