Open rtoy opened 5 months ago
Imported from SourceForge on 2024-07-05 23:36:04 Created by kcrisman on 2023-03-31 21:09:24 Original: https://sourceforge.net/p/maxima/bugs/4125/#58fa
For reference, the antiderivative is what is wrong:
integrate(cos(2 * %pi * n * t),t);
sin(2*%pi*n*t)/(2*%pi*n)
Imported from SourceForge on 2024-07-05 23:36:08 Created by kcrisman on 2023-03-31 21:18:41 Original: https://sourceforge.net/p/maxima/bugs/4125/#efeb
See also downstream at https://github.com/sagemath/sage/issues/35406
Imported from SourceForge on 2024-07-05 23:36:11 Created by macrakis on 2023-03-31 21:37:45 Original: https://sourceforge.net/p/maxima/bugs/4125/#7c06
This isn't a bug. There is a removable singularity at n=0, and the limit gives the correct result:
(%i1) integrate(cos(2*%pi*n*t),t,0,1);
sin(2 %pi n)
(%o1) ------------
2 %pi n
(%i2) limit(%,n,0);
(%o2) 1
(%i3) integrate(cos(2*%pi*0*t),t,0,1);
(%o3) 1
Imported from SourceForge on 2024-07-05 23:36:15 Created by macrakis on 2023-03-31 21:38:12 Original: https://sourceforge.net/p/maxima/bugs/4125/#4b9b
Imported from SourceForge on 2024-07-05 23:36:18 Created by kcrisman on 2023-03-31 21:56:21 Original: https://sourceforge.net/p/maxima/bugs/4125/#bb1a
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:
declare(n, integer);
integrate(cos(2 * %pi * n * t), t, 0, 1);
This returns zero, and that certainly is a bug.
Imported from SourceForge on 2024-07-05 23:36:22 Created by macrakis on 2023-03-31 22:19:30 Original: https://sourceforge.net/p/maxima/bugs/4125/#bb1a/479d
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!
Imported from SourceForge on 2024-07-05 23:36:25 Created by kcrisman on 2023-03-31 22:55:58 Original: https://sourceforge.net/p/maxima/bugs/4125/#bb1a/479d/5daa
Great, thanks.
Imported from SourceForge on 2024-07-05 23:36:29 Created by kcrisman on 2023-03-31 23:02:48 Original: https://sourceforge.net/p/maxima/bugs/4125/#bb1a/479d/dcf0
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.
Imported from SourceForge on 2024-07-05 23:36:03 Created by kcrisman on 2023-03-31 21:08:37 Original: https://sourceforge.net/p/maxima/bugs/4125
yields
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