# Mathematica and its default assumptions

I am a bit surprised that evsluating

Integrate[Exp[I n x],{x, 0, Pi}]


gives

$$\qquad \frac{-i(e^{in\pi}-1)}{n}$$.

What if $$n = 0$$? I didn't assume anything about $$n$$ and yet Mathematica assumes $$n\neq 0$$.

It is the same with the Maxima command :

integrate(exp(%i*n*x),x,0,%pi);


and the Maple command

int(exp(n*x*I), x = 0 .. PI)


How do I handle this kind of behavior which I consider undesirable?

What is the name of this feature in symbolic computation, so that I can find a solution for Maxima as well.

• That is the General solution that Mathematica shows. Simplification isn’t needed unless a specific forbidden value is chosen. User72028 shows then how the limit can be taken to manage for this. I would not consider it an error. – CA Trevillian Sep 11 '20 at 12:53
• ...and cvgmt gave the example I was going to give: consider the simpler Integrate[x^a, x] and note that the "singular" case is not included in the generic answer given. – J. M.'s torpor Sep 11 '20 at 16:12
• You can use Piecewise to make it explicit: int = Piecewise[{{Integrate[Exp[I n x], {x, 0, Pi}], n != 0}, {Integrate[Exp[I n x] /. n -> 0, {x, 0, Pi}], n == 0}}] – Bob Hanlon Sep 11 '20 at 17:19

$$n = 0$$ is a removable singularity. If you take the limit of the result of the integral, you will get the same as if you put $$n = 0$$ before taking the integral:

result = Integrate[Exp[I n x], {x, 0, Pi}]

Limit[result, n -> 0]
(* Pi *)

Integrate[Exp[I 0 x], {x, 0, Pi}]
(* Pi *)


Re @cvgmt on Integrate[x^a, x] for a = -1: that also is a removable singularity (provided the constant of integration is chosen correctly). We have $$\int_1^x u^a \,\mathrm{d}u = \frac{x^{a+1} - 1}{a+1},$$ and $$\lim_{a \to -1} \frac{x^{a+1} - 1}{a+1} = \log x.$$
In general Mathematica does not bother with treating removable singularities separately. For example, x/x will simplify to 1 without any assumptions on x.
• @user72028 Integrate[x^a, x] why does not consider the case a= -1 – cvgmt Sep 11 '20 at 10:58