0

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.

Oleksandr R.
  • 23,023
  • 4
  • 87
  • 125

3 Answers3

2

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!

0

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.

bill s
  • 68,936
  • 4
  • 101
  • 191
0

Adam - you are plotting the wrong function. Check this

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, c1[1], 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