How to extract the integer part from a symbolic expressions?
Suppose I solve the following quadratic equation using SAGE and store the solution in two variables, a
and b
:
sage: x = var('x')
sage: qe = (x^2 - 618*x + 90581 == 0)
sage: a, b = solve(qe, x)
Which gives me the following output:
sage: a
x == 379
sage: b
x == 239
sage: type(a), type(b)
(sage.symbolic.expression.Expression, sage.symbolic.expression.Expression)
I wish to get the output in this form:
sage: a
379
sage: b
239
sage: type(a), type(b)
(sage.rings.integer.Integer, sage.rings.integer.Integer)
How can I do this easily?