Group Abstract Group Abstract

Message Boards Message Boards

1
|
12.4K Views
|
9 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Wrong integration result using Assuming?

Posted 10 years ago

Let's consider the following piece of code:

In[2]:= Assuming[j \[Element] Integers \[And] k \[Element] Integers, Integrate[Sin[j x] Sin[k x], {x, 0, 2 Pi}]]

Out[2]= 0

The result is obviously wrong, since those integrals are non-zero for j=k. I had brought this up with Wolfram two years ago, with no success. Somewhere in my interaction with Wolfram support there was a suggestion that the above wrong result is somehow the proper result for Mathematica to show. Out of pure curiosity, is there anyone at all who can present a cogent argument for the correctness of the Mathematica output above? If not, can we have this fixed, please?

POSTED BY: Dietmar Rempfer
9 Replies
Posted 10 years ago

That is quite interesting:

In[1]:= dot = 
 Integrate[Sin[j x] Sin[k x], {x, 0, 2 Pi}, 
  Assumptions -> j \[Element] Integers \[And] k \[Element] Integers]

Out[1]= 1/2 (Sin[2 (j - k) \[Pi]]/(j - k) - Sin[2 (j + k) \[Pi]]/(
   j + k))

In[2]:= Limit[dot, j -> k, Assumptions -> k \[Element] Integers]

Out[2]= \[Pi]
POSTED BY: David Keith

One thing to be aware of is that one gets a different result from

Integrate[Sin[j x] Sin[k x], {x, 0, 2 Pi}, 
 Assumptions -> j \[Element] Integers \[And] k \[Element] Integers]

This issue comes up from time to time. Maybe at some point we will wrangle Assuming assumptions to behave identically to those passed in the Assumptions option. It's not straightforward in this case because Integrate alters its local assumptions specifically to avoid issues with discrete values (so Integers in effect becomes Reals for such computations).

For some discussion of all this, see this Mathematica StackExchange note

Also related: 1 2 3 4

POSTED BY: Daniel Lichtblau
Posted 10 years ago

Daniel,

thanks, this is interesting. Looking at the various discussions I have now seen, it seems that a lot (perhaps all) of the issues center around the way Mathematica's Simplify function works. Now, clearly this is a core, and probably quite complex function, but nevertheless, if my hunch is correct then one could consider modifying the way this function works along the lines I suggested above (a global option to modify simplification behavior, or an option that will have Simplify issue Warning messages when potential solutions get dropped). This way, a user may choose to have Mathematica use a "less aggressive" mode of simplification, that is less likely, or ideally cannot, generate the wrong results we are discussing here.

POSTED BY: Dietmar Rempfer
Posted 10 years ago

To an extent, the significance of Mathematica's elimination of special solutions depends on what we are doing with the math. If we are solving y = m x + b for x, then obtaining (y-b)/m, with no warning m != 0 seems fine. If m were zero, the equation reduces to y = b and contains no information about x. We have already excluded that case in our thinking, and discarding it has little risk. The problem with the calculation of Dietmar's integral is that it looks suspiciously like the inner product for a set of orthogonal functions, and the discarded case is in fact critical to function.

POSTED BY: David Keith
Posted 10 years ago

I think this is a good point: Having an option (perhaps something like "RigorousMath") could be useful. Another possibility would be to generate a warning message, similar to the ones we get for, e.g., solutions of nonlinear equations, where Mathematica does warn us that some solutions may be missing. In both cases the user can then use his/her additional insight into the problem of interest to reformulate the problem, or provide restrictions such that the problem of a ballooning tree of conditionals can be avoided. Let's not forget that there may be cases where the user actually does want to see all of the possible solutions, too. Like you said, in the simple case of Solve versus Reduce, that option exists, but in many other cases it doesn't.

Finally, admittedly on a slightly different note, I would be curious as to whether there is in fact a rigorous definition, that is grounded in mathematical reasoning rather than convenience of coding or using Mathematica, behind that comforting-sounding adjective in "generic solution". Frankly, the term "generic" is a dangerously over-used term in certain circles, often used to gloss over significant holes in people's mathematical arguments...

POSTED BY: Dietmar Rempfer
POSTED BY: Gianluca Gorni
Posted 10 years ago
POSTED BY: Dietmar Rempfer
POSTED BY: Karl Isensee
Posted 10 years ago
POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard