Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cast expression to rational number


I am trying to perform the ceil() function on the result of a square root operation. My code is as follows:

x = 10
x = x.sqrt()
x = x.ceil()

However, I get the following error:

AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'ceil'

I have tried searching the the documentation, but I can't seem to find a straight forward way to "flatten" this expression to a rational number. How can I go about this?