Given Given
$\qquad f(x)=\sum\limits_{n=-\infty}^{\infty}f_{n}e^{i\,n\,x}$
$\qquad \left \langle f,g \right \rangle = \frac{1}{2\pi}\int_{-\pi}^{\pi}f\,g^{*}\,dx$

and the $n^{th}$ Fourier coefficient is

$\qquad f_{n} = \left \langle f(x),\,e^{i\,n\,x}\right \rangle$

Plot the partial sum for $n = 1,3,5,9,$ and $15$.

Or in Mathematica Language:

f[x_, n_] := Sum[Subscript[f, n]]Exp[Inx]], {x, -∞, ∞}]


〈f, g〉 = 1/(2 π) Integrate[f SuperStar[g], {x, -π, π}]`

and the $n^{th}$ Fourier coefficient is

Subscript[f_, n_] := 〈f[x], Exp[I n x]

But note that

$\qquad f(x) = \sum\limits_{n=-\infty}^{\infty} f_{n}e^{i\, n\, x} = 2\sum\limits_{n = 1}^{\infty} f_{n} e^{i\, n\, x}$


Subscript[f, n] := AngleBracket[f[x], Exp[-I n x]]. 

The infinite sum can be reduced to

f[x_, n_] := Sum[Subscript[f, n] Exp[I n x], {x, -∞, ∞}] 


2 g[x_,n_] := 2 Sum[Subscript[f, n] Exp[I n x], {x, 1, ∞}]  

noting that Subscript[f, 0] == 0

The first partial sum is

2 Sum[Subscript[f, n] Exp[I n x], {n, 1, 1}]

I would like to plot this partial sum but the existence of an imaginary number makes it hard to do, given my unfamiliarity with Mathematica.

What is a good way to deal with this?

Any help is appreciated. Thanks in advance.

  • 2
    $\begingroup$ You have posted quite a few questions on this site over the last 21 months. You should by now have enough experience of what is considered good practice on the site not to post expressions like f (x) == \!\(\*UnderoverscriptBox[\(\[Sum]\), \(n = \(-\[Infinity]\)\), \(\ \[Infinity]\)]\(\*SubscriptBox[\(f\), \(n\)]\ \*SuperscriptBox[\(E\), \(I\ n\ x\)]\)\), which is neither valid Mathematica code nor MathJaX. Please consider putting more effort in formatting your questions in way that makes them more readable and easier work with. $\endgroup$ – m_goldberg Jun 3 '17 at 11:11
  • $\begingroup$ Your question is better after the spate of recent edits, but it still falls short of being a well-posed question. Expressions like f(x) = Sum[Subscript[f, n] e^Inx, {x, -∞, ∞}] are still present and are not valid Mathematica code. Further, they are ambiguous. Do you intend this to represent a relation or definition? As it stands it is neither. $\endgroup$ – m_goldberg Jun 3 '17 at 15:48
  • $\begingroup$ Looks like a hometask. Is it not? $\endgroup$ – Alexei Boulbitch Jun 3 '17 at 20:11
  • $\begingroup$ @AlexeiBoulbitch It is. But with the mathematics out of the way by my attempt, I think what is remaining is transmuting what is left on hand into a computational sensible language. Plotting partial sums without imaginary entities is fairly straightforward. The existence of imaginary numbers makes it less obvious as to what should be done. $\endgroup$ – Physkid Jun 4 '17 at 3:14
  • $\begingroup$ @m_goldberg This edited post should look approximately close to what is required. It probably doesn't matter. I can always redefine a new function after putting the original function through a manipulation. $\endgroup$ – Physkid Jun 4 '17 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.