       Re: Weirdness from double integrals?

• To: mathgroup at smc.vnet.net
• Subject: [mg95719] Re: Weirdness from double integrals?
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Sun, 25 Jan 2009 21:47:12 -0500 (EST)
• Organization: The Open University, Milton Keynes, UK
• References: <glhjr1\$mh\$1@smc.vnet.net>

```In article <glhjr1\$mh\$1 at smc.vnet.net>,
Erik Max Francis <max at alcyone.com> wrote:

> 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.

Several things might occur here. First, platform/system dependency since
on my system the results are identical. Second, to get consistent
results, you should apply the same assumptions to each computation.
Third, keep in mind that Mathematica has its own way to do things and in
the case of multiple integration the leftmost variable written in the
Integrate command is indeed the outermost integration variable in the
mathematical expression. In other words, In integrates first for y
from -y0 to y0, then for x from -x0 to x0. To get the same result as in
In, you must write

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

Having said that, here is what I got on my system:

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

Out= rho

In:= integrand = -G*dm*q/(q.q)^(3/2)

Out=
G rho x            G rho y              G h rho
{-----------------, -----------------, -(-----------------)}
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},
Assumptions -> x0 > 0 && y0 > 0 && h > 0]

Out=
x0 y0
{0, 0, -4 G rho ArcTan[----------------------]}
2     2     2
h Sqrt[h  + x0  + y0 ]

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

Out=
x0 y0
{0, 0, -2 G rho (Pi - 2 ArcCot[----------------------])}
2     2     2
h Sqrt[h  + x0  + y0 ]

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

Out=
x0 y0
{0, 0, -2 G rho (Pi - 2 ArcCot[----------------------])}
2     2     2
h Sqrt[h  + x0  + y0 ]

In:= \$Version

Out= 6.0 for Mac OS X x86 (64-bit) (May 21, 2008)

Regards,
--Jean-Marc

```

• Prev by Date: Re: Frames on Density Plots in Version 7
• Next by Date: Re: Mathematica and LyX - Graphics and equations
• Previous by thread: Re: Weirdness from double integrals?
• Next by thread: Re: Weirdness from double integrals?