MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Numerical Integrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73005] Re: Numerical Integrate
  • From: "Robert Dodier" <robert.dodier at gmail.com>
  • Date: Sun, 28 Jan 2007 01:27:57 -0500 (EST)
  • References: <ep7bsu$b7s$1@smc.vnet.net>

On Jan 24, 3:20 am, Bob Hanlon <hanl... at cox.net> wrote:

> 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}];

This isn't correct -- the integration needs to be over (-inf, +inf).
The above definition of convolution is OK in some contexts
but not here -- essentially we need to marginalize over the
the first variable, so the integration is over the support of f1
(namely -inf to +inf).

> NIntegrate[convolve[f1,f2,t],{t,-Infinity,0}]//Re
>
> 0.5

This is also incorrect -- the convolution yields the sum of
normal and lognormal variables, which has a skewed density
since the lognormal is skewed (and the normal is symmetric).
So the mass to the left of 0 is something less than 1/2.

A simpler way to solve this particular problem is to see that
Pr(X + Y < 0) is equal to Pr(Y > X) where X is the lognormal
variable and Y is the normal. (Note Y and -Y have the same
density.) Furthermore Pr(Y > X) = integral(Pr(Y > a) Pr(X = a), a).
For Pr(Y > a) there is an exact result in terms of the Gaussian
error function, so we only have to compute one numerical
integration, not two -- this is a big win. I get Pr(Y > X) = 0.1759
(approximately).

Hope this helps,
Robert Dodier


  • Prev by Date: Movie clips to Mathematica
  • Next by Date: Re: Plotting
  • Previous by thread: Re: Numerical Integrate
  • Next by thread: Finding bounds of the domain of a Piecewise function