       Re: Message: "Numerical interation converging too slowly"

• To: mathgroup at smc.vnet.net
• Subject: [mg83305] Re: Message: "Numerical interation converging too slowly"
• From: mcmcclur at unca.edu
• Date: Sat, 17 Nov 2007 05:20:00 -0500 (EST)
• References: <fhh7h5\$8p4\$1@smc.vnet.net>

```On Nov 15, 5:37 am, "Hoa Bui" <hoabu... at gmail.com> wrote:
> I have a list of points:
> lst={...}
> 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];
>
> 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: ..."

If you're willing to settle for a little less accuracy,
you can make the complaint go away by setting
AccuracyGoal a little lower:
Plot[NIntegrate[NN[s], {s, 0, z},
AccuracyGoal -> 7], {z, 0, 0.045}]

Of course, the function has points of non-differentiabity,
since InterpolationOrder is set to 1, and this is why the
problem arises.  If you are simply trying to integrate
piecewise linear funcitons, then it might be best to use
a simpler representation than InterpolatingFunctions.

Consider the following example:
Clear[f];
f[x_?NumericQ] := Piecewise[{
{2x, x =98 Pi}, {4Pi - 2x, x > Pi}}];
NIntegrate[f[x], {x, 0, 6}]

This will return the same error as your example.  Since
the function is defined using Piecewise, however, we
can remove the ?NumericQ and the error goes away,
presumably because NIntegrate can do some symbolic
pre-processing.

Mark

```

• Prev by Date: Re: memory release problem in mathematica6.0
• Next by Date: Re: Mathematica, Graph Theory
• Previous by thread: Re: Message: "Numerical interation converging too slowly"
• Next by thread: Re: Re: Message: "Numerical interation converging too slowly"