1 | initial version |
The answer is similar to that one
First, when you write 6.00000000000000
you define a numerical (floating-point approximated) number:
sage: 6.00000000000000.parent()
Real Field with 53 bits of precision
While, when you write e^(-2/5*I*pi)
, you define a symbolic expression:
sage: (e^(-2/5*I*pi)).parent()
Symbolic Ring
So, if you want something exact, you have to replace 6.00000000000000
by 6
, which is an exact integer:
sage: 6.parent()
Integer Ring
Then, your function is not a genuine polynomial but a symbolic expression (you could also have cos(log(x))
in there for example):
sage: p = (x^2 - 6)*x^2 - 4*x*(e^(2/5*I*pi) + e^(-2/5*I*pi)) - e^(4/5*I*pi) - e^(-4/5*I*pi) - 1
sage: p.parent()
Symbolic Ring
So, let us transform it into a genuine polynomial defined on the field of (complex) algebraic numbers:
sage: P = p.polynomial(QQbar)
sage: P.parent()
Univariate Polynomial Ring in x over Algebraic Field
The Univariate Polynomial Ring in x over Algebraic Field
makes more sense than a mysterious Symbolic Ring
, isn't it ?
In this safer place, you can have a look at its roots:
sage: P.roots()
[(-2.175570504584946? + 0.?e-17*I, 1),
(-0.618033988749895? + 0.?e-17*I, 1),
(0.1755705045849463? + 0.?e-18*I, 1),
(2.618033988749895? + 0.?e-17*I, 1)]
2 | No.2 Revision |
The answer is somehow similar to that one. It is important to know where your objects are living and define them into the right place since mathematics is not about manipulating ill-defined expressions.
First, when you write 6.00000000000000
you define a numerical (floating-point (floating-point, i.e. approximated) number:
sage: 6.00000000000000.parent()
Real Field with 53 bits of precision
While, when you write e^(-2/5*I*pi)
, you define a symbolic expression:
sage: (e^(-2/5*I*pi)).parent()
Symbolic Ring
So, if you want something exact, you have to replace 6.00000000000000
by 6
, which is an exact integer:
sage: 6.parent()
Integer Ring
Also, e^(-2/5*I*pi)
is not any complex number, but an algebraic one, so you should take the benefit of this.
Then, your function is not a genuine polynomial but a symbolic expression (you could also have cos(log(x))
in there for example):
sage: p = (x^2 - 6)*x^2 - 4*x*(e^(2/5*I*pi) + e^(-2/5*I*pi)) - e^(4/5*I*pi) - e^(-4/5*I*pi) - 1
sage: p.parent()
Symbolic Ring
So, let us transform it into a genuine polynomial defined on the field of (complex) algebraic numbers:
sage: P = p.polynomial(QQbar)
sage: P.parent()
Univariate Polynomial Ring in x over Algebraic Field
The Univariate Polynomial Ring in x over Algebraic Field
makes more sense than a mysterious Symbolic Ring
, isn't it ?
In this safer place, you can have a look at its roots:
sage: P.roots()
[(-2.175570504584946? + 0.?e-17*I, 1),
(-0.618033988749895? + 0.?e-17*I, 1),
(0.1755705045849463? + 0.?e-18*I, 1),
(2.618033988749895? + 0.?e-17*I, 1)]
3 | No.3 Revision |
The answer is somehow similar to that one. It is important to know where your objects are living and define them into the right place since mathematics is place. As for mathematics, Sage will not about manipulating be able to handle ill-defined expressions.expressions consistently.
First, when you write 6.00000000000000
you define a numerical (floating-point, i.e. approximated) number:
sage: 6.00000000000000.parent()
Real Field with 53 bits of precision
While, when you write e^(-2/5*I*pi)
, you define a symbolic expression:
sage: (e^(-2/5*I*pi)).parent()
Symbolic Ring
So, if you want something exact, you have to replace 6.00000000000000
by 6
, which is an exact integer:
sage: 6.parent()
Integer Ring
Also, e^(-2/5*I*pi)
is not any complex number, but an algebraic one, so you should take the benefit of this.
Then, your function is not a genuine polynomial but a symbolic expression (you could also have cos(log(x))
in there for example):
sage: p = (x^2 - 6)*x^2 - 4*x*(e^(2/5*I*pi) + e^(-2/5*I*pi)) - e^(4/5*I*pi) - e^(-4/5*I*pi) - 1
sage: p.parent()
Symbolic Ring
So, let us transform it into a genuine polynomial defined on the field of (complex) algebraic numbers:
sage: P = p.polynomial(QQbar)
sage: P.parent()
Univariate Polynomial Ring in x over Algebraic Field
The Univariate Polynomial Ring in x over Algebraic Field
makes more sense than a mysterious Symbolic Ring
, isn't it ?
In this safer place, you can have a look at its roots:
sage: P.roots()
[(-2.175570504584946? + 0.?e-17*I, 1),
(-0.618033988749895? + 0.?e-17*I, 1),
(0.1755705045849463? + 0.?e-18*I, 1),
(2.618033988749895? + 0.?e-17*I, 1)]
4 | No.4 Revision |
The answer is somehow similar to that one. It is important to know where your objects are living and define them into the right place. As for mathematics, Sage will not be able to handle ill-defined expressions consistently.
First, when you write 6.00000000000000
you define a numerical (floating-point, i.e. approximated) number:
sage: 6.00000000000000.parent()
Real Field with 53 bits of precision
While, when you write e^(-2/5*I*pi)
, you define a symbolic expression:
sage: (e^(-2/5*I*pi)).parent()
Symbolic Ring
So, if you want something exact, you have to replace 6.00000000000000
by 6
, which is an exact integer:
sage: 6.parent()
Integer Ring
Also, e^(-2/5*I*pi)
is not any complex number, but an algebraic one, so you should take the benefit of this.
Then, your function is not a genuine polynomial but a symbolic expression (you could also have cos(log(x))
in there such expression for example):
sage: p = (x^2 - 6)*x^2 - 4*x*(e^(2/5*I*pi) + e^(-2/5*I*pi)) - e^(4/5*I*pi) - e^(-4/5*I*pi) - 1
sage: p.parent()
Symbolic Ring
So, let us transform it into a genuine polynomial defined on the field of (complex) algebraic numbers:
sage: P = p.polynomial(QQbar)
sage: P.parent()
Univariate Polynomial Ring in x over Algebraic Field
The Univariate Polynomial Ring in x over Algebraic Field
makes more sense than a mysterious Symbolic Ring
, isn't it ?
In this safer place, you can have a look at its roots:
sage: P.roots()
[(-2.175570504584946? + 0.?e-17*I, 1),
(-0.618033988749895? + 0.?e-17*I, 1),
(0.1755705045849463? + 0.?e-18*I, 1),
(2.618033988749895? + 0.?e-17*I, 1)]