Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to evaluate the following integral:

Integrate[HermiteH[n, Sqrt[a]* x] * Exp[- (c/2)* (x^2 + y^2) + b* x * y - (a * x^2)/2], {x, - Infinity, Infinity}]

but Mathematica just returns the function, e.g. does not evaluate it. It does evaluate for specific values of n, but I need a general result. I have considered using FindSequenceFunction, but I believe that this only works for integer sequences (?)

Is there some way I can get Mathematica to evaluate this integral, or is it impossible to do?

Thanks in advance for any replies.

share|improve this question
up vote 1 down vote accepted

I found a (rather messy) way of coaxing symbolic values out of the integral.

Compute the series expansion coefficients of HermiteH[n, x].

hcoeff[n_, m_] = 
  Assuming[n \[Element] Integers && n >= 0,
  SeriesCoefficient[HermiteH[n, x], {x, 0, m}]]

(* Piecewise[{{(I^(-m + n)*2^m*n!)/(m!*((1/2)*(-m + n))!), 
     Mod[m - n, 2] == 0 && m >= 0 && m <= n}}, 0] *)

Compute your integral for a single term in the series expansion.

hint[y_, n_, m_, a_, b_, c_] = 
  Assuming[Element[m, Integers] && 0 <= m <= n && a > 0 && 
    a + c > 0 && Element[n, Integers] && n >= 0, 
      hcoeff[n, m]*(Sqrt[a]*x)^m*Exp[(1/2)*(-c)*(x^2 + y^2) + b*x*y - 
        (a*x^2)/2], {x, -Infinity, Infinity}]]]

(* output too long to quote here *)

Sum the series of integrals - this takes a while to evaluate.

hintsum[y_, n_, a_, b_, c_] = 
  Assuming[a > 0 && a + c > 0 && Element[n, Integers] && n >= 0, 
    FullSimplify[Sum[hint[y, n, m, a, b, c], {m, 0, n}]]]

(* even longer output - but at least the series is summed *)

Now let's test the result by feeding it some rational-valued parameters.

Define a function for generating rationals - use whatever you prefer here.

randrat[k_] := Rationalize[RandomReal[{0, k}], 0.01]

Define a block of code for comparing the NIntegrate version of the original integral with the hintsum version of the integral.

With[{n = 4, y = randrat[3], a = randrat[3], b = randrat[3], 
  c = randrat[3]}, 
  {{y, n, a, b, c},
    NIntegrate[HermiteH[n, Sqrt[a]*x]*         
      Exp[(1/2)*(-c)*(x^2 + y^2) + b*x*y - (a*x^2)/2], {x, -Infinity, Infinity}], 
    ({#1, N[#1]} & )[Simplify[hintsum[n, y, a, b, c]]]}]

The numerical values come out the same, so presumably the symbolic value computed by hintsum is correct.

I would have thought that the symbolic result should be much simpler than the one that Mathematica computes, but at least you can use the above approach to generate symbolic integrals for specific rational-valued parameters.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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