1 | initial version |
Check type(a)
and you'll see it's not an integer:
a=sqrt(2)+6-sqrt(2)
print( type(a) )
The type of a
is
<class 'sage.symbolic.expression.expression'="">
and so it's not an integer. If you want to factor a
as an integer, convert it to an integer type first:
print( ZZ(a).factor() )
which gives 2 * 3
as expected.
2 | No.2 Revision |
Check type(a)
and you'll see it's not an integer::
a=sqrt(2)+6-sqrt(2)
print( type(a) )
The type of which gives:a
is
<class 'sage.symbolic.expression.expression'="">
and so it's a
is not an integer. If you want to factor a
as an integer, convert it to an integer type first:
print( ZZ(a).factor() )
which gives 2 * 3
as expected.
3 | No.3 Revision |
Check type(a)
:
a=sqrt(2)+6-sqrt(2)
print( type(a) )
which gives:
<class 'sage.symbolic.expression.expression'="">
and so a
is not an integer. integer but a symbolic expression. If you want to factor a
as an integer, convert it to an integer type first:
print( ZZ(a).factor() )
which gives 2 * 3
as expected.