| 1 | initial version |
I guess what you want is to work in the so-called Algebraic Real Field:
sage: AA
Algebraic Real Field
sage: R.<x> = AA[]
sage: p = x^2-3
sage: p.factor()
(x - 1.732050807568878?) * (x + 1.732050807568878?)
sage: q = x^2-5
sage: q.factor()
(x - 2.236067977499790?) * (x + 2.236067977499790?)
Note that the printed values are actually exact values (the ? indicates this fact), and you can compute radical expressions for them like this:
sage: f0 = p.factor()[0][0].constant_coefficient()
sage: f0
-1.732050807568878?
sage: f0.radical_expression()
-sqrt(3)
I do not know if it is possible to obtain directly the factorization of p with coefficients expressed as a list of radicals, but you can construct such a representation quite easily (by hand).
| 2 | No.2 Revision |
I guess what you want is to work in the so-called Algebraic Real Field:
sage: AA
Algebraic Real Field
sage: R.<x> = AA[]
sage: p = x^2-3
sage: p.factor()
(x - 1.732050807568878?) * (x + 1.732050807568878?)
sage: q = x^2-5
sage: q.factor()
(x - 2.236067977499790?) * (x + 2.236067977499790?)
Note that even though the printed values contain a limited number of digits, they are actually internally exact values represented (the ? indicates this fact), and you can compute radical expressions for them like this:
sage: f0 = p.factor()[0][0].constant_coefficient()
sage: f0
-1.732050807568878?
sage: f0.radical_expression()
-sqrt(3)
I do not know if it is possible to obtain directly the factorization of p with coefficients expressed as a list of radicals, but you can construct such a representation quite easily (by hand).
| 3 | No.3 Revision |
I guess what you want is to work in the so-called Algebraic Real Field:
sage: AA
Algebraic Real Field
sage: R.<x> = AA[]
sage: p = x^2-3
sage: p.factor()
(x - 1.732050807568878?) * (x + 1.732050807568878?)
sage: q = x^2-5
sage: q.factor()
(x - 2.236067977499790?) * (x + 2.236067977499790?)
Note that even though the printed values contain a limited number of digits, they are internally exact exactly represented (the ? indicates this fact), and you can for instance compute radical expressions for them like this:
sage: f0 = p.factor()[0][0].constant_coefficient()
sage: f0
-1.732050807568878?
sage: f0.radical_expression()
-sqrt(3)
I do not know if it is possible to obtain directly the factorization of p with coefficients expressed as a list of radicals, but you can construct such a representation quite easily (by hand).
| 4 | No.4 Revision |
I guess Though it is not exactly what you want is are looking for, an approach may be to work in the so-called Algebraic Real Field:Field which contains the constructible numbers:
sage: AA
Algebraic Real Field
sage: R.<x> = AA[]
sage: p = x^2-3
sage: p.factor()
(x - 1.732050807568878?) * (x + 1.732050807568878?)
sage: q = x^2-5
sage: q.factor()
(x - 2.236067977499790?) * (x + 2.236067977499790?)
Note that even though the printed values contain a limited number of digits, they are internally exactly represented (the ? indicates this fact), and you can for instance compute radical expressions for them like this:
sage: f0 = p.factor()[0][0].constant_coefficient()
sage: f0
-1.732050807568878?
sage: f0.radical_expression()
-sqrt(3)
I do not know if it is possible to obtain directly the factorization of p with coefficients expressed as a list of radicals, but you can construct such a representation quite easily (by hand).
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.