Plotting with Mathematica

Make a copy of the  "cell" below this and replace the red words with the function you want to graph, enter  appropriate limits.  (A Mathematica "cell" is all of the lnes within one of the square brackets along the right edge of the "notebook."  You can copy and paste an entire  cell  at once by clicking on the bracket so that is becomes a thick black line.)  

To "execute" the contents of a cell, move your cursor to anywhere within the cell and hit Shift-Enter at the same time.  You must 
do this after you define your function.  To plot your function move your cursor to the  cell with the Plot command and hit Shift-Enter at the same time again; a graph should appear.

v[t_]:= function goes here
lowerLimit = -2;
upperLimit = 2;

Example 1

In the cell below I have replaced the red text above with the text in blue so that I plot a cosine function with an amplitude of 0.5.  (Notice that in Mathematica all functions start with capital letters.)

v[t_]:= Sin[2 π t]
lowerLimit = -1;
upperLimit = 1;

Plot[v[t],{t,lowerLimit,upperLimit}]

Example 2

In the cell below I have defined a function that includes a sum of cosines:
 
	v[t] = 1*Sin[2 π t] + (1/2) Sin[4 π t]

v[t_]:= Sin[2 π t] + 0.5*Sin[4 π t]
lowerLimit = -1;
upperLimit = 1;

Plot[v[t],{t,lowerLimit,upperLimit}]

Example 3

In the cell below I redo Example 2 in a fancy way:  I define the coefficients as a function of the index n,
and the function v[t] as a sum.  If the upper limit of the sum is n=2, then I recover Example 2,
but I can easily let the sum extend to much higher values.   There are palletes with things like summation signs, 
but you can just write things out too.  

With my limits for n this function is

	v[t] = 1*Sin[2 π t] + (1/2)*Sin[4 π t]
	
You can adjust the limits as you like.

a[n_]= 1/n;
v[t_]:= Sum[a[n]*Sin[n 2 π t],{n,1,2}]
lowerLimit = -1;
upperLimit = 1;

Plot[v[t],{t,lowerLimit,upperLimit},PlotRange->All]