From: Ben Dundee on
Interesting!

If you evaluate using NIntegrate you get the correct answer:

In[7]:= f=(x-1)^2*(y-1)^2*(z-1)^2;
NIntegrate[f,{x,-1,1},{y,-1,1},{z,-1,1}]
NIntegrate[Integrate[Integrate[f,{x,-1,1}],{y,-1,1}],{z,-1,1}]
Out[8]= 18.963
Out[9]= 18.963

From: psycho_dad on
Funny, I generalized the expression by replacing the exponent in z-1
with an arbitrary constant:

f=(x-1)^2(y-1)^2 (z-1)^a;

and then both integrations fail in v7:

Integrate[f,{x,-1,1},{y,-1,1},{z,-1,1}]
0

Integrate[Integrate[Integrate[f,{x,-1,1}],{y,-1,1}],
{z,-1,1},Assumptions->a>0]
0

while in v6 they both give:
((-1)^a 2^(7 + a))/(9 (1 + a))

for a->2 this gives 512/27

I would expect that tests like this should be done before a new
version is released...

From: guerom00 on
I stumbled on this one :

In[59]:= f=Piecewise[{
{Sin[x]^4,-\[Pi]<=x<=-\[Pi]/2},
{Sin[x]^10,-\[Pi]/2<=x<=\[Pi]/2},
{Sin[x]^16,\[Pi]/2<x<=\[Pi]}
}];
NIntegrate[f Sin[x],{x,-\[Pi],\[Pi]}]
Integrate[f Sin[x],{x,-\[Pi],\[Pi]}]

Out[60]= 0.
Out[61]= -(25576/109395)

From: DrMajorBob on
NIntegrate fails on the whole interval, but succeeds if we break it into
two intervals:

g[x_] = Piecewise[{{Sin[x]^4, -\[Pi] <=
x <= -\[Pi]/2}, {Sin[x]^10, -\[Pi]/2 <=
x <= \[Pi]/2}, {Sin[x]^16, \[Pi]/2 < x <= \[Pi]}}];
NIntegrate[g@x Sin[x], {x, -\[Pi], 0}] +
NIntegrate[g@x Sin[x], {x, 0, Pi}] -
Integrate[g@x Sin[x], {x, -Pi, Pi}]

-4.59355*10^-14

Bobby

On Fri, 11 Sep 2009 18:57:19 -0500, guerom00 <guerom00(a)gmail.com> wrote:

> I stumbled on this one :
>
> In[59]:= f=Piecewise[{
> {Sin[x]^4,-\[Pi]<=x<=-\[Pi]/2},
> {Sin[x]^10,-\[Pi]/2<=x<=\[Pi]/2},
> {Sin[x]^16,\[Pi]/2<x<=\[Pi]}
> }];
> NIntegrate[f Sin[x],{x,-\[Pi],\[Pi]}]
> Integrate[f Sin[x],{x,-\[Pi],\[Pi]}]
>
> Out[60]= 0.
> Out[61]= -(25576/109395)
>


--
DrMajorBob(a)yahoo.com

From: Alexey on
On 9 Sen, 12:34, guerom00 <guero...(a)gmail.com> wrote:
> Yeah, funny.
>
> In[12]:= f=(x-1)^2 (y-1)^2 (z-1)^2;
> Integrate[f,{x,-1,1},{y,-1,1},{z,-1,1}]
> NIntegrate[f,{x,-1,1},{y,-1,1},{z,-1,1}]
>
> Out[13]= 0
>
> Out[14]= 18.962962945415

In Mathematica 5.2 the bug is absent:

In[1]:=
f=(x-1)^2 (y-1)^2 (z-1)^2;
Integrate[f,{x,-1,1},{y,-1,1},{z,-1,1}]//N
NIntegrate[f,{x,-1,1},{y,-1,1},{z,-1,1}]
Out[2]=
18.963
Out[3]=
18.963

So, in Mathematica 7 some Integrate[]-functionality is broken.