[Date Index]
[Thread Index]
[Author Index]
Re: NIntegrate[Abs] bug in v5.1, not v5.0
*To*: mathgroup at smc.vnet.net
*Subject*: [mg64214] Re: NIntegrate[Abs] bug in v5.1, not v5.0
*From*: Maxim <m.r at inbox.ru>
*Date*: Mon, 6 Feb 2006 02:49:14 -0500 (EST)
*References*: <ds1sk5$g0t$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
On Sat, 4 Feb 2006 09:37:09 +0000 (UTC), Solomon, Joshua
<J.A.Solomon at city.ac.uk> wrote:
> First, I establish that everything works in v5.0.
>
> In[1]:=
>
> f[x_]:=E^-(Sin[.1+x]^2)-E^-(Sin[.1-x]^2)
>
>
> In[2]:=
>
> {$Version,$ReleaseNumber}
>
> Out[2]=
>
> {5.0 for Mac OS X (June 10, 2003),0}
>
>
> In[3]:=
>
> Timing[NIntegrate[-f[x],{x,0,Pi/2},AccuracyGoal->1]]
>
> Out[3]=
>
> {0.001438 Second,0.125515}
>
>
> In[4]:=
>
> Timing[NIntegrate[Abs[f[x]],{x,0,Pi/2},AccuracyGoal->1]]
>
> Out[4]=
>
> {0.0015 Second,0.125515}
>
>
> Now I try again in v5.1.
>
> In[1]:=
>
> f[x_]:=E^-(Sin[.1+x]^2)-E^-(Sin[.1-x]^2)
>
>
> In[2]:=
>
> {$Version,$ReleaseNumber}
>
> Out[2]=
>
> {5.1 for Mac OS X (October 25, 2004),0}
>
> In[3]:=
>
> Timing[NIntegrate[-f[x],{x,0,Pi/2},AccuracyGoal->1]]
>
> Out[3]=
>
> {0.001286 Second,0.125515}
>
>
> In[4]:=
>
> Timing[NIntegrate[Abs[f[x]],{x,0,Pi/2},AccuracyGoal->1]]
>
>
> This produces no output for several minutes. Then the Kernel crashes. Any
> ideas?
>
> j
Mathematica 5.1 has new methods for numerical integration of piecewise
functions. If you want to emulate the behaviour of Mathematica 5.0,
specify the method explicitly:
In[2]:= NIntegrate[Abs[f[x]], {x, 0, Pi/2}, Method -> GaussKronrod]
Out[2]= 0.12551527
This shows that by default NIntegrate calls Reduce:
Trace[
TimeConstrained[NIntegrate[Abs[f[x]], {x, 0, Pi/2}], 1],
Reduce, TraceInternal -> True]
trying to evaluate something similar to
Reduce[Rationalize[f[x]] >= 0 && 0 < x < Pi/2, x, Reals]
but it doesn't finish in 10 minutes. A seemingly harder example works
without a problem:
In[3]:= Reduce[Rationalize[f[x]] >= 0 && 0 < x < Pi/2, x]
Out[3]= False
Apparently a different algorithm is being used in this case.
Maxim Rytin
m.r at inbox.ru
Prev by Date:
**Re: Problem plotting high-order Laguerre polynomials**
Next by Date:
**Using Get in a Module**
Previous by thread:
**Re: NIntegrate[Abs] bug in v5.1, not v5.0**
Next by thread:
** Re: NIntegrate[Abs] bug in v5.1, not v5.0**
| |