3
$\begingroup$

Hermite polynomials should be orthogonal over a Gaussian measure. However when the orders of the polynomials are larger than a few, Mathematica gets this wrong. Strangely, it seems to hinge on whether orders of the two polynomials are both even or both odd (failure), or if one is even and the other is odd (success).

To illustrate, this gives the correct answer:

In[27]:= Integrate[
 HermiteH[9, x] HermiteH[18, x] Exp[-  x^2], {x, -Infinity, Infinity}]

Out[27]= 0

But this doesn't:

In[25]:= Integrate[
 HermiteH[8, x] HermiteH[18, 
   x] Exp[-(1/2) x^2] Exp[-(1/2) x^2], {x, -Infinity, Infinity}]

During evaluation of In[25]:= Integrate::idiv: Integral of E^-x^2 (105-840 x^2+840 x^4-224 x^6+16 x^8) (-34459425+620269650 x^2-1654052400 x^4+1543782240 x^6-661620960 x^8+147026880 x^10-17821440 x^12+1175040 x^14-39168 x^16+512 x^18) does not converge on {-\[Infinity],\[Infinity]}. >>

Out[25]= \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(-\[Infinity]\), \
\(\[Infinity]\)]\(\(
\*SuperscriptBox[\(E\), \(-
\*SuperscriptBox[\(x\), \(2\)]\)]\ \((1680 - 13440\ 
\*SuperscriptBox[\(x\), \(2\)] + 13440\ 
\*SuperscriptBox[\(x\), \(4\)] - 3584\ 
\*SuperscriptBox[\(x\), \(6\)] + 256\ 
\*SuperscriptBox[\(x\), \(8\)])\)\ \((\(-17643225600\) + 317578060800\ 
\*SuperscriptBox[\(x\), \(2\)] - 846874828800\ 
\*SuperscriptBox[\(x\), \(4\)] + 790416506880\ 
\*SuperscriptBox[\(x\), \(6\)] - 338749931520\ 
\*SuperscriptBox[\(x\), \(8\)] + 75277762560\ 
\*SuperscriptBox[\(x\), \(10\)] - 9124577280\ 
\*SuperscriptBox[\(x\), \(12\)] + 601620480\ 
\*SuperscriptBox[\(x\), \(14\)] - 20054016\ 
\*SuperscriptBox[\(x\), \(16\)] + 262144\ 
\*SuperscriptBox[\(x\), \(18\)])\)\) \[DifferentialD]x\)\)
$\endgroup$
6
  • 1
    $\begingroup$ What version are you on? Version 11 seems to cope with the Hermite polynomials. $\endgroup$ Commented Aug 12, 2016 at 15:14
  • $\begingroup$ Both the $H_9(x)H_{18}(x)$ and $H_8(x)H_{18}(x)$ examples give zero on my machine on v11 and v10.4.1. $\endgroup$ Commented Aug 12, 2016 at 15:17
  • $\begingroup$ You might also want to see this. $\endgroup$ Commented Aug 12, 2016 at 15:18
  • $\begingroup$ Both give 0 for me, V10.0.1 on Mac OS 10.10.5. $\endgroup$
    – march
    Commented Aug 12, 2016 at 15:30
  • $\begingroup$ I also got 0 in v9.0.1 $\endgroup$
    – Hector
    Commented Aug 12, 2016 at 17:30

1 Answer 1

-1
$\begingroup$

The OP's example works fine for me in Mma 11. However, if we're talking about unreliable, notice that expressions using assumptions may give you unexpected results. For example,

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

returns a bland zero, which is of course mathematically incorrect, since the result is \[Pi] for j==k (as Mma will readily confirm if you add that assumption). I remember having some discussions about this with Wolfram support. To sum it up, Wolfram argues that this is not a bug, and that returning zero to an expression like the above is proper, since it's true most of the time. I happen to disagree, as follows:

Following J.M.'s comment below, Wolfram argues that the result is "generically correct", incorrectly, I would argue: Notice that in this particular case, the entire set that is tested is countable, just as the set where the result is wrong. Thus there is a one-to-one mapping available that matches each and every single case where the result is correct to a case where the result is false. In other words, in a strict sense there are exactly as many cases where the result is wrong as there are cases where it's correct. One might colloquially put this in the form of "this result is just as likely to be wrong as it is likely to be correct". Of course, since we're talking about countable infinite sets, there's a bit of a sleight-of-hand here...

But, let's consider this one:

Assuming[k \[Element] Integers \[And] j \[Element] Integers 
         \[And] j <= k <= j + 1 \[And] 0 <= k <= 20, 
            Integrate[Sin[k x] Sin[j x], {x, 0, 2 Pi}]]

Now we can see that even without considering infinite sets, Mathematica returns a result that's wrong half the time. Anyone willing to defend that one?

$\endgroup$
5
  • $\begingroup$ "...Wolfram argues that this is not a bug, and that returning zero to an expression like the above is proper, since it's true most of the time." - i.e., the expression is generically correct, since it only fails on a countable set of cases. $\endgroup$ Commented Aug 12, 2016 at 17:15
  • $\begingroup$ @J.M.: Yep, that's exactly the argument. I still don't buy it. Notice that in this particular case, the entire set that is tested is countable, just as the set where the result is wrong. Thus there is a one-to-one mapping available that matches each and every single case where the result is false to a case where the result is correct. One might colloquially put this in the form of "this result is just as likely to be wrong as it is likely to be correct". Of course, since we're talking about countable infinite sets, there's a bit of a sleight-of-hand here... $\endgroup$
    – Pirx
    Commented Aug 12, 2016 at 17:37
  • $\begingroup$ P.S.: (Note added after looking at your link): So, my example above is qualitatively different from the case you linked to: In that case, we are comparing a set with a single element to an infinite set, whereas in my case, we are comparing two infinite sets that both have the same cardinality. $\endgroup$
    – Pirx
    Commented Aug 12, 2016 at 17:43
  • 2
    $\begingroup$ Better to use ii = Integrate[Sin[k x] Sin[j x], {x, 0, 2 Pi}, Assumptions -> k \[Element] Integers \[And] j \[Element] Integers \[And] j <= k <= j + 1 \[And] 0 <= k <= 20]. Check here for some remarks on why Assuming outside Integrate can be different from Assumptions->... inside. $\endgroup$ Commented Aug 13, 2016 at 15:07
  • 3
    $\begingroup$ I will add that, in addition to being substantially a duplicate of several prior questions, the main thrust of this response is not related to the issue raised in the original post of this thread. $\endgroup$ Commented Aug 13, 2016 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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