1

I was given the following formula for the Fourier series of a function with period $2\pi$:

$$ \begin{align*} \hat f(x) = \frac {a_0} 2 + \sum_{n=1}^\infty a_n \cos (nx) + b_n \sin (nx) \end{align*} $$

This formula is awkward because the coefficient $a_0$ is halved, whereas the coefficients $a_n$ and $b_n$ aren't, for $n > 0$. Then I realized that I could rewrite this as:

$$ \begin{align*} \hat f(x) = \sum_{n \in \mathbb Z} c_n \cos (nx) + d_n \sin (nx) \end{align*} $$

Where:

$$ \begin{align*} a_n & = c_n + c_{-n} && \mbox{for } n \ge 0 \\ b_n & = d_n - d_{-n} && \mbox{for } n \ge 0 \\ \end{align*} $$

This is IMO much easier on the eyes. Then you can add a constraint that $c_n, d_n = 0$ when $n < 0$, if you want to. Is there a good reason not to work this way?

mathreadler
  • 25,824
isekaijin
  • 1,765
  • 5
    The best way is $\sum_{-\infty}^\infty c_ne^{inx}$. – Angina Seng Apr 25 '17 at 16:00
  • @LordSharktheUnknown I'm inclined to agree, but my differential equations professor is going through great lengths to avoid complex numbers. – isekaijin Apr 25 '17 at 16:01
  • One reason not to work this way is that your functions $\cos nx$, $\sin nx$ for $n\in\mathbb Z$ do not form a basis, because they are not linearly independent. –  Apr 25 '17 at 16:02
  • @Rahul: For my current use case (solving PDEs with initial and buondary conditions), it is enough that they span the entire space of periodic functions with period $2\pi$ satisfying the Dirichlet conditions. In any case, as I said, if you need to work with a basis, you can add a constraint that $c_n, d_n = 0$ for negative $n$. (And, of course, $\sin 0x$ is the zero vector, so it doesn't matter what $d_0$ is.) – isekaijin Apr 25 '17 at 16:06
  • Why not just $\sum_{n=0}^\infty a_n\cos(nx) + b_n\sin(nx)$, since the $\sin(0x) = 0$, and $\cos(0x) = 1$, and then just skip storing $b_0$ – mathreadler Apr 25 '17 at 16:51
  • @mathreadler: The problem with that approach is that the formula for $a_0$ would have an extra $\frac 1 2$ factor that the formula for all the other $a_n$'s doesn't have. – isekaijin Apr 25 '17 at 16:54
  • It does not have to, if you just adjust the constant basis function to be mean normalized and not max normalized. – mathreadler Apr 25 '17 at 16:55
  • @mathreadler: Under your formulation, $a_0 = \frac 1 {2\pi} \int_{-\pi}^\pi f(x) dx$, but $a_n = \frac 1 \pi \int_{-\pi}^\pi f(x) \cos (nx) dx$ for $n > 0$. – isekaijin Apr 25 '17 at 16:59
  • $a_0 = \frac{1}{2\pi} \int_{-\pi}^\pi f(x)dx = \frac{1}{2\pi} \int_{-\pi}^\pi f(x)\cdot 1dx$, see now what you can modify to make it fit? – mathreadler Apr 25 '17 at 17:01
  • Making $\frac 1 2$ a basis vector just seems wrong. The corresponding subspace really comes from $1 = \cos(0x)$. We're just shifting the place where the pattern is broken. – isekaijin Apr 25 '17 at 17:04
  • 1
    It does solve the inconsistency that bothered you. Why does it seem wrong? Why should the integral of the basis function sum to $2\pi$ instead than $\pi$ or $1$. It is not particularly uncommon for that matter to use a scale factor to get an orthonormal Fourier system and then yet another constant $\frac{1}{\sqrt{2\pi}}$ does the job. Renormalization is simply a part of life. – mathreadler Apr 25 '17 at 17:09
  • "if you need to work with a basis, you can add a constraint that $c_n,d_n=0$ for negative $n$." No, a set of vectors that has the zero vector in it is not a basis. Anyway, as you say, you don't need a basis, so this concern does not apply to you; I was merely answering your question of whether there was any good reason not to work this way. –  Apr 25 '17 at 17:32

0 Answers0