MathGroup Archive 2005

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

Search the Archive

NIntegrate::inum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59099] NIntegrate::inum
  • From: wtplasar at lg.ehu.es
  • Date: Thu, 28 Jul 2005 02:28:26 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I have to minimize a function which is defined through a numerical 
integral. I get the "NIntegrate::inum .." error message. I know I can 
switch it off, but I wonder if there is a more elegant way to deal 
with the problem. 

These my input and output lines:
In[1]:=
Do[z[i] = i, {i, 1, 50}]
Do[mi[i] = i^2, {i, 1, 50}]
Do[smi[i] = i^3, {i, 1, 50}]

In[4]:=
f[x_, om_, w_] := 1/Sqrt[om (1 + x)^3 + (1 - om)(1 + x)^(3*(1 + w))];
rr[zz_?NumberQ, om_, w_] := NIntegrate[f[x, om, w], {x, 0, zz}];
ff[zz_?NumberQ, om_, w_] := 5*Log[10, rr[zz, om, w]*(1 + zz)];
Nn = 50;

In[8]:=
ci = Sum[1/smi[i]^2, {i, 1, 50}];

In[9]:=
chi2f2[om_, w_] := Sum[(mi[i] - ff[z[i], om, w])^2/smi[i]^2, {i, 1, 
Nn}] - 
(Sum[(mi[i] - ff[z[i], om, w])/smi[i]^2, {i, 1, Nn}])^2/ci

In[10]:=
Timing[NMinimize[{chi2f2[om, w], 0 ¡Ü om ¡Ü 1}, {om, w}]]

NIntegrate::inum: Integrand ..... is not numerical at {x} = {0.5}

Out[10]=
{38.966 Second, {0.26337, {om -> 0.999998, w -> 0.0738109}}}


Thanks in advance,

Ruth Lazkoz


  • Prev by Date: Re: LegendreP in Mathematica 5.2 --system dump error
  • Next by Date: Colorfunction along a line...
  • Previous by thread: Re: PlotLegend & Tick marks in MultipleListPlot
  • Next by thread: Re: NIntegrate::inum