Re: Numerical convolution
- To: mathgroup at smc.vnet.net
- Subject: [mg116434] Re: Numerical convolution
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Tue, 15 Feb 2011 06:33:56 -0500 (EST)
- Reply-to: hanlonr at cox.net
f1[x_] = PDF[NormalDistribution[0, 1], x];
Prior to version 8 the PDF for LogNormalDistribution was defined as
f2[x_] = 1/(E^((1/2)*Log[x]^2)*(Sqrt[2*Pi]*x));
This required the user to avoid negative arguments (which I did not). However, with version 8 the PDF for one-sided distributions uses Piecewise.
f3[x_] = PDF[LogNormalDistribution[0, 1], x]
Piecewise[{{1/(E^((1/2)*Log[x]^2)*(Sqrt[2*Pi]*x)), x > 0}}, 0]
convolve[f_, g_, t_?NumericQ] := NIntegrate[f[u]*g[t - u], {u, 0, t}];
NIntegrate[convolve[f1, f2, t], {t, -Infinity, 0}] // Re
0.5
NIntegrate[convolve[f1, f3, t], {t, -Infinity, 0}] // Re
NIntegrate::izero: Integral and error estimates are 0 on all integration subregions. Try increasing the value of the MinRecursion option. If value of integral may be 0, specify a finite value for the AccuracyGoal option. >>
0.
NIntegrate[convolve[f1, f2, t], {t, -Infinity, Infinity}] // Re
1.
NIntegrate[convolve[f1, f3, t], {t, -Infinity, Infinity}] // Re
0.5
Without Piecewise in its definition the PDF for LogNormalDistribution acts as if two-sided and gives the different result. Alternatively, the definition of convolve could be changed for one-sided distributions.
convolve2[f_, g_, t_?NumericQ] :=
NIntegrate[f[u]*g[t - u], {u, 0, Max[0, t]}];
NIntegrate[convolve2[f1, f2, t], {t, -Infinity, 0}] // Re
NIntegrate::izero: Integral and error estimates are 0 on all integration subregions. Try increasing the value of the MinRecursion option. If value of integral may be 0, specify a finite value for the AccuracyGoal option. >>
0.
NIntegrate[convolve2[f1, f2, t], {t, -Infinity, Infinity}] // Re
0.5
Bob Hanlon
---- "Rob Y. H. Chai" <yhchai at ucdavis.edu> wrote:
=============
Dear Bob,
I found your suggested solution in MathGroup from 2007 for numerical
integration of a convolution integral. I tried it in Mathematica 8.0 and was
surprised to see that the results are now different from yours earlier.
More specifically
NIntegrate[convolve[f1,f2,t],{t,-Infinity,Infinity}]//Re gives 0.5 as
opposed to 1.0
Any idea what might have happened?
Thanks and sincerely
Rob Chai, UC Davis
==============================================================
Re: Numerical Integrate
* To: mathgroup at smc.vnet.net
* Subject: [mg72883] Re: [mg72864] Numerical Integrate
* From: Bob Hanlon <hanlonr at cox.net>
* Date: Wed, 24 Jan 2007 05:30:04 -0500 (EST)
* Reply-to: hanlonr at cox.net
_____
Needs["Statistics`"];
f1[x_]=PDF[NormalDistribution[0, 1],x];
f2[x_]=PDF[LogNormalDistribution[0, 1],x];
convolve[f_,g_, t_?NumericQ]:=
NIntegrate[f[u]*g[t-u],{u,0,t}];
NIntegrate[convolve[f1,f2,t],{t,-Infinity,0}]//Re
0.5
NIntegrate[convolve[f1,f2,t],{t,-Infinity,Infinity}]//Re
1.
Bob Hanlon
---- "mailcwc at gmail.com" <mailcwc at gmail.com> wrote:
> I need to perform the following integration:
>
> Integrate[ Convolution[G(t), X(t)], {t, -inf, 0}],
>
> where G is Normal distribution, and X is Log-normal distribution.
>
> As I know, there is no analytical form for the convolution.
> I tried NIntegrate to perform numerical calculation, but Mathematica
> can't accept it.
> Does anyone know how to deal such problem?