Re: Evaluating a convolution integral in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg80269] Re: Evaluating a convolution integral in Mathematica
- From: Randall Beer <rdbeer at indiana.edu>
- Date: Thu, 16 Aug 2007 04:46:06 -0400 (EDT)
- References: <f9ud4q$a5q$1@smc.vnet.net> <46C32C19.3090203@gmail.com>
Thanks for your response. I defined B as 1/2 (-Sign[-max + x] + Sign [-min + x]). Yes, I did provide Mathematica with the assumptions I stated in my message. However, the result Mathematica gives seems to produce incorrect answers when specific values of n, m, and the mins and maxs are substituted in. I will take a look at the MathSource notebook that you suggested. Thanks, Randy Beer On Aug 15, 2007, at 12:38 PM, Jean-Marc Gulliet wrote: > rdbeer at indiana.edu wrote: >> I am having trouble evaluating a convolution integral in Mathematica. >> Define B[x,{min,max}] to be a function that takes on the value 1 when >> x is between min and max and 0 otherwise. I need to find the >> convolution of x^n B[x, {min1, max1}] with x^m B[x, {min2, max2}], >> where x is Real, n and m are nonnegative integers, and the mins and >> maxs are Real with the constraints that min1<=max1 and min2<=max2. >> The resulting convolution integeral is Integrate[t^n B[t, {min1, >> max1}] (x-t)^m B[x-t, {min2, max2}], {t, -Infinity, Infinity}]. >> Mathematica 6.0.1 has no problem evaluating this integral when >> constant values are substituted for n, m, and the mins and maxs. >> However, I need the general value of this integral. Mathematica also >> claims to be able to evaluate this general integral, returning a >> complicated peicewise expression involving gamma functions and >> hypergeometric functions. However, when specific values for n, m and >> the mins and maxs are then substituted into this general expression, >> it always returns either 0 or Indeterminate. >> Any help with evaluating this integral in general would be greatly >> appreciated. > > It is not clear, at least for me, how you coded your function B? > Did you use Piecewise, If, Which, Boole, ... ? Here is a simple > example with Boole, > > B[x_, {min_, max_}] := Boole[min <= x <= max] > > Also, it is not clear whether you have tried to set up your > assumptions in Integrate itself. For instance, > > Integrate[ > t^n B[t, {min1, max1}] (x - t)^m B[ > x - t, {min2, max2}], {t, -Infinity, Infinity}, > Assumptions -> {{x, min1, mmax1, min2, max2} \[Element] > Reals, {n, m} \[Element] Integers, n >= 0, m >= 0, min1 <= max1, > min2 <= max2}] > > returns a long piecewise function with some hypergeometric > functions (I did not try to simplify nor to check the validity of > the expression since I did not know what the function B really was). > > Also, it may be worthwhile to try Maxim Rytin's "Integration of > Piecewise Functions with Applications" package available at > > http://library.wolfram.com/infocenter/MathSource/5117/ > > Especially, you should check the function *PiecewiseIntegrate*. > From the notebook piecewise.nb, we can read, > > "PiecewiseIntegrate[f,{x,xmin,xmax},{y,ymin,ymax},\[Ellipsis]] > gives the definite integral of function f. It is intended for > integrating piecewise continuous functions, and also generalized > functions. It handles integrands and integration bounds involving > the following expressions: > > . UnitStep, Sign, Abs, Min, Max > . Floor, Ceiling, Round, IntegerPart, FractionalPart, Quotient, Mod > . DiracDelta and its derivatives, DiscreteDelta, KroneckerDelta > . If, Which, Element, NotElement > . Piecewise, Boole, Clip" > > For instance, > > PiecewiseIntegrate[ > t^n B[t, {min1, max1}] (x - t)^m B[ > x - t, {min2, max2}], {t, -Infinity, Infinity}, > Assumptions -> {{x, min1, mmax1, min2, max2} \[Element] > Reals, {n, m} \[Element] Integers, n >= 0, m >= 0, min1 <= max1, > min2 <= max2}] > > returns a long answer made of nested If constructs that return some > simple expressions such as > > If[m == 0 && min1 < max1 && min2 == -max1 + max2 + min1 && > x == max1 + min2, > If[min1 > 0, (-min1^(1 + n) + max1^n (-min2 + x))/(1 + n), [...] > > (Again, I have not try to simplify nor to check the validity of the > expression.) > > HTH > -- > Jean-Marc >