Re: Message: "Numerical interation converging too slowly"
- To: mathgroup at smc.vnet.net
- Subject: [mg83263] Re: Message: "Numerical interation converging too slowly"
- From: "Hoa Bui" <hoabui05 at gmail.com>
- Date: Fri, 16 Nov 2007 05:33:17 -0500 (EST)
- References: <fhh7h5$8p4$1@smc.vnet.net> <473C8ACF.80000@gmail.com>
Thanks, Jean-Marc! Yes, I am using Mathematica 5.2 and I did get the same graph except that it goes along with the message previously mentioned. Also, check this out: It is okay to integrate from the first to the last point: In[89]:=NIntegrate[linN[s],{s,lstã??1,1ã??,lstã??4,1ã??}] Out[89]=0.00978246 But if I do the same with a different set of points: lst2 = {{0, 0}, {0.005117241776887967`, 0.12109827984374989`}, \ {0.015699480276911173`, 0.159661398624297`}, {0.04816533822543266`, \ 0.2770434111412446`}} In[91]:=lin=Interpolation[lst2,InterpolationOrder\[Rule]1]; In[92]:=NIntegrate[lin[s],{s,lst2ã??1,1ã??,lst2ã??4,1ã??}] I get another weird message: "NIntegrate::ncvb : NIntegrate failed to converge to prescribed accuracy after 7 recursive bisections in s near s = 0.005079938015963601`. More... " Out[92]=0.00888437 I have no idea what's going on here! Please help! Thanks, HB On 11/15/07, Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com> wrote: > Hoa Bui wrote: > > Hi all, > > > > Please help! > > > > I have a list of points: > > lst={{0,0.0673209172484956`},{0.003449278068524249`,0.10109827933089396`},{\ > > 0.014031516572727063`,0.19966139796005267`},{0.04649737451028208`,0.\ > > 2870434103185859`}} > > > > I then define a function NN[x] that returns the linearly interpolated > > value at x: > > linN = Interpolation[lst, InterpolationOrder -> 1]; > > NN[x_?NumberQ]:=linN[x]; > > > > In[17]:=NN[0] > > Out[17]=0.0673209 > > > > In[18]:=NIntegrate[NN[s],{s,0,0.45}] > > Out[18]=0.344713 > > > > However, if I want to make the integral a function of the upper limit, > > and plot it: > > Plot[NIntegrate[NN[s],{s,0,z}],{z,0,0.045}], > > I get this message: > > "NIntegrate::slwcon: Numerical integration converging too slowly; suspect one \ > > of the following: singularity, value of the integration being 0, oscillatory \ > > integrand, or insufficient WorkingPrecision. If your integrand is oscillatory \ > > try using the option Method->Oscillatory in NIntegrate." > > > > Maybe there's nothing wrong with the result, but I'm not sure. And the > > message is annoying, too. > > Does anyone know how to make Mathematica do the work without complaining? > > > > I appreciate it. > > HB > > > > Hum, the posted code works fine (i.e. no warning nor error messages are > issued) with Mathematica 6.0.1. I have uploaded the following pdf on my > web site so you can check the graph produced by your version against > version 6: > > http://homepages.nyu.edu/~jmg336/mathematica/HoaBuiIntegration.pdf > > (Sorry, I am away from my machine with version 5.2 installed, so I > cannot investigate further.) > > Regards, > -- > Jean-Marc >