Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Why this function does not return a single value

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60175] Why this function does not return a single value
  • From: Marek Bromberek <marek at chopin.physics.mun.ca>
  • Date: Mon, 5 Sep 2005 22:27:30 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello All
I was wondering if somebody could tell me what am I doing wrong here.
I am constructing a function (for fitting purposes) which is a sum of 15
Voigt functions + one Gaussian peak and and exponential background. However
when I want to check if that function works and try to evaluate it it does
not return a value.
Here is the code:

VoigtSum[(x_)?NumericQ, (a[1]*_)?NumericQ, (a[2]*_)?NumericQ,
(a[3]*_)?NumericQ, (a[4]*_)?NumericQ, 
   (a[5]*_)?NumericQ, (a[6]*_)?NumericQ, (a[7]*_)?NumericQ,
(a[8]*_)?NumericQ, (a[9]*_)?NumericQ, 
   (a[10]*_)?NumericQ, (a[11]*_)?NumericQ, (a[12]*_)?NumericQ,
(a[13]*_)?NumericQ, 
   (a[14]*_)?NumericQ, (a[15]*_)?NumericQ, (a[16]*_)?NumericQ,
(a[17]*_)?NumericQ, (b[1]*_)?NumericQ, 
   (b[2]*_)?NumericQ, (b[3]*_)?NumericQ, (b[4]*_)?NumericQ,
(b[5]*_)?NumericQ, (b[6]*_)?NumericQ, 
   (b[7]*_)?NumericQ, (b[8]*_)?NumericQ, (b[9]*_)?NumericQ,
(b[10]*_)?NumericQ, (b[11]*_)?NumericQ, 
   (b[12]*_)?NumericQ, (b[13]*_)?NumericQ, (b[14]*_)?NumericQ,
(b[15]*_)?NumericQ, 
   (b[16]*_)?NumericQ, (b[17]*_)?NumericQ, (\[Delta]L[1]*_)?NumericQ,
(\[Delta]L[2]*_)?NumericQ, 
   (\[Delta]L[3]*_)?NumericQ, (\[Delta]L[4]*_)?NumericQ,
(\[Delta]L[5]*_)?NumericQ, (\[Delta]L[6]*_)?NumericQ, 
   (\[Delta]L[7]*_)?NumericQ, (\[Delta]L[8]*_)?NumericQ,
(\[Delta]L[9]*_)?NumericQ, (\[Delta]L[10]*_)?NumericQ, 
   (\[Delta]L[11]*_)?NumericQ, (\[Delta]L[12]*_)?NumericQ,
(\[Delta]L[13]*_)?NumericQ, (\[Delta]L[14]*_)?NumericQ, 
   (\[Delta]L[15]*_)?NumericQ, (\[Delta]G[1]*_)?NumericQ,
(\[Delta]G[2]*_)?NumericQ, (\[Delta]G[3]*_)?NumericQ, 
   (\[Delta]G[4]*_)?NumericQ, (\[Delta]G[5]*_)?NumericQ,
(\[Delta]G[6]*_)?NumericQ, (\[Delta]G[7]*_)?NumericQ, 
   (\[Delta]G[8]*_)?NumericQ, (\[Delta]G[9]*_)?NumericQ,
(\[Delta]G[10]*_)?NumericQ, (\[Delta]G[11]*_)?NumericQ, 
   (\[Delta]G[12]*_)?NumericQ, (\[Delta]G[13]*_)?NumericQ,
(\[Delta]G[14]*_)?NumericQ, (\[Delta]G[15]*_)?NumericQ, 
   (\[Delta]G[16]*_)?NumericQ] :=
Sum[a[i]*((2.*Log[2.]*\[Delta]L[i])/(N[Pi^(3/2)]*\[Delta]G[i]))*
     NIntegrate[Exp[-t^2]/((Sqrt[Log[2.]]*(\[Delta]L[i]/\[Delta]G[i]))^2 + 
        (Sqrt[4.*Log[2.]]*((x - b[i])/\[Delta]G[i]) - t)^2), {t, -Infinity,
Infinity}], {i, 1, 15}] + 
   a[16]*Exp[(-Log[2.])*((x - b[16])^2/\[Delta]G[16]^2)] +
a[17]*Exp[-x/b[17]]

A list of replacement rules for evaluation purposes

LofR = Flatten[{{a[1] -> 2824.}, {a[2] -> 1722.}, {a[3] -> 936.}, {a[4] ->
2361.}, {a[5] -> 3875.}, 
    {a[6] -> 11059.}, {a[7] -> 2057.}, {a[8] -> 3209.}, {a[9] -> 3586.},
{a[10] -> 3792.}, 
    {a[11] -> 6182.}, {a[12] -> 1993.}, {a[13] -> 1615.}, {a[14] -> 737.},
{a[15] -> 3114.}, 
    {a[16] -> 4680.}, {a[17] -> 6569.}, {b[1] -> 5.49}, {b[2] -> 9.87},
{b[3] -> 11.17}, 
    {b[4] -> 13.91}, {b[5] -> 14.83}, {b[6] -> 16.92}, {b[7] -> 17.91},
{b[8] -> 19.44}, 
    {b[9] -> 21.91}, {b[10] -> 22.8}, {b[11] -> 23.9}, {b[12] -> 26.},
{b[13] -> 29.75}, 
    {b[14] -> 30.97}, {b[15] -> 33.99}, {b[16] -> 28.4}, {b[17] -> 2.57},
{\[Delta]L[1] -> 0.5}, 
    {\[Delta]L[2] -> 0.5}, {\[Delta]L[3] -> 0.5}, {\[Delta]L[4] -> 0.5},
{\[Delta]L[5] -> 0.5}, {\[Delta]L[6] -> 0.5}, 
    {\[Delta]L[7] -> 0.5}, {\[Delta]L[8] -> 0.5}, {\[Delta]L[9] -> 0.5},
{\[Delta]L[10] -> 0.5}, {\[Delta]L[11] -> 0.5}, 
    {\[Delta]L[12] -> 0.5}, {\[Delta]L[13] -> 0.5}, {\[Delta]L[14] -> 0.5},
{\[Delta]L[15] -> 0.5}, {\[Delta]G[1] -> 0.5}, 
    {\[Delta]G[2] -> 0.5}, {\[Delta]G[3] -> 0.5}, {\[Delta]G[4] -> 0.5},
{\[Delta]G[5] -> 0.5}, {\[Delta]G[6] -> 0.5}, 
    {\[Delta]G[7] -> 0.5}, {\[Delta]G[8] -> 0.5}, {\[Delta]G[9] -> 0.5},
{\[Delta]G[10] -> 0.5}, {\[Delta]G[11] -> 0.5}, 
    {\[Delta]G[12] -> 0.5}, {\[Delta]G[13] -> 0.5}, {\[Delta]G[14] -> 0.5},
{\[Delta]G[15] -> 0.5}, {\[Delta]G[16] -> 0.5}}]

And the command which does the evaluation (I think)

VoigtSum[10., a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10],
a[11], a[12], a[13], 
   a[14], a[15], a[16], a[17], b[1], b[2], b[3], b[4], b[5], b[6], b[7],
b[8], b[9], b[10], b[11], 
   b[12], b[13], b[14], b[15], b[16], b[17], \[Delta]L[1], \[Delta]L[2],
\[Delta]L[3], \[Delta]L[4], \[Delta]L[5], \[Delta]L[6], 
   \[Delta]L[7], \[Delta]L[8], \[Delta]L[9], \[Delta]L[10], \[Delta]L[11],
\[Delta]L[12], \[Delta]L[13], \[Delta]L[14], \[Delta]L[15], \[Delta]G[1], 
   \[Delta]G[2], \[Delta]G[3], \[Delta]G[4], \[Delta]G[5], \[Delta]G[6],
\[Delta]G[7], \[Delta]G[8], \[Delta]G[9], \[Delta]G[10], \[Delta]G[11], 
   \[Delta]G[12], \[Delta]G[13], \[Delta]G[14], \[Delta]G[15],
\[Delta]G[16]] /. LofR

Your help is greatly appreciated

Marek


  • Prev by Date: Re: Re: hints to speed up numerical integration?
  • Next by Date: coding problem
  • Previous by thread: Re: Latex & Mathematica
  • Next by thread: Re: Why this function does not return a single value