Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Plot function' topicStudent Support Forum > General > Archives > "Plot function"

Next Comment >Help | Reply To Topic
Author Comment/Response
Sandra
01/07/13 09:17am

Hi all, I am new to Mathematica. I am trying to plot a function f(x)=x from the interval (-\pi,\pi) and together on the same graph, the partial sum S4 and S8

I try a the S4 but can't seem to get it right. Can anyone show me how to do it? Here is my code:

s[n_, x_] := Sum[((-1)^(n + 1)) (2/n) (Sin[nx]), {n, 1, Infinity}]
partialsums = Table[s[n, x], {n, 1, 4}];
Plot[Evaluate[partialsums], {x, -3, 3}]

Is there anything wrong with my code?

URL: ,

Subject (listing for 'Plot function')
Author Date Posted
Plot function Sandra 01/07/13 09:17am
Re: Plot function Bill Simpson 01/07/13 3:00pm
Re: Plot function VolMike 01/08/13 03:44am
Re: Plot function Sandra 01/08/13 5:28pm
Next Comment >Help | Reply To Topic