Ask Your Question

Revision history [back]

When you take the square root of an integer number that is not a square, you get an object in Sage's "Symbolic Ring", where the ceil method is not available.

You could start with a floating-point 10 rather than an integer 10:

sage: x = RDF(10)
sage: x
10.0
sage: x.parent()
Real Double Field
sage: x = x.sqrt()
sage: x
3.1622776601683795
sage: x.parent()
Real Double Field
sage: x = x.ceil()
sage: x
4
sage: x.parent()
Integer Ring

Compare with your original computations:

sage: x = 10
sage: x
10
sage: x.parent()
Integer Ring
sage: x = x.sqrt()
sage: x
sqrt(10)
sage: x.parent()
Symbolic Ring
sage: x = x.ceil()
...
AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'ceil'