Calculus`Integration`
This package extends Integrate and NIntegrate to multiple integration over regions implicitly defined by logical combinations of piecewise algebraic inequalities. It also extends Integrate to integrating piecewise functions.
Describing Regions
The package defines an additional function, Boole that makes it particularly convenient to express multiple integrals over regions defined by logical combinations of inequalities.
The Boole characteristic function or Iverson's convention.
This loads the package.
In[1]:= <<Calculus`Integration`
This plots a Boole function.
In[2]:=
This computes the area of the unit disk.
In[3]:=
Out[3]=
The Boole function is also called Iverson's convention since it was introduced by K.E. Iverson in 1962, with the notation [ineqs] for what we denote Boole[ineqs]. The primary benefit is that—among other things—it allows you to express inline multiple summation and integration problems without having to overburden integration and summation signs with set descriptions. The function is analogous to the characteristic function of a set, where the set is described by logical conditions. For much more on this notation, see [D.E. Knuth, American Mathematical Monthly 99 (1992), 403422], [D.E. Knuth, The Art of Computer Programming—Fundamental Algorithms, Volume 1, Third Edition, 1997, AddisonWesley] and [R.L. Graham, D.E. Knuth, O. Patashnik, Concrete Mathematics—A Foundation for Computer Science, Second Edition, 1994, AddisonWesley].
Visualizing Regions
It is often useful to visualize the region over which to perform integration. A companion package, InqualityGraphics` can be used to facilitate this in an easy manner. For much more on this package and examples, see Graphics`InequalityGraphics`.
Integration over Regions
Expressing most integration problems becomes quite straightforward by using the Boole function.
Multiple integration over sets defined by inequalities.
This integrates over .
In[4]:=
Out[4]=
This uses the Boole notation to express the same integral.
In[5]:=
Out[5]=
The complexity of integration problems depends on the complexity of the integrand and the complexity of region over which you perform the integration. These are some common, but slightly harder integration problems.
This integrates over the set .
In[6]:=
Out[6]=
This integrates over the set .
In[7]:=
Out[7]=
This integrates over the set .
In[8]:=
Out[8]=
This integrates over the set .
In[9]:=
Out[9]=
As usual when symbolic integration fails, numeric integration techniques may very well work.
In this case the last stage of integration fails.
In[10]:=
Out[10]=
As usual you can apply N to get a numerical result.
In[11]:= N[ % ]
Out[11]=
It is however usually faster to apply numeric techniques from the start.
In[12]:=
Out[12]=
This is another example where the symbolic integration fails at one stage. Numeric techniques work fine, however.
In[13]:=
Out[13]=
The region of integration is taken to be the intersection of the region defined by the Boole function and the region defined by the integration bounds. Hence the following are equivalent ways of expressing the same integration problem.
This computes the area of the unit disk lying in the first quadrant.
In[14]:=
Out[14]=
Since the unit disk is bounded, and satisfies , this is an equivalent way of expressing the same specification.
In[15]:=
Out[15]=
Integrating Piecewise Functions
With Calculus`Integration` you can also integrate a wide variety of piecewise functions. In particular this allows you to express integration over regions in several equivalent ways.
Several equivalent ways of integrating over a region in terms of piecewise functions.
When the limits of integration are omitted these are interpreted as being from to .
This integrates over the unit disk.
In[16]:=
Out[16]=
A second way of expressing the same integral.
In[17]:=
Out[17]=
A third way of expressing the same integral.
In[18]:=
Out[18]=
Apart from functions involving Boole, If and Which you can also integrate functions involving UnitStep, Abs, Sign, Min and Max. These may occur any place an algebraic function or polynomial would occur.
Standard piecewise functions that can be used in integration problems.
This integrates a Sign function over a region.
In[19]:=
Out[19]=
This integrates a Max function over a region.
In[20]:=
Out[20]=
Piecewise functions can often have a fairly irregular shape. For instance, this is the Max we just saw.
In[21]:=
These piecewise functions may also be nested.
In[22]:=
Out[22]=
Apart from the regular piecewise functions you can also integrate expressions involving Floor, Ceiling, Round, IntegerPart, FractionalPart, Mod and Quotient. These functions are effectively piecewise functions with infinitely many cases. The integration will succeed when the range over which their arguments range is finite.
Additional piecewise functions.
This integrates a Ceiling function.
In[23]:=
Out[23]=
This integrates a Floor function over a region.
In[24]:=
Out[24]=
These are nested piecewise functions.
In[25]:=
Out[25]=
Some of these piecewise functions do have a fairly complex behavior.
In[26]:=
This is its integral.
In[27]:=
Out[27]=
As mentioned previously the piecewise functions may occur anywhere. In particular they can be used to define regions.
This is the integration of a nested piecewise function over a region defined by a piecewise function.
In[28]:=
Out[28]=
In this case we have a smooth function wrapped around a nested piecewise function.
In[29]:=
Out[29]=
This is a piecewise multiple integration over the region .
In[30]:=
Out[30]=
By combining many of these aspects of piecewise and region function, integration can result in fairly complex problems.
Combining many of the aspects of piecewise function integration.
In[31]:=
Out[31]=
A strange looking nesting of piecewise functions.
In[32]:=
Out[32]=
