What about this?

class Syms(object):
    """Return an Indexed object with name given at instantiation.
    Indexing can be done using matrix or function notation.

    Examples
    ========

    >> from sympy.future import Syms
    >> a=Syms('a')
    >> a[1]
    a[1]
    >> a(1)
    a[1]
    >> a(i,k)
    a[i, k]

    """
    def __new__(cls, name):
        obj = object.__new__(cls)
        obj.name = name
        return obj
    def __getitem__(self, *i):
        return Indexed(self.name, *i)
    def __call__(self, *i):
        return Indexed(self.name, *i)

>>> eqs=Tuple(a[i]+a[j]-3,a[i]-a[j]+4)
>>> idx=eqs.atoms(Indexed)
>>> dum=[Dummy() for ii in idx]  # don't use i as loop variable
>>> Dict(solve(eqs.subs(zip(idx, dum)), dum)).subs(zip(dum,idx))
{a[i]: -1/2, a[j]: 7/2}
>>> Sum(a[i],(i,1,4))
Sum(a[i], (i, 1, 4))
>>> _.doit()
a[1] + a[2] + a[3] + a[4]

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to