# In the directory containing the attached generate.py:
from generate import LebesgueConstantsInterpolationNodes
generator = LebesgueConstantsInterpolationNodes()
generator.value({'family': 'equally-spaced', 'n': '5'}, 100)The generator builds the node polynomials over $\mathbb{Q}$ and isolates their roots in Sage's algebraic real field. It forms the Lagrange basis exactly, splits $[-1,1]$ at the nodes, and on each interval uses the constant sign pattern of the basis polynomials to replace the Lebesgue function by one algebraic polynomial. The maximum is checked at every interval endpoint and at every real root of that polynomial's derivative; the algebraic maximum is then returned as a real ball with 192 guard bits beyond the 100 digits written, except when it is proved rational and is returned exactly.
As independent checks, the small-degree closed forms $\Lambda_1=1$ for the endpoint node families, $\Lambda_2=5/4$ for the four families with nodes $\{-1,0,1\}$, $\Lambda_1=\sqrt2$ for Chebyshev points of the first kind, and $\Lambda_1=\sqrt3$ for Gauss–Legendre nodes were derived directly from the node sets.