Re: Integrate 2 March 1992

*To*: mathgroup at yoda.physics.unc.edu*Subject*: Re: Integrate 2 March 1992*From*: David Withoff <withoff>*Date*: Wed, 4 Mar 1992 11:50:44 -0600

> In[2]:= ans = (1 /(4 Pi^2 k^2)) \ > Integrate[(1/(u v)) \ > Exp[-((so + ss)/2) (u^2 + v^2) - u v phi], \ > {u,-Infinity,Infinity},{v,-Infinity,Infinity}] > > Infinity::indet: > Indeterminate expression ComplexInfinity + ComplexInfinity encountered. > > Integrate::idiv: Integral does not converge. > > Out[2]= Indeterminate > > The integral does not diverge. It works out via a sequence of > transformations that I would like to teach to Mathematica > (change variable, differentiate, change variable, substitute, > integrate differential equation) (*) > > (1/(2 Pi k^2)) ArcSin(phi/(so + ss)) + c > > where c is a constant of integration that happens to > be 0. > > I know this is not an easy sort of integral to do. > One of the reasons I make the effort to use a > symbolic math package is so it will save me effort > evaluating hard integrals. At least, Mathematica > should say it can't do it, not report false information. > > This makes me wonder if it safe to try to each Mathematica > the steps. > > Any clues/suggestions/workarounds ? > > Thanks, > > Purvis > purvis at mulab.physiol.upenn.edu I'm not sure I have any suggestions or workarounds -- maybe just clues. I can describe what's going on, and it may or may not interfere with teaching Mathematica the steps you describe. Also, just for fun, I thought I'd try to summarize what I do when tracking down problems like this. Definite integrals are normally evaluated (in Mathematica) using one of two methods -- by evaluating the indefinite integral and taking limits at the functions. The first method has the well-known deficiency of ignoring branch cuts and other singularities. Also, since it uses the Limit code, problems in Limit will also show up in Integrate. The most common problem of this type arises from the fact that Limit can't always handle essential singularities. (Both problems are being worked on, and neither affects the integral in the present example.) Various rules are used to decide which method to try first. You can force Mathematica to use the indefinite integration method by evaluating the indefinite integral and taking limits at the endpoints yourself. You can (at least in V2.0) force Mathematica to use the generalized hypergeometric method by using Integrate`IntegrateG instead of Integrate. (This is not documented, however, and may change in future versions.) There is currently no special support in Mathematica for multiple integrals. Multiple integrals are evaluated as iterated integrals. Anyway, with that background, I took a look at the integral in the example above, which is an iterated definite integral of the following function: In[17]:= f = E^(-(phi*u*v) - ((so + ss)*(u^2 + v^2))/2)/(u*v) 2 2 -(phi u v) - ((so + ss) (u + v ))/2 E Out[17]= ------------------------------------- u v This integrand has a pole at v==0, so the corresponding integral has limited convergence properties (it isn't, for example, uniformly convergent). It probably has a useful principal value, however. One method that sometimes works to get the principal value of an integral with a singularity at, say, x==x0 is to use Limit[eps -> 0, Integrate[f, {x, a, x0-eps}] + Integrate[f, {x, x0+eps, b}] ] The integral in the present example is not elementary and this method doesn't help. The first of the iterated integrals is sent to the package that implements the generalized hypergeometric method, which probably doesn't like the singularity: In[20]:= Integrate`IntegrateG[f, {v, -Infinity, Infinity}] Infinity::indet: Indeterminate expression ComplexInfinity + ComplexInfinity encountered. Out[20]= Indeterminate After this, the second of the iterated integrals is degenerate: In[21]:= Integrate[Indeterminate, {u, -Infinity, Infinity}] Integrate::idiv: Integral does not converge. Out[21]= Indeterminate The message is arguably a bit misleading, but at least we know where it comes from. Like I said -- a few clues, but no workarounds. The implied suggestions (to provide special support for principal value integrals and multiple integrals) are certainly worth pursuing. Dave Withoff withoff at wri.com

**OutputForm**

**Printing out mathematica graphics**

**OutputForm**

**Numerically solving InterpolatingFunction**