Why does this non-zero integral evaluate to 0?
I want to perform formal computations using SageMath, which involve integrals of trigonometric functions. I noticed some inconsistencies and narrowed my issues down to the following basic problem.
Why does the following source code return 0?
var('n t') assume(n, 'integer') integrate(cos(2 * pi * n * t), t, 0, 1)
While I agree that the integral is zero when n
is non-zero, mathematically, the integral is worth 1 when n
is zero. Up to my understanding, I only tell SageMath that n
is an integer here, so it should handle the case n = 0
also.
I checked that integrate(cos(2 * pi * 0 * t), t, 0, 1)
correctly returns 1, so SageMath seems to be aware of this possibility, but somehow misses the fact that n
could be 0.
What am I missing?
See also this SO question.