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)
>> <class 'sage.calculus.calculus.SymbolicArithmetic'>
>> sage: t._operator
>> <built-in function add>
>> 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 only split on additions and subtractions.  Also if it is
> subtraction, I need to negate the second term.'

Use the operator module, i.e. "t._operator is operator.add"

- Robert

--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to