I ran into this problem in MatrixExprs.  We don't currently have a
subscripted symbol.  It would be nice though.

In the following example
In [1]: X = MatrixSymbol('X', n, n)

In [2]: X[1, 2]
Out[2]: X₁₂

Ideally X[1, 2] is a Symbol that contains separate information for its
origin X and its indices, 1, and 2.  Alas, all it knows is the combined
string "X_12".




On Sat, Dec 1, 2012 at 7:30 AM, Shriramana Sharma <[email protected]> wrote:

> On Sat, Dec 1, 2012 at 6:46 PM, Chris Smith <[email protected]> wrote:
> >
> > that's what symbols does for you; just store the result in an array if
> you
> > want:
> >
> >>>> a=symbols('a:11')
> >>>> a[1]
> > a1
> >>>> a
> > (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
>
> But I already said that I can't use a Python list because I can't then
> use something like a[i] as part of an expression where i is a symbol.
> For example summation(a[i],(i,0,n)) would throw an IndexError or
> something saying that the index of a list has to be an integer. The
> SymList or something that I visualize should be able to handle the
> above.
>
> > Have you looked at Indexed?
>
> Hey nice, but still I have this problem:
>
> from sympy import IndexedBase
> A=IndexedBase('A')
> solve([A[0] + 5*A[1] - 2, -3*A[0]+ 6*A[1] - 15])
>
> produces at the end of the source trace:
>
> AttributeError: 'int' object has no attribute 'free_symbols'
>
> The subscriptable symbol which I expect should be able to handle the
> above solve command. Or if I have to alter my usage slightly (i.e.
> without using all that atoms etc) for IndexedBase itself (or some
> existing subclass thereof) to be able to handle the above solve,
> please indicate it. Thanks!
>
> --
> Shriramana Sharma
>
> --
> 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.

Reply via email to