g(x) = pi-x
a0 = integrate(g(x)/pi , (x,0,2*pi))
G(x)=a0
for n in range(1,8):
        
        an = integrate(g(x)*cos(n*x)/pi, (x,0,2*pi))
        bn = integrate(g(x)*sin(n*x)/pi, (x,0,2*pi))    
        G(x) = G(x)+an*cos(n*pi/pi*x) + bn*sin(n*pi/pi*x)
print G(x)

Kreyszig-10Review-24-U (last edited 2010-12-18 12:27:48 by Shubham)