Fourier Series -Sawtooth Wave

#Fourier Series - Saw Tooth Wave-arfken 14.3.2
from pylab import *
x=linspace(-3*pi,3*pi,1000)
term=0
n=input('Enter the number of terms in series to be taken: ')
for i in range(1,n+1):
    term=term+2*(-1)**(i+1)*sin(i*x)/(i)
plot(x,term)
grid(True)
show()


Output

Comments