2
$\begingroup$

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.

$\endgroup$
3
  • 1
    $\begingroup$ 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. $\endgroup$ – CA Trevillian Sep 11 '20 at 12:53
  • $\begingroup$ ...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. $\endgroup$ – J. M.'s torpor Sep 11 '20 at 16:12
  • 1
    $\begingroup$ 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}}] $\endgroup$ – Bob Hanlon Sep 11 '20 at 17:19
5
$\begingroup$

$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 *)

Addendum

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.

$\endgroup$
2
  • 1
    $\begingroup$ so when the singularity can't be removed, it doesn't simplify ? Do you know on which mathematical (surely from singularity theory) theorem this features comes from ? $\endgroup$ – Smilia Sep 11 '20 at 10:20
  • 3
    $\begingroup$ @user72028 Integrate[x^a, x] why does not consider the case a= -1 $\endgroup$ – cvgmt Sep 11 '20 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.