An issue with integrals involving absolute value
I have been using SageMathCell for a while and some things that used to work some months before seem to have changed and do not work any longer. In particular, I found the following problem when computing elementary integrals.
Can anyone explain me why "a" yields a correctly computed result but "b" is not computed at all? What should I do to get "b" correctly computed?
x, n = SR.var('x, n')
assume(n, 'integer')
a = integral(x^2*cos(n*x), x, -pi, pi)
b = integral(abs(x)*cos(n*x), x, -pi, pi)
print('a=', a)
print('b=', b)
Welcome to Ask Sage. Thank you for your question.
I think the integration has some issues with absolute values. I forced my absolute value function, and the result is wrong: