MathGroup Archive 2011

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

Search the Archive

Re: Numerical Convolution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116788] Re: Numerical Convolution
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Mon, 28 Feb 2011 05:00:05 -0500 (EST)

----- Original Message -----
> From: "Dan O'Brien" <obrie425 at umn.edu>
> To: mathgroup at smc.vnet.net
> Sent: Sunday, February 27, 2011 3:34:20 AM
> Subject: [mg116772] Numerical Convolution
> I'm attempting to write a function that can be used as the expression
> in
> NonlinearModelFit. In general, the function is a convolution of a
> gaussian and any arbitrary function. Here I have defined it using the
> complex functions \[Chi]R
> 
> \[Chi]R[f_, a_, \[CapitalGamma]_, \[Omega]v_, \[Omega]_] :=
> f (Sqrt[Abs[a]] Abs[\[CapitalGamma]])/(-(\[Omega] - \[Omega]v) -
> I Abs[\[CapitalGamma]])
> 
> F[f1_, A1_, \[CapitalGamma]1_, \[Omega]v1_, f2_,
> A2_, \[CapitalGamma]2_, \[Omega]v2_, \[Omega]_] :=
> Abs[\[Chi]R[f1,
> A1, \[CapitalGamma]1, \[Omega]v1, \[Omega]] + \[Chi]R[f2,
> A2, \[CapitalGamma]2, \[Omega]v2, \[Omega]]]^2
> 
> (*Cannot evaluate this integral*)
> conv[f1_, A1_, \[CapitalGamma]1_, \[Omega]v1_, f2_,
> A2_, \[CapitalGamma]2_, \[Omega]v2_, \[Omega]_] :=
> Convolve[PDF[NormalDistribution[0, 3], x],
> F[f1, A1, \[CapitalGamma]1, \[Omega]v1, f2,
> A2, \[CapitalGamma]2, \[Omega]v2, x], x, \[Omega]]
> 
> conv[1, 20, 5, 1702, -1, 10, 3, 1692, \[Omega]](*I stop it after a \
> few minutes on my machine,windows xp sp3 Mathematica 8.0*)
> 
> (*So my thought was to try to set up a numerical convolution in the \
> vicinity of my domain of interest.*)
> 
> Nconv[f1_, A1_, \[CapitalGamma]1_, \[Omega]v1_, f2_,
> A2_, \[CapitalGamma]2_, \[Omega]v2_] :=
> Interpolation[
> ParallelTable[{i,
> NIntegrate[
> PDF[NormalDistribution[0, 3], x] F[f1,
> A1, \[CapitalGamma]1, \[Omega]v1, f2,
> A2, \[CapitalGamma]2, \[Omega]v2,
> i - x], {x, -\[Infinity], \[Infinity]}]}, {i, 1620, 1740}]]
> 
> (*So the interpolation function would be used to fit my data in \
> NonlinearModelFit.But this doesn't work to use as the model \
> expression and I'm not sure where to begin to make it work.Even to \
> plot it,it must be evaluated first and then used*)
> 
> g = Nconv[1, 20, 5, 1702, -1, 10, 3, 1692]
> 
> Plot[{g[\[Omega]],
> F[1, 20, 5, 1702, -1, 10, 3, 1692, \[Omega]]}, {\[Omega], 1620,
> 1740}, PlotRange -> All]
> 
> Is there a better way to do this? Any help is very much appreciated.
> 
> -Dan

This might be along the lines of what you want.

conv[f1_, A1_, \[CapitalGamma]1_, \[Omega]v1_, f2_,
  A2_, \[CapitalGamma]2_, \[Omega]v2_, \[Omega]_?NumericQ] :=
 Re[NIntegrate[
   PDF[NormalDistribution[0, 3], x]*
    F[f1, A1, \[CapitalGamma]1, \[Omega]v1, f2,
     A2, \[CapitalGamma]2, \[Omega]v2, \[Omega] - x], {x, -Infinity,
    Infinity}]]

Nconv[f1_, A1_, \[CapitalGamma]1_, \[Omega]v1_, f2_,
  A2_, \[CapitalGamma]2_, \[Omega]v2_] := Interpolation[
  Table[conv[f1, A1, \[CapitalGamma]1, \[Omega]v1, f2,
    A2, \[CapitalGamma]2, \[Omega]v2, i], {i, 1620, 1740}],
  {i, 1620, 1740}]

In[43]:= Timing[g = Nconv[1, 20, 5, 1702, -1, 10, 3, 1692];]

Out[43]= {3.042000000000002, Null}

Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Vector Runge-Kutta ODE solver with compilation?
  • Next by Date: Re: Vector Runge-Kutta ODE solver with compilation?
  • Previous by thread: Numerical Convolution
  • Next by thread: Re: Numerical Convolution