||'''Book'''|| Advanced Engineering Mathematics || ||'''Author'''|| Erwin Kreyszig || ||'''Edition'''|| 8th Edition || /* code_begins */ {{{ a0,an,bn,n =var('a0,an,bn,n') # f(x) is neither even nor odd as seen by the figure an=2/pi*(integral(x*cos(n*x),x,-pi/2,pi/2)+integral((pi-x)*cos(n*x),x,pi/2,3*pi/2)) a0=1/(pi)*(integral(x,x,-pi/2,pi/2)+integral(pi-x,x,pi/2,3*pi/2)) print 'a0=',a0 print 'an=',an bn=2/pi*(integral(x*sin(n*x),x,-pi/2,pi/2)+integral((pi-x)*sin(n*x),x,-pi/2,3*pi/2)) print 'bn=',bn #Plotting the function x=var('x') f1=function('f1',x) f1=x f2=function('f2',x) f2=pi-x f1.plot(xmin=-pi/2,xmax=pi/2)+f2.plot(xmin=pi/2,xmax=3*pi/2) /* code_ends */ * '''Solution by''': * Snehal Mitragotri, Ex-student, IIT Roorkee * Aashita Kesarwani, Student, IIT Roorkee * Tale PrafullKumar, Student, IIT Roorkee