import matplotlib.pyplot as plt
import numpy as np

x = np.arange(0,1,.01)
f = x

n = int(raw_input('Give highest order: '))

fa=0.0;
for i in range(1,n+1):
    a = (-1)**(i+1) * 2/ (i * np.pi)
    fa += a * np.sin(np.pi * x * i);
    
plt.plot(x,f,'r-',x,fa,'b-')
plt.show()
