|
Calling Sequence
|
|
MinimalPolynomial(r, x)
MinimalPolynomial(r, x, n, acc)
AnnihilatingPolynomial(r, x, n, acc)
|
|
Parameters
|
|
r
|
-
|
exact or approximate root
|
x
|
-
|
(optional) variable name
|
n
|
-
|
an upperbound on the degree of the polynomial sought
|
|
|
|
|
Options
|
|
|
desired accuracy of the approximation
|
|
A value for Digits to be used for all numerical computations.
|
|
|
Description
|
|
•
|
The MinimalPolynomial and AnnihilatingPolynomial functions find a polynomial with integer coefficients which has the algebraic number r as one of its roots.
|
•
|
If r is an exact algebraic number, and n and acc are not given, then MinimalPolynomial calls evala/Minpoly to compute an exact minimal polynomial of r.
|
•
|
Otherwise the AnnihilatingPolynomial and MinimalPolynomial functions, use a lattice-based algorithm to find a polynomial of degree n (or less) with small integer coefficients which has the given approximation r of an algebraic number as one of its roots. They differ in that, the output of MinimalPolynomial is guaranteed to be an irreducible polynomial, while the output of AnnihilatingPolynomial is the raw output of the lattice algorithm.
|
•
|
If a name is not specified for the variable x, then is used.
|
•
|
The root r may be real or complex. It may be input as a floating-point approximation to a root or as an exact algebraic number. In the latter case, if an approximate algorithm is being used, r will first be evaluated in floating point at Digits precision using evalf.
|
•
|
The value is given the same weight as the coefficients in determining , the minimal polynomial. If it is not specified, the default value for acc is . Larger values indicate the desire for better approximations.
|
•
|
This function is part of the PolynomialTools package, and so it can be used in the form MinimalPolynomial(..) only after executing the command with(PolynomialTools). However, it can always be accessed through the long form of the command by using PolynomialTools[MinimalPolynomial](..).
|
|
|
Examples
|
|
>
|
|
>
|
|
When r is exact, and no degree bound given, an exact method is used
>
|
|
Otherwise the lattice-based approximation is used
>
|
|
| (5) |
If r is less than 1, and the accuracy is set low by default, and the output of AnnihilatingPolynomial could be a simple monomial.
>
|
|
Setting the accuracy higher can help avoid such trivial output.
>
|
|
| (7) |
>
|
|
| (8) |
Sometimes the exact and approximate algorithms will agree but it is not guaranteed. The approximate algorithm typically be faster.
>
|
|
>
|
|
>
|
|
>
|
|
memory used=5.16MiB, alloc change=0 bytes, cpu time=60.00ms, real time=60.00ms, gc time=0ns
| |
| (14) |
The numeric algorithm is faster, but does not get the exact answer unless the working precision is increased
>
|
|
memory used=1.86MiB, alloc change=28.00MiB, cpu time=111.00ms, real time=111.00ms, gc time=82.35ms
| |
| (15) |
>
|
|
memory used=2.64MiB, alloc change=0 bytes, cpu time=29.00ms, real time=29.00ms, gc time=0ns
| |
| (16) |
|
|
Compatibility
|
|
•
|
The output of MinimalPolynomial(r, n, acc) prior to Maple 18 used the variable . As of Maple 18, the default variable used is . You can change this using the x argument.
|
•
|
As of 2020, MinimalPolynomial(r, x) calls evala(Minpoly(r,x)) if r is an exact algebraic number. To force the previous behavior, r can be replaced with evalf(r) in the calling sequence or an explicit degree bound can be passed as a second or third argument.
|
•
|
The PolynomialTools[AnnihilatingPolynomial] command was introduced in Maple 18.
|
•
|
The PolynomialTools[MinimalPolynomial] command was updated in Maple 18.
|
•
|
The x parameter was introduced in Maple 18.
|
•
|
The r parameter was updated in Maple 2020.
|
•
|
The 'digits' option was introduced in Maple 2020.
|
|
|
|