Minimal Polynomials of Linear Recurrence Sequences#
AUTHORS:
William Stein
- sage.matrix.berlekamp_massey.berlekamp_massey(a)#
Use the Berlekamp-Massey algorithm to find the minimal polynomial of a linear recurrence sequence
.The minimal polynomial of a linear recurrence
is by definition the unique monic polynomial , such that if satisfies a linear recurrence (for all ), then divides the polynomial .INPUT:
a
– a list of even length of elements of a field (or domain)
OUTPUT:
the minimal polynomial of the sequence, as a polynomial over the field in which the entries of
liveWarning
The result is only guaranteed to be correct on the full sequence if there exists a linear recurrence of length less than half the length of
.EXAMPLES:
sage: from sage.matrix.berlekamp_massey import berlekamp_massey sage: berlekamp_massey([1,2,1,2,1,2]) x^2 - 1 sage: berlekamp_massey([GF(7)(1),19,1,19]) x^2 + 6 sage: berlekamp_massey([2,2,1,2,1,191,393,132]) x^4 - 36727/11711*x^3 + 34213/5019*x^2 + 7024942/35133*x - 335813/1673 sage: berlekamp_massey(prime_range(2,38)) x^6 - 14/9*x^5 - 7/9*x^4 + 157/54*x^3 - 25/27*x^2 - 73/18*x + 37/9