Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Wrong Integral result for a Piecewise function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58557] Re: [mg58545] Wrong Integral result for a Piecewise function
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 7 Jul 2005 05:35:46 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dean,

It definitely looks an Integrate bug. If you make an animation of the
integrand it definitely appears that the first smooth plot is correct and
the second result is incorrect.

Needs["Graphics`Animation`"]
frame[x_] :=
  Plot3D[Boole[x - 1 < 2 y + 2 z < x], {y, 0, 1}, {z, 0, 1},
    PlotRange -> {0, 1}]
Animate[frame[x], {x, 0, 5, 0.2}]
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5];
FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1,
      AnimationDirection -> Forward]}]

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: Dean Nairn [mailto:dnairn at udel.edu]
To: mathgroup at smc.vnet.net


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

give different answers

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: Wrong Integral result for a Piecewise function
  • Next by Date: Re: Simplify and FullSimplify
  • Previous by thread: Re: Wrong Integral result for a Piecewise function
  • Next by thread: Re: Wrong Integral result for a Piecewise function