-2
> assume(n::'integer'):
> int(exp(n * x * I) * cos(x), x = 0 .. 2 * Pi);
                               0

But if we substitute n=1 by hand:

> int(exp(x * I) * cos(x), x = 0 .. 2 * Pi);
                               Pi

How do I get Maple to tell me which integral values of $n$ make the integral non-zero?

3 Answers3

1

If you remove this hypotesis:

assume(n::'integer'):

Maple will answer $$\dfrac{In(1-e^{2In\pi})}{n^2-1}$$ which shows that $n=\pm 1$ are special values.

FormerMath
  • 2,238
1

The allsolutions option to the int command can sometimes handle this kind of special case.

But the integrand may have to be rewritten to a form in which int recognizes the issue.

assume(n::'integer'):

igrand := simplify(evalc(exp(nxI)*cos(x)));

igrand := cos(x) (sin(n~ x) I + cos(n~ x))

int(igrand, x = 0 .. 2 * Pi, allsolutions);

    { Pi        Or(n~ = -1, n~ = 1)
    {
    { 0              otherwise

The last result above is a piecewise construct.

acer
  • 5,293
0

For this particular one, we can try this:

seq(int(exp(n * x * I) * cos(x), x = 0 .. 2 * Pi) ,n=1..10);
Pi, 0, 0, 0, 0, 0, 0, 0, 0, 0

GEdgar
  • 111,679
  • Thanks, and that does help. However, it misses that n=-1 is also non zero. If you remove the assumption, you get a resulting formula with $n^2-1$ in the denominator and a single zero in the numerator, so can see that $n=\pm 1$ are the only possibilities. However, if I didn't know that the maple answer was wrong, I wouldn't think to look for values of $n$ where it's non-zero. – Martin C. Martin Oct 11 '21 at 00:52
  • Is I supposed to be $i=\sqrt{-1}$? – herb steinberg Oct 11 '21 at 00:59
  • Yes Maple code for $\sqrt{-1}$ is I. – GEdgar Oct 11 '21 at 01:02