Dear all,

Before the switch to Pynac, it was possible to access parts of
expressions by indexing, e.g.
f = x^3 + 2*x^2 + 3*x
f[0]
x^3

Now I get the error message
TypeError: 'sage.symbolic.expression.Expression' object does not
support
indexing

Below, I pasted an example how Burcin wanted to implement indexing in
Pynac. Has this ever happened, or is there another way of accessing
parts of expressions? I am currently trying to extract the terms in
the exponent of an expression, but I don't know how to do it easily.

Thanks for your help!

Stan


On Mar 21 2009, 7:32 pm, Burcin Erocal <[email protected]> wrote:

>
> It's in pynac already:
>
> sage: var('x,y',ns=1)
> (x, y)
> sage: f = expand((1+x+1/y)^10)
> sage: f.nargs()
> 66
>
> I could hook this up to __len__ as well, since __getitem__ lets you
> accesspartsof the expression. E.g.,
>
> sage: f[0]
> x^10
> sage: f[1]
> 10*x^9
>
> Cheers,
> Burcin

-- 
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/sage-support
URL: http://www.sagemath.org

Reply via email to