This is a question about maple producing undefined errors.
The code below should give the result 0 but instead maple chooses to label it "undefined".
(nj*(nj-1))*(int(N^(ni+nj-2),N=-1..1));
ni:=0; nj:=0;
Since nj=0 you can see quite clearly that even before the integral, the answer is 0 x integral.
The integral is possible to do and doing it by hand it gives you (-1/N) evaluated between 1 and -1 so substituting in (-1/1)-(-1/-1) which is -1-1 = -2).
The overall answer is given by 0x-2 which is 0.
Maple returns undefined.
However if you take a subsection of that code (just the integral)
(int(N^(ni+nj-2),N=-1..1)) or even (int(N^(-2),N=-1..1))
then maple returns infinity.
Neither of these are correct.
Can anyone explain to me why this happens? I think others are likely to come across a similar issue because it is such a simple maple procedure. Yet it gives a confusing result.
As was already shared in the comments, 0 times infinity is undefined, see e.g. Why is infinity multiplied by zero not an easy zero answer
To still keep your Maple sheet as intact as possible, you can always include if-statements in the code, which is really easy
if nj = 0 then
#do something
end if;
However, you should always check if you are doing the right thing mathematically, as Maple does output Undefined for a reason!