Re: Weirdness from double integrals?

• To: mathgroup at smc.vnet.net
• Subject: [mg95744] Re: [mg95708] Weirdness from double integrals?
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Sun, 25 Jan 2009 21:51:46 -0500 (EST)

```p = {0, 0, h};

s = {x, y, 0};

q = p - s;

dm = rho;

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

They give identical results when both have the same assumptions

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

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

True

Bob Hanlon

---- 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[1]:= p = {0, 0, h}

Out[1]= {0, 0, h}

In[2]:= s = {x, y, 0}

Out[2]= {x, y, 0}

In[3]:= q = p - s

Out[3]= {-x, -y, h}

In[4]:= dm = rho (* dx dy *)

Out[4]= rho

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

G rho x            G rho y              G h rho
Out[5]= {-----------------, -----------------, -(-----------------)}
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[7]:= Integrate[integrand, {x, -x0, x0}, {y, -y0, y0}]

Out[7]= {0, 0, 0}

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

x0 y0
Out[9]= {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[7] and Out[9] should be
the same, but Out[7] 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[9] looks correct, but I
thought these would have been the same computation; converting In[7] 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

```

• Prev by Date: Re: Re: Which editor do you use for math
• Next by Date: Re: Weirdness from double integrals?
• Previous by thread: Re: Weirdness from double integrals?
• Next by thread: Mathematica and LyX - Graphics and equations