[sage-support] Re: Accessing terms in an expression

2008-07-03 Thread Robert Bradshaw
On Jul 3, 2008, at 3:13 PM, phil wrote: > On Jul 2, 8:33 pm, "Mike Hansen" <[EMAIL PROTECTED]> wrote: >> sage: var('x,y') >> (x, y) >> sage: t = x^2 + y^2 >> sage: type(t) >> >> sage: t._operator >> >> sage: t._operands >> [x^2, y^2] >> sage: t._operands[0] >> x^2 > > How can I do comparisons o

[sage-support] Re: Accessing terms in an expression

2008-07-03 Thread phil
On Jul 2, 8:33 pm, "Mike Hansen" <[EMAIL PROTECTED]> wrote: > sage: var('x,y') > (x, y) > sage: t = x^2 + y^2 > sage: type(t) > > sage: t._operator > > sage: t._operands > [x^2, y^2] > sage: t._operands[0] > x^2 How can I do comparisons on the operator? I need to test the operator so that I

[sage-support] Re: Accessing terms in an expression

2008-07-03 Thread Alec Mihailovs
From: "David Joyner" <[EMAIL PROTECTED]> > I was wondering about this myself. Maple has a command that does > exactly this (I think it is the "ops" command). It's op. Maple represents objects using DAGs (directed acyclic graphs literally, but it also includes enumeration of child vertices), and

[sage-support] Re: Accessing terms in an expression

2008-07-03 Thread phil
> sage: var('x,y') > (x, y) > sage: t = x^2 + y^2 > sage: type(t) > > sage: t._operator > > sage: t._operands > [x^2, y^2] > sage: t._operands[0] > x^2 It looks like you can access the expression as a tree of binary operators and their operands this way. However, the order of the operands in th

[sage-support] Re: Accessing terms in an expression

2008-07-03 Thread William Stein
On Thu, Jul 3, 2008 at 4:58 AM, David Joyner <[EMAIL PROTECTED]> wrote: > > I was wondering about this myself. Maple has a command that does > exactly this (I think it is the "ops" command). Do you think SAGE should have > an "official" analog of that? Yes, definitely. William --~--~-~-

[sage-support] Re: Accessing terms in an expression

2008-07-03 Thread Simon King
Dear David, On Jul 3, 1:58 pm, "David Joyner" <[EMAIL PROTECTED]> wrote: > I was wondering about this myself. Maple has a command that does > exactly this (I think it is the "ops" command). Do you think SAGE should have > an "official" analog of that? +1. I was missing such command in SAGE, too.

[sage-support] Re: Accessing terms in an expression

2008-07-03 Thread David Joyner
I was wondering about this myself. Maple has a command that does exactly this (I think it is the "ops" command). Do you think SAGE should have an "official" analog of that? On Wed, Jul 2, 2008 at 11:33 PM, Mike Hansen <[EMAIL PROTECTED]> wrote: > > Hi Phil, > > I don't think there is an official

[sage-support] Re: Accessing terms in an expression

2008-07-02 Thread Mike Hansen
Hi Phil, I don't think there is an official way to get at the terms, but here is something that works: sage: var('x,y') (x, y) sage: t = x^2 + y^2 sage: type(t) sage: t._operator sage: t._operands [x^2, y^2] sage: t._operands[0] x^2 --Mike On Wed, Jul 2, 2008 at 7:49 PM, phil <[EMAIL PROTECT