Well, now I am having trouble reproducing the problem I had.  I was getting:

In [23]: M(i, j, n).args
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/aaronmeurer/Documents/Python/sympy/sympy/<ipython console> in <module>()

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/tensor/indexed.pyc in 
__call__(self, *indices, **kw_args)
    121 
    122     def __call__(self, *indices, **kw_args):
--> 123         return IndexedElement(self, *indices, **kw_args)
    124 
    125     @property

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/tensor/indexed.pyc in 
__new__(cls, stem, *args, **kw_args)
    154 
    155         # FIXME: 2.4 compatibility

--> 156         args = map(_ensure_Idx, args)
    157         # args = tuple([ a if isinstance(a, Idx) else Idx(a) for a in 
args ])

    158         return Expr.__new__(cls, stem, *args, **kw_args)

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/tensor/indexed.pyc in 
_ensure_Idx(arg)
    135         return arg
    136     else:
--> 137         return Idx(arg)
    138 
    139 class IndexedElement(Expr):

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/tensor/indexed.pyc in 
__new__(cls, label, range, **kw_args)
    235 
    236         if not label.is_integer:
--> 237             raise TypeError("Idx object requires an integer label")
    238 
    239         elif isinstance(range, (tuple, list, Tuple)):

TypeError: Idx object requires an integer label

But now I just get

In [21]: M(i, j, n).args
Out[21]: (M, i, j, n)

By the way, shouldn't it be just (i, j, n), like Function does?

In [20]: f(x, y).args
Out[20]: (x, y)

But anyway, now that it works, I think I can get somewhere. 

Aaron Meurer

On Sep 19, 2010, at 11:20 AM, Aaron S. Meurer wrote:

> So given Chris's tip in issue 2058 (which flew over my head the first time 
> for some reason), I think I might have this figured out, except for one 
> thing.  Given M(i, j, n), how to I get the third argument, n?  I tried M(i, 
> j, n)[2] and M(i, j, n).args, but neither works.
> 
> Aaron Meurer

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@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