Primitive elements and number fields
Source:R/polys-algebraic-number.R, R/polys-options.R
primitive_element.Rdprimitive_element(extension, x) finds a primitive element of the field
generated by the algebraic numbers in extension, as SymPy's
primitive_element(): it returns its minimal polynomial and the integer
coefficients c with theta = sum(c * extension); with ex = TRUE also
the coordinates of each extension in the power basis of theta (highest
power first). to_number_field(extension, theta) expresses the primitive
element of extension in the field of theta as an AlgebraicNumber(),
and field_isomorphism(a, b) returns the coordinates of a in the
power basis of b (highest power first), or NULL when a is not in
Q(b).
Usage
field_isomorphism(a, b)
to_number_field(extension, theta = NULL, gen = NULL, alias = NULL)
primitive_element(extension, x = NULL, ex = FALSE)Arguments
- a, b
Algebraic numbers.
- extension
An algebraic number or a list of them.
- theta
A generator of the target field.
- gen
The variable of the minimal polynomial of the result.
- alias
A symbol (or name) printed for the generator.
- x
The variable of the minimal polynomial (a dummy by default).
- ex
Also return the coordinates of the extensions.
Examples
x <- Symbol("x")
primitive_element(list(sqrt(Integer(2)), sqrt(Integer(3))), x)
#> [[1]]
#> x^4 - 10*x^2 + 1
#>
#> [[2]]
#> [[2]][[1]]
#> 1
#>
#> [[2]][[2]]
#> 1
#>
#>
# \donttest{
field_isomorphism(sqrt(Integer(2)), sqrt(Integer(2)) + sqrt(Integer(3)))
#> [[1]]
#> 1/2
#>
#> [[2]]
#> 0
#>
#> [[3]]
#> -9/2
#>
#> [[4]]
#> 0
#>
to_number_field(sqrt(Integer(2)), sqrt(Integer(2)) + sqrt(Integer(3)))
#> sqrt(2)
# }