Re: Re: Boole Function
- To: mathgroup at smc.vnet.net
- Subject: [mg37236] Re: [mg37231] Re: Boole Function
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Fri, 18 Oct 2002 05:16:51 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
When I first sent my answer I thought there was no interaction between Boole and UnitStep at all,and that one could safely use UnitStep after loading the Calculus`Integration` package, but there seems to be more to it than I had assumed and it is not necessarily for the best. Consider first the following: In[1]:= FullSimplify[Integrate[UnitStep[x,y-x,z-y,1-z],{z,0,1}],y>0] Out[1]= -(-1+y) UnitStep[x,1-y,-x+y] No surprises here. Now let's load the package: In[2]:= <<Calculus`Integration` In[3]:= FullSimplify[Integrate[UnitStep[x,y-x,z-y,1-z],{z,0,1}],y>0] From In[3]:= Integrate::region: The region defined by 0â?¤zâ?¤1&&xâ?¥0&&-x+yâ?¥0&&1-zâ?¥0&&-y+zâ?¥0 \ could not be broken down into cylinders. From In[3]:= Integrate::region: The region defined by yâ?¤zâ?¤1&&xâ?¥0&&-x+yâ?¥0&&1-zâ?¥0 could not \ be broken down into cylinders. From In[3]:= Integrate::region: The region defined by -1â?¤zâ?¤-y&&xâ?¥0&&-x+yâ?¥0 could not be \ broken down into cylinders. From In[3]:= General::stop: Further output of Integrate::region will be suppressed during \ this calculation. Out[3]= -(-1+y) UnitStep[x,1-y,-x+y] Clearly an attempt was made to decompose this into cylinders with respect to z (using CAD) which of course failed. Fortunately we still get the right answer. Secondly, the package actually contains some interesting functions which have been commented out and were apparently intended for future development. On of them is: removeUnitStep[expr_] := ReplaceRepeated[expr, UnitStep[e__] :> Boole[Apply[And, Map[(# â?¥ 0) &, {e}]]]]; Using it we get: removeUnitStep[FullSimplify[Integrate[UnitStep[x,y-x,z-y,1- z],{z,0,1}],y>0]] (error messages removed) -(-1+y) Boole[xâ?¥0&&xâ?¤y&&yâ?¤1] Mathematica can't convert this into (1-y)Boole[0<=x<=y<=1] but it can do the converse: Map[LogicalExpand,(1-y)Boole[0â?¤xâ?¤yâ?¤1],{2}] (1-y) Boole[0â?¤x&&xâ?¤y&&yâ?¤1] Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ On Thursday, October 17, 2002, at 01:09 PM, Andrzej Kozlowski wrote: > Boole (defined in the AddOn package Calculus`Integration`) is not > written to deal with symbolic parameters. So you may do better to use > better to use the built-in UnitStep function for which Mathematica > knows more rules. In fact, if you do not mind getting an error message > you can get something like your answer by mixing UnitStep and Boole: > > << Calculus`Integration` > > In[2]:= > FullSimplify[Integrate[Boole[0 < x < y < 1]*UnitStep[z - y], > {z, 0, 1}],y>0] > > From In[2]:= > Integrate::region: The region defined by 0°¬z°¬1&&0<x<y<1&&-y+z°â??0 > could > not be \ > broken down into cylinders. > > Out[2]= > -(-1+y) Boole[0<x<y<1] UnitStep[1-y] > > Of course the UnitStep is not necessary since the condition y<1 is > already included in Boole, but the Integration package does not have > rules for combining Bool and UnitStep (don't forget that Boole is not a > built in function!). > > If you dispense with Bool altogether you get: > > In[3]:= > FullSimplify[Integrate[UnitStep[x,y-x,z-y,1-z],{z,0,1}],y>0] > > Out[3]= > -(-1+y) UnitStep[x,1-y,-x+y] > > Note that this expresses exactly the same condition as > (1-y)Boole[0<x<y<1]. > > Andrzej Kozlowski > Yokohama, Japan > http://www.mimuw.edu.pl/~akoz/ > http://platon.c.u-tokyo.ac.jp/andrzej/ > > > > > and also try to use proper Mathematica > > On Thursday, October 17, 2002, at 03:26 AM, Janusz Kawczak wrote: > >> Suppose f(x,y,z)=Boole[0<x<y<z<1]. Let's integrate this function >> over, say, z, i.e. Integrate[f[x,y,z],{z,0,1}]. One would expect to >> see >> the >> output like this (1-y)Boole[0<x<y<1] (or maybe simplified expression >> as an argument in the Boole function). Instead, an error appears >> (warning) that the integration cannot be performed. >> >> How to resolve this issue so it produces a desired answer? >> >> Janusz. >> >> >> >> >> > > > >