On 10/1/07, Mike Hansen <[EMAIL PROTECTED]> wrote:
>
> Hey Ondrej,
>
> While the correspondence is not exact, this should be enough to work:
>
> sage: e = x*y
> sage: type(e)
> <class 'sage.calculus.calculus.SymbolicArithmetic'>
> sage: e._operands
> [x, y]
> sage: e._operator
> <built-in function mul>
> sage: e = exp(y)
> sage: e._operands
> [exp, y]
> sage: type(e)
> <class 'sage.calculus.calculus.SymbolicComposition'>
> sage: var('z')
> z
> sage: f = x+y*z
> sage: f._operands
> [x, y*z]
> sage: (y*z)._operands
> [y, z]
> sage: sin(y*z)._operands
> [sin, y*z]


Thanks a lot. BTW, how can I test the e._operator to be add? The only
way I discovered is this:

sage: str((x+y)._operator).find("add") != -1
True
sage: str((x*y)._operator).find("add") != -1
False
sage: str((x*y)._operator).find("mul") != -1
True
sage: str((x**y)._operator).find("mul") != -1
False
sage: str((x**y)._operator).find("pow") != -1
True

Which is quite fragile. :) Generally I think I know everything I need.

Thanks,
Ondrej

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to