Chapter 1

A simple command to sketch a graph:

Plot[x^2,{x,-1,2}]

The command jf[n,x] produces the first n terms of the Fourier cosine expansion of the constant function 1.

jf[n_,x_]:=4 /Pi*Sum[(-1)^((i-1)/2) Cos[i Pi x/2]/i,{i,1,2n-1,2}]

Plot[jf[10,x],{x,-1,3}]

Plot[jf[20, x], {x, -2, 6}]

Approximate solution to the heat problem (Fourier):

z[n_,x_,w_]:=4/Pi *Sum[(-1)^((i-1)/2) Exp[-i Pi w/2] Cos[i Pi x/2]/i,{i,1,2n-1,2}]/Pi

Plot3D[z[10,x,w],{x,-1,1},{w,0,1}]

A simple sequence plot:

DiscretePlot[(-1)^(n-1)/n,{n,1,10}]

Alternating harmonic sum:

ah[n_]:=Sum[(-1)^(k-1)/k,{k,1,n}]

DiscretePlot[ah[n],{n,1,20}]