Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The simplify method exists on symbolic objects in Sage, but not on numbers. So I would either do your try/except block (but except the specific error about not having the simplify attribute), or test using hasattr whether you have the simplify attribute.

Alternatively, you could convert whatever the user passed in to a symbolic object:

a=SR(a)
a.simplify()