| 1 | initial version |
To obtain b one can use the additivity of the integral
var('n')
assume(n, 'integer')
i1=integral(abs(n*x)*cos(n*x), x,-pi,0)
i2=integral(abs(n*x)*cos(n*x), x, 0,pi)
b=i1+i2
i1.simplify_full(), i2.simplify_full(), b.simplify_full()
(((-1)^n - 1)/abs(n), ((-1)^n - 1)/abs(n), 2*((-1)^n - 1)/abs(n))
If the integrand is even, then i1=i2, but the method should work for more general functions.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.