08.02.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER<br />

NINE<br />

MINIMAL POLYNOMIALS OF LINEAR<br />

RECURRENCE SEQUENCES<br />

AUTHORS:<br />

• William Stein<br />

sage.matrix.berlekamp_massey.berlekamp_massey(a)<br />

Use the Berlekamp-Massey algorithm to find the minimal polynomial <strong>of</strong> a linearly recurrence sequence a.<br />

The minimal polynomial <strong>of</strong> a linear recurrence {a r } is by definition the unique monic polynomial g, such that<br />

if {a r } satisfies a linear recurrence a j+k + b j−1 a j−1+k + · · · + b 0 a k = 0 (for all k ≥ 0), then g divides the<br />

polynomial x j + ∑ j−1<br />

i=0 b ix i .<br />

INPUT:<br />

•a - a list <strong>of</strong> even length <strong>of</strong> elements <strong>of</strong> a field (or domain)<br />

OUTPUT:<br />

•Polynomial - the minimal polynomial <strong>of</strong> the sequence (as a polynomial over the field in which the<br />

entries <strong>of</strong> a live)<br />

EXAMPLES:<br />

sage: berlekamp_massey([1,2,1,2,1,2])<br />

x^2 - 1<br />

sage: berlekamp_massey([GF(7)(1),19,1,19])<br />

x^2 + 6<br />

sage: berlekamp_massey([2,2,1,2,1,191,393,132])<br />

x^4 - 36727/11711*x^3 + 34213/5019*x^2 + 7024942/35133*x - 335813/1673<br />

sage: berlekamp_massey(prime_range(2,38))<br />

x^6 - 14/9*x^5 - 7/9*x^4 + 157/54*x^3 - 25/27*x^2 - 73/18*x + 37/9<br />

275

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!