Wrong Integral result for a Piecewise function

• To: mathgroup at smc.vnet.net
• Subject: [mg58545] Wrong Integral result for a Piecewise function
• From: "Dean Nairn" <dnairn at udel.edu>
• Date: Wed, 6 Jul 2005 03:11:32 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```This integral gives gives the wrong result for the interval [2,3]

h[x_] := Integrate[Boole[x - 1 < 2 y + 2 z < x], {y, 0, 1}, {z, 0, 1}]

Plot[h[x],{x,0,5}]
and
Plot[Evaluate[h[x]],{x,0,5}]

give different plots,  The curve should be smooth and bell shaped from
0 to 5, so the first looks correct. The second has a jump discontinuity
at 2 and 3. Also

h[5/2]
and
h[x]/.x-> 5/2

This is using some new features in Mathematica 5.1.  Same result on a
Mac (10.4) and SunOS (5.9).

Breaking into a difference of two integrals gives the correct answer:
Integrate[Boole[ 2 y + 2 z < x], {y, 0, 1}, {z, 0, 1}] -
Integrate[Boole[ 2 y + 2 z < x-1], {y, 0, 1}, {z, 0, 1}]

Finally
Integrate[h[x], {x, 0, 5}] and NIntegrate[h[x], {x, 0, 5}]
both give the wrong answer, it should be 1. The triple integral is
correct

Integrate[Boole[x - 1 < 2 y + 2z < x], {y, 0, 1}, {z, 0, 1}, {x, 0, 5}]

Any suggestions on integrating over regions with linear constraints?
Versions 5.1 has powerful new piecewise functions

```

• Prev by Date: Re: Function to handle array with variable _number_ of dimensions?
• Next by Date: Re: display of function
• Previous by thread: Re: Simplify and FullSimplify
• Next by thread: Re: Wrong Integral result for a Piecewise function