integrate(cos(2 * %pi * n * t), t, 0, 1);
yields
sin(2*%pi*n)/(2*%pi*n)
which clearly doesn't work if n is zero.
First reported at https://ask.sagemath.org/question/67139/why-does-this-non-zero-integral-evaluate-to-0/ and https://stackoverflow.com/questions/75869399/why-does-this-non-zero-integral-evaluate-to-0-in-sagemath
For reference, the antiderivative is what is wrong:
See also downstream at https://github.com/sagemath/sage/issues/35406
This isn't a bug. There is a removable singularity at n=0, and the limit gives the correct result:
Probably debatable (the accumulation function when n=0 clearly doesn't have any singularities (discontinuities?), removable or otherwise), but here is the actual original report:
This returns zero, and that certainly is a bug.
Last edit: kcrisman 2023-03-31
Agreed. Maxima should ask whether n is zero if n is declare integer. I've reopened the bug. Please be sure to include the full context in bug reports -- it's pretty important!
Last edit: Stavros Macrakis 2023-03-31
Great, thanks.
Context - agreed! I just noted that Sympy considers the cases n=0 and not zero separately, so I considered the Maxima behavior a bug, and was trying to declutter.
I'd add that this issue may be having some downstream effects on
packages.
For example:
cos(x) is certainly not zero over the interval [-%pi,%pi] !