Revision history [back]

Your sol is a list, with 1 element:

sage: sol [x == 3]

Then, sol is a symbolic expression. To get its right hand side, it suffice to use the .rhs() method:

sage: sol x == 3

sage: sol.rhs() 3

Your sol is a list, with 1 element:

sage: sol
[x == 3]

3]

Then, sol is a symbolic expression. To get its right hand side, it suffice to use the .rhs() method:

sage: sol
x == 3

sage: sol.rhs()
3

Then, it should be enough to work since the symbolic variable 3

sage: sol.rhs() 3

should be automatically coerced by Sage into a numeric value if needed.

sage: sol.rhs().parent()
Symbolic Ring

That said, it may be a good idea to escape the symbolic ring. If you want to have a genuine integer, you can do:

sage: ZZ(sol.rhs())
3
sage: ZZ(sol.rhs()).parent()
Integer Ring

If you want an algebraic number:

sage: AA(sol.rhs())
3
sage: AA(sol.rhs()).parent()
Algebraic Real Field

If you want a floating number:

sage: RR(sol.rhs())
3.00000000000000
sage: RR(sol.rhs()).parent()
Real Field with 53 bits of precision

Your sol sol is a list, with 1 element:

sage: sol
[x == 3]

Then, sol is a symbolic expression. To get its right hand side, it suffice to use the .rhs() method:

sage: sol
x == 3

sage: sol.rhs()
3

Then, it should be enough to work since the symbolic variable 3 should be automatically coerced by Sage into a numeric value if needed.needed (and plot should understand symbolic numbers).

sage: sol.rhs().parent()
Symbolic Ring

That said, it may be a good idea to escape the symbolic ring. If you want to have a genuine integer, you can do:

sage: ZZ(sol.rhs())
3
sage: ZZ(sol.rhs()).parent()
Integer Ring

If you want an algebraic number:

sage: AA(sol.rhs())
3
sage: AA(sol.rhs()).parent()
Algebraic Real Field

If you want a floating number:

sage: RR(sol.rhs())
3.00000000000000
sage: RR(sol.rhs()).parent()
Real Field with 53 bits of precision