       Re: Weirdness from double integrals?

• To: mathgroup at smc.vnet.net
• Subject: [mg95741] Re: [mg95708] Weirdness from double integrals?
• From: danl at wolfram.com
• Date: Sun, 25 Jan 2009 21:51:13 -0500 (EST)
• References: <200901251153.GAA00724@smc.vnet.net>

```> I'm new to Mathematica 7 (fiddling with a trial version) and I've bumped
> into something that's confusing me.
>
> Just to make sure I understand Mathematica, I'm playing with finding the
> gravitational field around extended objects using integration.  So far
> I've had no problem (e.g., lines, rings, planes, even Newton's shell
> theorem popped out easily enough), but I'm getting something that's
> confusing about double definite integration the Integrate that's leaving
> me puzzled.  Here's the (cleaned-up) transcript from math:
>
> In:= p = {0, 0, h}
>
> Out= {0, 0, h}
>
> In:= s = {x, y, 0}
>
> Out= {x, y, 0}
>
> In:= q = p - s
>
> Out= {-x, -y, h}
>
> In:= dm = rho (* dx dy *)
>
> Out= rho
>
> In:= integrand = -G * dm * q/(q.q)^(3/2)
>
>                G rho x            G rho y              G h rho
> Out= {-----------------, -----------------, -(-----------------)}
>             2    2    2 3/2    2    2    2 3/2      2    2    2 3/2
>           (h  + x  + y )     (h  + x  + y )       (h  + x  + y )
>
> In:= Integrate[integrand, {x, -x0, x0}, {y, -y0, y0}]
>
> Out= {0, 0, 0}
>
> In:= Integrate[Integrate[integrand, {x, -x0, x0}, Assumptions -> x0 >
> 0 && h > 0], {y, -y0, y0}, Assumptions -> x0 > 0 && y0 > 0 && h > 0]
>
>                                                 x0 y0
> Out= {0, 0, -2 G rho (Pi - 2 ArcCot[----------------------])}
>                                                 2     2     2
>                                         h Sqrt[h  + x0  + y0 ]
>
> It would seem to me, less assumptions, that Out and Out should be
> the same, but Out is clearly wrong (read: "not what I expected" :-)
> -- while the x and y components of the integration are zero by symmetry,
> the z component clearly should not be.  Out looks correct, but I
> thought these would have been the same computation; converting In to
> traditional form in the front end appears to confirm my understanding
> that it does indeed represent a double definite integral over the
> integrand.
>
> So what is there about doing double definite integrals with Integrate
> that I'm missing?  Why aren't these computations the same?
>
> Thanks.
>
> --
> Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
>   San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
>    He who can, does. He who cannot, teaches.
>     -- George Bernard Shaw
>

There are many subtleties to this. First, if you do an explicit multiple
integral (that is, using ont Integrate rather than iterating several of
them), then the GenerateConditions option is only used for the last
integration. This is documented but certainly constitutes "fine print".
For the GenerateConditions->False behavior of prior integrals, it is
common that they might give a spurious zero due to splitting ranges and
making conflicting hidden assumptions on parameters that cause results to
be not everywhere applicable.

One possible way around might be to set GenerateConditions->True so that
it will be in effect for all levels of the integration.

Integrate[integrand[], {x, -x0, x0}, {y, -y0, y0},
GenerateConditions -> True]

Problem now is Mathematica 7 claims this diverges. I need to look into
this more closely, but offhand I have to say this looks like a bug in
convergence testing.

As you have found, best is to give applicable assumptions. This variant
gives a useful result.

Integrate[integrand[], {x, -x0, x0}, {y, -y0, y0},
Assumptions -> {x0 > 0, y0 > 0, h > 0]

If instead I only specify Element[h, Reals] I still get what is perhaps a
valid result, but longer and expressed in terms of complex logs; I think
imaginary parts will cancel, for all parameters real.

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: Weirdness from double integrals?
• Next by Date: Re: Re: 0^0 = 1?
• Previous by thread: Weirdness from double integrals?
• Next by thread: Re: Weirdness from double integrals?