Mathematica 9 is now available
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

NIntegrate::inum continued

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59119] NIntegrate::inum continued
  • From: wtplasar at lg.ehu.es
  • Date: Fri, 29 Jul 2005 00:42:01 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I have these code which is a modification on a code which was improved 
by one of the mathgroup members (see the original message below). When 
I evaluate it a get a Recursion Limit problem. Can you help me?


In[1]:=
datanw={{0.04`,36.38`,0.19`},{0.05`,36.84`,0.21`},
{0.0307`,35.9`,0.2`}};

In[2]:=
ndat=3;

In[3]:=
Nn = ndat;

In[4]:=
z =datanw[[#1,1]]  & ; mi = datanw[[#1,2]] & ;
 smi =datanw[[#1,3]] & ; SetAttributes[smi, Listable]; f[
    x_, om_, w_] := 1/Sqrt[om*(1 + x)^3 + (
1 - om)*(1 + x)^(3*(1 + w))]; rr[1, om_, w_] := rr[1, om, w] = 
      NIntegrate[f[x, om, w], {x, 0, 1}]; 
      rr[zz_, om_, w_] := rr[zz, om, w] = NIntegrate[f[x,
                 om, w], {x, zz - 
                  1, zz}] + rr[zz - 1, om, w]; ff[zz_, om_, w_] := 
5*Log[
      10, rr[zz, om, 
    w]*(1 + zz)]; ci = Sum[1/smi[
      i]^2, {i, 1, Nn}]; chi2f2[(om_)?
          NumericQ, (w_)?NumericQ] := Module[{vec = ((mi[#1] - ff[z
[#1], om, 
      w])/smi[#1] & ) /@ 
        Range[Nn]}, vec . vec - Total[vec/smi[Range[Nn]]]^2/ci]; 



---------- Mensaje reenviado ----------
Para: mathgroup at smc.vnet.net
Asunto: NIntegrate::inum
De: <wtplasar at lg.ehu.es>
Fecha: Thu, 28 Jul 2005 02:35:51 +0200 (CEST)

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: Simplification question
  • Next by Date: "Gilmar's Postulate"
  • Previous by thread: Re: Add terms surrounded by zero together in matrix
  • Next by thread: Re: NIntegrate::inum continued