# Sequence of polynomials approximating sines and cosines

Suppose that you create a sequence of polynomials by first stating that

$$P_1(x) = \pi x$$

and then describing successive polynomials by:

1. $$P_{n+1}(x)$$ is the indefinite integral of $$2\pi P_n(x)$$, and
2. The constant of integration is set so that the integral on the interval $$[-1/2,1/2]$$ is $$0$$

If you do this, you get a very particular sequence of polynomials, which is:

\begin{align} P_1(x) &= \pi(x)\\ P_2(x) &= \pi^2(x^2 - 1/12)\\ P_3(x) &= \pi^3(2x^3/3 - x/6)\\ P_4(x) &= \pi^4(x^4/3 - x^2/6 + 7/720)\\ P_5(x) &= \pi^5(2x^5/15 - x^3/9 + 7x/360)\\ P_6(x) &= \pi^6(2x^6/45 - x^4/18 + 7x^2/360 - 31/30240)\\ P_7(x) &= \pi^7(4x^7/315 - x^5/45 + 7x^3/540 - 31x/15120)\\ P_8(x) &= \pi^8(x^8/315 - x^6/135 + 7x^4/1080 - 31x^2/15120 + 127/1209600) ... \end{align}

In case you're wondering why I have all these mystery $$\pi$$'s and $$2\pi$$'s and etc in the above, it's because those make the result look like this:

Or this, on $$[1,1]$$:

Note that this is not the Taylor series for anything.

These polynomials are not orthogonal, but are somewhat useful in digital signal processing (and I would guess harmonic analysis), where they generalize sawtooth waves. Basically, if you take $$P_n(x)$$ on $$[-1/2,1/2]$$ and make it periodic, the resulting Fourier series will have the $$k$$'th harmonic at an amplitude of $$1/k^n$$.

Question: is the above sequence of polynomials well known? Or is it related to a well-known sequence of polynomials via a scaling and/or shifting? (Such as: making the leading term monic, or clearing denominators, or zeroing the constant term, or whatever.)

EDIT: We can get some nicer lists if we clear denominators in the above. Doing so, we get

\begin{align} P_1(x) &= \pi (x) \\ P_2(x) &= \pi^2(12x^2 - 1) \\ P_3(x) &= \pi^3(8x^3 - 2x) \\ P_4(x) &= \pi^4(240x^4 - 120x^2 + 7) \\ P_5(x) &= \pi^5(96x^5 - 80x^3 + 14x) \\ P_6(x) &= \pi^6(1344x^6 - 1680x^4 + 588x^2 - 31) \\ P_7(x) &= \pi^7(384x^7 - 672x^5 + 392x^3 - 62x) \\ P_8(x) &= \pi^8(3840x^8 - 8960x^6 + 7840x^4 - 2480x^2 + 127) \\ \end{align}

It also so happens that if $$n$$ is odd, the GCD of the coefficients of $$P(n)$$ is 2, except for $$P(n)$$. If we divide by the GCD, we get

\begin{align} P_1(x) &= \pi(x) \\ P_2(x) &= \pi^2(12x^2 - 1) \\ P_3(x) &= \pi^3(4x^3 - x) \\ P_4(x) &= \pi^4(240x^4 - 120x^2 + 7) \\ P_5(x) &= \pi^5(48x^5 - 40x^3 + 7x) \\ P_6(x) &= \pi^6(1344x^6 - 1680x^4 + 588x^2 - 31) \\ P_7(x) &= \pi^7(192x^7 - 336x^5 + 196x^3 - 31x) \\ P_8(x) &= \pi^8(3840x^8 - 8960x^6 + 7840x^4 - 2480x^2 + 127) \\ \end{align}

Do any of these look familiar?

EDIT 2: It looks like these coefficients are (somehow) related to the Generalized Bernoulli numbers and the Bernoulli Polynomials, in two ways:

1. The constant term of the above makes the sequence $$0, -1, 0, 7, 0, -31, 0, 127, 0, -2555, ...$$ which are the numerators of $$\text{Bernoulli}(n,1/2)$$: http://oeis.org/A157779
2. If we skip the first term, the leading terms of the above "non-gcd" version has the subsequence $$12,8,240,96$$, which is the sequence of denominators of Bernoulli polynomials: http://oeis.org/A001898. The remaining terms seem to be divisors of the OEIS list. My list looks like it's almost a scaled version of that list, but not quite...

So they seem to be related to the Bernoulli polynomials, but not exactly the same.

I didn't think I'd stumble on the answer so quickly, but it so happens that these are the Bernoulli polynomials $$B_n(x)$$ with a change of variables. That is, for all $$n$$, we have my $$P_n(x+1/2) = B_n(x)$$.

\begin{align} P_1(x) &= \pi(x)\\ P_2(x) &= \pi^2(x^2 - 1/12)\\ P_3(x) &= \pi^3(2x^3/3 - x/6)\\ P_4(x) &= \pi^4(x^4/3 - x^2/6 + 7/720)\\ P_5(x) &= \pi^5(2x^5/15 - x^3/9 + 7x/360)\\ P_6(x) &= \pi^6(2x^6/45 - x^4/18 + 7x^2/360 - 31/30240)\\ P_7(x) &= \pi^7(4x^7/315 - x^5/45 + 7x^3/540 - 31x/15120)\\ P_8(x) &= \pi^8(x^8/315 - x^6/135 + 7x^4/1080 - 31x^2/15120 + 127/1209600) \\ ... \end{align}

Let's make these monic by clearing the leading term. If we do, we get

\begin{align} P_1(x) &= x \\ P_2(x) &= x^2 - 1/12 \\ P_3(x) &= x^3 - x/4 \\ P_4(x) &= x^4 - x^2/2 + 7/240 \\ P_5(x) &= x^5 - 5x^3/6 + 7x/48 \\ P_6(x) &= x^6 - 5x^4/4 + 7x^2/16 - 31/1344 \\ P_7(x) &= x^7 - 7x^5/4 + 49x^3/48 - 31x/192 \\ P_8(x) &= x^8 - 7x^6/3 + 49x^4/24 - 31x^2/48 + 127/3840 \\ ... \end{align}

Then, if we simply evaluate $$P_n(x+1/2)$$ above, we get the following:

\begin{align} P_1(x+1/2) &= x - 1/2 \\ P_2(x+1/2) &= x^2 - x + 1/6 \\ P_3(x+1/2) &= x^3 - 3x^2/2 + x/2 \\ P_4(x+1/2) &= x^4 - 2x^3 + x^2 - 1/30 \\ P_5(x+1/2) &= x^5 - 5x^4/2 + 5x^3/3 - x/6 \\ P_6(x+1/2) &= x^6 - 3x^5 + 5x^4/2 - x^2/2 + 1/42 \\ P_7(x+1/2) &= x^7 - 7x^6/2 + 7x^5/2 - 7x^3/6 + x/6 \\ P_8(x+1/2) &= x^8 - 4x^7 + 14x^6/3 - 7x^4/3 + 2x^2/3 - 1/30 \\ P_9(x+1/2) &= x^9 - 9x^8/2 + 6x^7 - 21x^5/5 + 2x^3 - 3x/10 \\ P_{10}(x+1/2) &= x^{10} - 5x^9 + 15x^8/2 - 7x^6 + 5x^4 - 3x^2/2 + 5/66\\ ... \end{align}

which would seem to be the Bernoulli polynomials: