Re: newbie problem with NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg49811] Re: newbie problem with NIntegrate
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Sun, 1 Aug 2004 18:48:43 -0400 (EDT)
- Organization: The University of Western Australia
- References: <cei8o5$2he$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <cei8o5$2he$1 at smc.vnet.net>, "Xiaoxun" <dbjunxiao at hotmail.com> wrote: > 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? In version 5.0, load << Calculus`Integration` and us Boole: Integrate[2 Boole[200 >=x>= 100 && 50 >= y >= -50 && -20 <= z <= 20], {x, 0, 300}, {y, -100, 100}, {z, -30, 30}] 800000 The answer does not change when the upper limit of x changes. Cheers, Paul -- Paul Abbott Phone: +61 8 9380 2734 School of Physics, M013 Fax: +61 8 9380 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul