PolynomialTools
MinimalPolynomial
find minimal polynomial for an exact or approximate root
AnnihilatingPolynomial
find an annihilating polynomial for an approximate root
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
MinimalPolynomial(r, x)
MinimalPolynomial(r, x, n, acc)
AnnihilatingPolynomial(r, x, n, acc)
r
-
exact or approximate root
x
(optional) variable name
n
an upperbound on the degree of the polynomial sought
acc
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](..).
with⁡PolynomialTools:
rf≔evalf⁡1+sqrt⁡2
rf≔2.414213562
MinimalPolynomial⁡rf,x,2
x2−2⁢x−1
r≔1+sqrt⁡2
r≔1+2
When r is exact, and no degree bound given, an exact method is used
MinimalPolynomial⁡r10,x
100⁢x2−20⁢x−1
Otherwise the lattice-based approximation is used
MinimalPolynomial⁡r10,x,25
25⁢x12+8⁢x11−7⁢x10−21⁢x9+14⁢x8−2⁢x7+9⁢x6+14⁢x5+5⁢x4−4⁢x3+4⁢x2−5⁢x+1
If r is less than 1, and the accuracy is set low by default, and the output of AnnihilatingPolynomial could be a simple monomial.
AnnihilatingPolynomial⁡r10,x,25,10.10
x16
Setting the accuracy higher can help avoid such trivial output.
AnnihilatingPolynomial⁡r10,x,25,10.25
x21−x19+2⁢x18+2⁢x17+8⁢x16+4⁢x15−x14+4⁢x13−3⁢x12−3⁢x11−6⁢x10−5⁢x9−4⁢x8+3⁢x7+x6−8⁢x5+4⁢x3−5⁢x2+x
MinimalPolynomial⁡1.234,3
22⁢_X3−5⁢_X2+61⁢_X−109
fsolve⁡,_X
1.234000001
Sometimes the exact and approximate algorithms will agree but it is not guaranteed. The approximate algorithm typically be faster.
s≔sqrt⁡2+sqrt⁡−3
s≔2+I⁢3
MinimalPolynomial⁡s,x
x4+2⁢x2+25
MinimalPolynomial⁡s,x,4
t≔add⁡sqrt⁡−1i+1⁢ithprime⁡i,i=1..3
t≔2+I⁢3+5
P≔CodeTools:-Usage⁡MinimalPolynomial⁡t,x
memory used=5.16MiB, alloc change=0 bytes, cpu time=60.00ms, real time=60.00ms, gc time=0ns
P≔x8−16⁢x6+184⁢x4+960⁢x2+3600
The numeric algorithm is faster, but does not get the exact answer unless the working precision is increased
CodeTools:-Usage⁡MinimalPolynomial⁡t,x,degree⁡P,x
memory used=1.86MiB, alloc change=28.00MiB, cpu time=111.00ms, real time=111.00ms, gc time=82.35ms
2⁢x7−15⁢x6+38⁢x5+6⁢x4−177⁢x3+453⁢x2+139⁢x−146
CodeTools:-Usage⁡MinimalPolynomial⁡t,x,degree⁡P,x,digits=25
memory used=2.64MiB, alloc change=0 bytes, cpu time=29.00ms, real time=29.00ms, gc time=0ns
x8−16⁢x6+184⁢x4+960⁢x2+3600
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.
See Also
evala/Minpoly
evala/Norm
IntegerRelations[LLL]
LinearAlgebra[MinimalPolynomial]
Download Help Document