Re: newbie problem with NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg49804] Re: [mg49791] newbie problem with NIntegrate
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 1 Aug 2004 18:48:36 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
Needs["Calculus`Integration`"];
Geom = 200 >= x >= 100 && 50 >= y >= -50 &&
-20 <= z <= 20;
Table[Integrate[2*Boole[Geom],{
x,0,xmax},{y,-100,100},{z,-30,30}], {xmax,300,900,300}]
{800000, 800000, 800000}
Bob Hanlon
>
> From: "Xiaoxun" <dbjunxiao at hotmail.com>
To: mathgroup at smc.vnet.net
> Date: 2004/08/01 Sun AM 04:09:54 EDT
> To: mathgroup at smc.vnet.net
> Subject: [mg49804] [mg49791] newbie problem with NIntegrate
>
> Hi, all,
>
> Please advices:
>
> Geom = (200 >=x>= 100 && 50 >= y >= -50 && -20 <= z <= 20);
> gr[x_, y_, z_] := 2 /; Geom;
> gr[x_, y_, z_] := 0 /; ! (Geom);
> N[Integrate[gr[x, y, z], {x, 0, 300}, {y, -100, 100}, {z, -30, 30}]
> This gives a result of 799995.
> However, if changing the x range to {x,0,600} results 799993.
> and {x,0,900} results 0;
>
> So what could we do to ensure the right answer?
>