Numerical Convolution
- To: mathgroup at smc.vnet.net
- Subject: [mg116772] Numerical Convolution
- From: "Dan O'Brien" <obrie425 at umn.edu>
- Date: Sun, 27 Feb 2011 04:34:20 -0500 (EST)
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