+ and - of length $n$, where + means $1$ and - means $-1$, normalized by $a_0=a_1=1$)import numberdb.sage as numberdb
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
R = PolynomialRing(ZZ, "x")
x = R.gen()
def barker_polynomial(signs):
return sum((ZZ(1) if sign == "+" else ZZ(-1)) * x**j
for j, sign in enumerate(signs))
barker_polynomial("+++++--++-+-+")The values are exact polynomials over $\mathbb Z$.
The generator builds each polynomial from the sign word listed by [1] and checks the Barker autocorrelation condition, the autocorrelation polynomial identity in (1), the aperiodic merit factor in (2), and the source sign words against a brute-force enumeration of all normalized sign words through length $13$.