Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

How would I plot the following in Mathematica?

$ \displaystyle\sum_{n=2}^{10} \bigg(\dfrac {4ine^{inx}(-1)^n}{(n^2 - 1)^2} - \dfrac{4in e^{-inx}(-1)^n}{(n^2 - 1)^2} \bigg) $

Thanks.

share|improve this question

migrated from math.stackexchange.com Dec 31 '13 at 23:42

This question came from our site for people studying math at any level and professionals in related fields.

marked as duplicate by bobthechemist, rm -rf Jan 1 at 3:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Please make the title more informative and tell us what you have tried. –  Lost1 Dec 31 '13 at 23:42
    
If the answer to the similar question you more recently asked doesn't apply here, please clarify. –  bobthechemist Jan 1 at 1:51

3 Answers 3

Here is a plot from $x=-1$ to $x=1$.

Plot[Sum[4 I n Exp[I n x] (-1)^n/(n^2 - 1)^2 - 
4 I n Exp[-I n x] (-1)^n/(n^2 - 1)^2, {n, 2, 10}], {x, -1, 1}]

enter image description here

The Syntax is just

Plot[ formula you want to plot, {x, lowest x, highest x}]

For the sums, the setup is

Sum[sequence to sum, {n,first n, last n}]

Put the two together and you get what I created to plot the sum you've mentioned.

NOTE. More importantly, this plot should look VERY familiar to you. Which means you should be able to do a bit of algebra to the sum you presented and obtain a fairly simple function with which you are familiar!

share|improve this answer

You can define the function as a series -- and Mathematica excels at simplifying and putting these into nice form. For your function, you can write:

f[x_] := FullSimplify[Sum[4 I n Exp[I n x] (-1)^n/(n^2 - 1)^2 - 
                          4 I n Exp[-I n x] (-1)^n/(n^2 - 1)^2, {n, 2, 10}]]

Now you can evaluate

f[x]
-(16/9) Sin[2 x] + 3/8 Sin[3 x] - 32/225 Sin[4 x] + 5/72 Sin[5 x] - (48 Sin[6 x])/1225 
    + 7/288 Sin[7 x] - (64 Sin[8 x])/3969 +  9/800 Sin[9 x] - (80 Sin[10 x])/9801

and see that the series is a weighted sum of sinusoids. Plotting this is easy:

Plot[f[x],{x,-1,1}]

gives a plot identical to that of mathematics2x2life.

share|improve this answer

Adam - you are plotting the wrong function.
http://math.stackexchange.com/questions/620967/finding-the-complex-fourier-series-of-the-function-x2sinx-in-the-interval/620983?noredirect=1#comment1313912_620983

c1[n_] := 1/2/Pi Integrate[x^2 Sin[x] Exp[-I n x], {x, -Pi, Pi}];

c2[n_] = Simplify[c1[n], Assumptions -> Element[n, Integers]];

c[n_] := If[n == 1, c11, If[n == -1, c1[-1], c2[n]]];

f5[x_] = Sum[c[k] Exp[I k x], {k, -5, 5}];

Plot[{f5[x], x^2 Sin[x]}, {x, -Pi, Pi}]

Output of plot

share|improve this answer