Re: Convolution integrals
- To: mathgroup at smc.vnet.net
- Subject: [mg16842] Re: Convolution integrals
- From: jf alcover <jfalcover at cepme.fr>
- Date: Thu, 1 Apr 1999 21:35:19 -0500
- Organization: cepme
- References: <7dpso7$ds1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
dear mm,
maybe the reason of the trouble is that InverseFourierTransform
does not recognize the mate of a 'shifted' gaussian?
anyway, i propose to you the following bypass
(not thoroughly tested ! ) :
ClearAll[myIFT];
In[1]:=
myIFT[E^expo_,s_,x_]/;
Exponent[expo,s]==2 &&Length[CoefficientList[expo,s]]==3:=
Module[{e1,e2,mu,sig},e1=expo/.s->1;e2=expo/.s->2;mu=-I/2*(4*e1 - e2);
sig=Sqrt[2*e1 - e2];1/(E^((-mu + x)^2/(2*sig^2))*Sqrt[2*Pi]*sig)];
myIFT[E^expo_,s_,x_]/;
Not[Exponent[expo,s]==2 &&Length[CoefficientList[expo,s]]==3]:=
InverseFourierTransform[E^expo,s,x];
myIFT[express_,s_,x_]:=InverseFourierTransform[express,s,x];
conv=myIFT[trans1 trans2,s,x]
Out[1]:=1/(5*E^((-15 + x)^2/50)*Sqrt[2*Pi])
In[2]:=Plot[conv,{x,0,30}]
"Mortimer, Martin" wrote:
> Dear all:
>
> I am a new user of Mathematica and very much still on the learning
> curve, so
> I would be extremely grateful for some help.
>
> The background
> -----------------------
> I need to do convolution integrals of various combinations of Gaussian
> (Normal), Rectangular and Lognormal functions, sometimes in pairs,
> sometimes in threesomes and maybe more. It seems to me that the easiest
> way
> to do this is through the inverse fourier transform of the product of
> the
> fourier transforms of the functions.
>
> The problem
> -----------------
>
> Here is a simple example of the code in the approach I have used so
> far.
>
> In[1]:= <<Statistics`ContinuousDistributions`
>
> In[2}:= <<Calculus`FourierTransform`
>
> In[3]:= dist1=NormalDistribution[10,3]
>
> Out[3]= NormalDistribution[10, 3]
>
> In[4]:= pdf1=PDF[dist1,x]
>
> Out[4]=
>
> 1
>
> ---------------------------
>
> 2
>
> (-10 + x) /18
>
> 3 E Sqrt[2 Pi]
>
> In[5]:= Plot[%,{x,0,20}]
>
> -Graphics-
>
> In[6]:= dist2=NormalDistribution[5,4]
>
> Out[6] = NormalDistribution[5, 4]
>
> In[7]:= pdf2=PDF[dist2,x]
>
> Out[7] =
>
> 1
>
> --------------------------
>
> 2
>
> (-5 + x) /32
>
> 4 E Sqrt[2 Pi]
>
> In[8]:= trans1=FourierTransform[pdf1,x,s]
>
> Out[8] =
>
> 2
>
> 10 I s - (9 s )/2
>
> E
>
> In[9]:= trans2=FourierTransform[pdf2,x,s]
>
> Out[9] =
>
> 2
>
> 5 I s - 8 s
>
> E
>
> In[10]:= conv=InverseFourierTransform[trans1 trans2]
>
> Out[10] =
>
> 2
>
> 15 I s - (25 s )/2
>
> InverseFourierTransform[E ]
>
> Question :
>
> I seem to be able to get to the inverse transform alright but how do I
> plot
> the final distribution ?
> I would be very grateful for some clear code on how to do this that I
> can
> comprehend.
>
> I have looked in the archives and whilst there has been some discussion
> on
> this topic, I still cannot workout a way forward.
>
> For the curious, my work is concerned with the prediction of weed
> occurrence
> in rice fields and we are trying to develop a model that can predict
> the
> likelyhood of weed germination, establishment and ultimately yield
> loss.
>
> Thanking you in advance
>
> Martin Mortimer
> _____________________________________________________________________
>
> Dr Martin Mortimer
> Weed
> Ecologist
> International Rice Research Institute,
> P. O. Box 3127
> Makati Central Post Office(MCPO)
> 1271 Makati City
> Philippines
> Telephone: (63) 2 845 0563 / 0569
> ext : - office 771 / 221 ; - home 249
> E-mail: M.MORTIMER at CGIAR.ORG
> Fax: (63) 2 891 1292 or (63) 2 845 0606
> Personal E-mail in UK: Greywing at compuserve.com
> "IRRI is one of 16 centers supported by the Consultative Group on
> International Agricultural Research (CGIAR). http://www.cgiar.org/irri
> <http://www.cgiar.org/irri> ."
> _____________________________________________________________________