-1

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.

  • For the second case, have a look at the plot of [the function](http://www.wolframalpha.com/input/?i=plot+x^%28-2%29+x%3D-1..1). The result is indeed inf. – nhahtdh Nov 24 '12 at 20:20
  • 1
    And you are forcing 0 * Inf, which doesn't make any sense, so the result is `Undefined` for the first case. – nhahtdh Nov 24 '12 at 20:23
  • 1
    Check out [Integrability](http://en.wikipedia.org/wiki/Riemann_integral#Integrability). The function is not bounded on the [-1, 1] interval. – nhahtdh Nov 24 '12 at 20:36
  • Thank you. Is there a way that I can somehow add limits into my code in order to make it work? It's part of a much larger program that I've written and I isolated this as the line that was causing a problem at ni=nj=0 (but for values of ni and nj above zero it holds - I use these higher values in a loop) so I was hoping to keep the code in somehow if there's a way to modify it. How would you recommend I change it? – Emily Finnerty Nov 24 '12 at 20:56
  • I assume ni and nj are natural number? Then if ni + nj - 2 is negative, and if ni + nj - 2 is odd then [Cauchy principle value](http://en.wikipedia.org/wiki/Cauchy_principal_value) assumption holds, which allow the function to be integrable from negative to positive although the function may not be bounded; for the case ni + nj - 2 is even (and negative), then the function is not integrable from negative to positive number. If ni + nj - 2 >= 0, then it should be integrable (the case = 0 is a bit special since 0^0 is undefined, but from what I read, it should be OK). – nhahtdh Nov 25 '12 at 04:04
  • @EmilyFinnerty Afaik you can construct if statements in Maple. As Maple cannot know what you want, you should explicitly give these instructions. – Bernhard Dec 26 '12 at 10:09

1 Answers1

1

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!

Community
  • 1
  • 1
Bernhard
  • 3,619
  • 1
  • 25
  • 50