0
$\begingroup$

Iam triying to plot summatory of the next function:

(e^(i*n*t*wo)*Sin[n*Pi/2])/(n*pi)

I have no problem plotting a trigonometric fourier serie, so the only problem is plotting the complex i. I have watched several videos where they use an uppercase I instead of an lowercase i, I have already tried that but with no results. The functions that I use are:

s[i_,t_] := 1/2 + Sum[(e^(i*n*t*wo)*Sin[n*Pi/2])/(n*pi),{n,-i,-1}] + Sum[(e^(i*n*t*wo)*Sin[n*Pi/2])/(n*pi),{n,1,i}] 

Plot[s[10],{t,-10,10}]

First I made a declaration of a function where the summatories are declared, the i in the Plot[] function is the number of iterations.

I offer an apologize my english is not the best one and I dont know how to make the ecuation look pretty. Anyway thanks a lot.

$\endgroup$

closed as off-topic by Jens, MarcoB, RunnyKine, dr.blochwave, user9660 Mar 11 '16 at 19:54

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Jens, MarcoB, RunnyKine, dr.blochwave, Community
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    $\begingroup$ You will want to use Re[] or Im[] to see the individual parts in Plot[], or use ReIm[] in conjunction with ParametricPlot[]. Also, the exponential constant is E (capitalization matters!) and the exponential function is Exp[]. $\endgroup$ – J. M. is away Mar 11 '16 at 17:41
  • 2
    $\begingroup$ First you should look at the Mathematica documentation for Exp, then also search for examples here. See this Q&A or this one, for instance. Your definition is incorrect because s uses two arguments but you in Plot you're calling it with just one. $\endgroup$ – Jens Mar 11 '16 at 17:46
2
$\begingroup$

This might be what you are after:

s[i_, t_] := 1/2 + Sum[(E^(I*n*t*wo)*Sin[n*Pi/2])/(n*Pi), {n, -i, -1}] + 
                   Sum[(E^(I*n*t*wo)*Sin[n*Pi/2])/(n*Pi), {n, 1, i}];
wo = 1; 
Plot[s[5, t], {t, -10, 10}]

enter image description here

$\endgroup$
  • $\begingroup$ yeeei!!! Thanks, but could you please explain me why you use the I and the E? $\endgroup$ – Mac Mar 11 '16 at 17:59
  • $\begingroup$ Because as I said, capitalization matters, @Mac. Those are the symbols used by Mathematica for the constants you know. $\endgroup$ – J. M. is away Mar 11 '16 at 18:14
  • 1
    $\begingroup$ Consider the difference between ?E and ?e. $\endgroup$ – bill s Mar 11 '16 at 18:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.