find minimal polynomial for an exact or approximate root
find an annihilating polynomial for an approximate root
MinimalPolynomial(r, x, n, acc)
AnnihilatingPolynomial(r, x, n, acc)
exact or approximate root
(optional) variable name
an upperbound on the degree of the polynomial sought
desired accuracy of the approximation
digits : posint
A value for Digits to be used for all numerical computations.
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 _X 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 acc⁢f⁡r is given the same weight as the coefficients in determining f, the minimal polynomial. If it is not specified, the default value for acc is 10Digits−2max⁡1,rn. 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](..).
rf ≔ evalf⁡1+2
r ≔ 1+2
When r is exact, and no degree bound given, an exact method is used
Otherwise the lattice-based approximation is used
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.
Sometimes the exact and approximate algorithms will agree but it is not guaranteed. The approximate algorithm typically be faster.
s ≔ 2+−3
t ≔ add⁡−1i+1⁢ithprime⁡i,i=1..3
P ≔ CodeTools:-Usage⁡MinimalPolynomial⁡t,x
memory used=5.10MiB, alloc change=0 bytes, cpu time=44.00ms, real time=44.00ms, gc time=0ns
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=103.00ms, real time=103.00ms, gc time=70.23ms
memory used=2.63MiB, alloc change=0 bytes, cpu time=20.00ms, real time=20.00ms, gc time=0ns
The output of MinimalPolynomial(r, n, acc) prior to Maple 18 used the variable x. As of Maple 18, the default variable used is _X. 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.
For more information on Maple 18 changes, see Updates in Maple 18.
The r parameter was updated in Maple 2020.
The 'digits' option was introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
Download Help Document
What kind of issue would you like to report? (Optional)