MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Infinite integrals of Exp[-A x^2 + 2 B x]

  • To: mathgroup at
  • Subject: [mg68603] Infinite integrals of Exp[-A x^2 + 2 B x]
  • From: AES <siegman at>
  • Date: Fri, 11 Aug 2006 04:40:31 -0400 (EDT)
  • Organization: Stanford University
  • Sender: owner-wri-mathgroup at

Infinite integrals of the general form  Exp[-A x^2 + 2 B x]  with 
Re[A]>0 are common in many problems, can be integrated analytically, and 
also evaluate pretty rapidly in Mathematica, at least when expressed in 
that simple form.

But if you try to evaluate this same integral with even slightly more 
complicated (but still constant) expressions in place of the parameters 
A and B, the evaluation seems to get remarkably slow.

Consider for example the following inputs:

1)  An offset 2D (but separable) gaussian function:

   f[x_,y_,x1_,y1_] = (1/(Pi w^2)) Exp[-((x-x1)/w)^2-((y-y1)/w)^2]

2)  Its 2D (but of course still separable) Fourier transform:

   g[xt_,yt_,x1_,y1_] = Exp[-Pi^2w^2(xt^2+yt^2)] Exp[-I 2Pi(x1 xt+y1 yt)]

3)  The overlap integral of this transform with another offset gaussian:

   c[x1_, y1_, x2_, y2_] = 
      Integrate[g[xt, yt, x1, y1] f[xt, yt, x2, y2], 
      {xt, -Infinity, Infinity}, {yt, -Infinity , Infinity},         
      Assumptions -> Re[(1/w^2) + Pi^2 w^2] > 0]

This final integral, even with the Re[ ] assumption specifically set 
forth, takes *over a minute and half* to evaluate in Mathematica 5.1 on 
a Mac iBook G4 running OS 10.3.9 -- and it took substantially longer to 
evaluate it the first time through, when I was trying to determine the 
necessary assumption needed to get the convergent solution.

I'm surprised that Mathematica behaves so badly (seems bad to me, 
anyway) on this fairly commonplace calculation.  

I could of course simplify the constants in the integrand "by hand", for 
example by converting to normalized variables, and also break the 
separable 2D integration into two 1D integrations "by hand". 

But, hey!  Am I supposed to be making life easier for Mathematica?  Or 
is Mathematica supposed to make life easier for me?!?

  • Prev by Date: Re: Re: need mathematica's help for exploring a certain type of mapping
  • Next by Date: Re: Re: need mathematica's help for exploring a certain type of mapping
  • Previous by thread: Re: Solving integrals
  • Next by thread: Cannot solve 3x3 Eigensystem