var('k')
g(x) = -k
p(x) = k
a0 = integrate(g(x)/1 , (x,-1,0))
p0 = integrate(p(x)/1 , (x,0,1))
G(x)=a0
P(x)=p0
for n in range(1,8):
        
        an1 = integrate(g(x)*cos(n*x)/1, (x,-1,0))
        bn1 = integrate(g(x)*sin(n*x)/1, (x,-1,0))
        an2 = integrate(p(x)*cos(n*x)/1, (x,0,1))
        bn2 = integrate(p(x)*sin(n*x)/1, (x,0,1))       
        G(x) = G(x)+an1*cos(n*pi/1*x) + bn1*sin(n*pi/1*x)
        P(x) = P(x)+an2*cos(n*pi/1*x) + bn2*sin(n*pi/1*x)
print G(x)+P(x)

Kreyszig-10Review-18-U (last edited 2010-12-18 12:47:38 by Shubham)