       Re: Integral with singularities

• To: mathgroup at smc.vnet.net
• Subject: [mg116680] Re: Integral with singularities
• From: Andrew Moylan <amoylan at wolfram.com>
• Date: Wed, 23 Feb 2011 06:24:10 -0500 (EST)

```You didn't specify what values of a and b you are interested in.

Assuming a == 1 and b == 2:

In:= a = 1;

In:= b = 2;

In:= NIntegrate[
1/Sqrt[(x^2 + y^2) ((x - 1)^2 +
y^2) ((x - a)^2 + (y - b)^2)], {x, -3, 3}, {y, -3, 3},
Exclusions -> {{0, 0}, {1, 0}, {1, 2}}]

Out= 8.48876

I used Exclusions to specify the location of possible singularities, which can help convergence a lot.

For this example, here is how I found a list of candidate singularities:

In:= Reduce[{Sqrt[(x^2 + y^2) ((x - 1)^2 +
y^2) ((x - a)^2 + (y - b)^2)] == 0, Im[x] == Im[y] == 0}]

Out= (x == 0 && y == 0) || (x == 1 && (y == 0 || y == 2))

I hope this helps.

Andrew Moylan
Wolfram Research

On Feb 23, 2011, at 9:24 PM, gmarkowsky at gmail.com wrote:

> Hello all,
>
> I am doing
>
> NIntegrate[
> 1/Sqrt[(x^2 + y^2) ((x - 1)^2 +
>      y^2) ((x - a)^2 + (y - b)^2)], {x, -3, 3}, {y, -3, 3}]
>
> Somehow it is not working very well. This doesn't seem to be a particularly difficult request but Mathematica is having trouble. It keeps saying stuff like
>
> NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >>
>
> NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 18 recursive bisections in x near {x,y} = {1.,2.06474}. NIntegrate obtained 76.80413981137505` and 101.86483781265876` for the integral and error estimates. >>
>
> I guess that near 0, 1, and a+bi the integrand blows up. I have tried to exclude small areas around those points, but I don't seem to be doing it right. Can anyone help?
>
> Greg
>

```

• Prev by Date: Solved: Factor/Simplify set of complex expressions
• Next by Date: Re: Re: Vector Runge-Kutta ODE solver with compilation?
• Previous by thread: Integral with singularities
• Next by thread: Re: Integral with singularities