Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: NInegrate Bug

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116540] Re: NInegrate Bug
  • From: Andrew Moylan <amoylan at wolfram.com>
  • Date: Sat, 19 Feb 2011 05:12:03 -0500 (EST)

Hi Kurt, There isn't any simple criterion that can be used in that way. That type of workaround might also cause you trouble later, if you ran the same code on a version of Mathematica without the behavior you are compensating for.

There are some options: You can disable the offending method with the setting Method -> {"SymbolicPreprocessing", "OscillatorySelection" -> False}. Or, you could use this change of variable to make the integration range positive: Integrate[f[x], {x, a, b}] = Integrate[f[-x], {x, -b, -a}]. For integration ranges spanning x = 0, split the integral there and transform the negative half.


----- Original Message -----
From: "Kurt TeKolste" <tekolste at fastmail.net>
To: mathgroup at smc.vnet.net
Sent: Thursday, February 17, 2011 9:20:14 PM
Subject: [mg116540] [mg116507] Re: NInegrate Bug

Are the conditions under which the incorrect answer is returned known so
that a practitioner can implement a workaround of the form

fixedNintegrate[function_,bounds_]:=
  If[ conditions[function],
  NIntegrate[function[t]*Sign[t],bounds],NIntegrate[function[t],bounds]]

and be confident that one's analysis is not scrogged?

Kurt TeKolste

On Wed, 16 Feb 2011 04:36 -0500, "Andrew Moylan" <amoylan at wolfram.com>
wrote:
> No, sorry. The fix is not available as a patch for version 7.
> 
> Andrew Moylan
> Wolfram Research
> 
> 
> 
> ----- Original Message -----
> From: "Kurt TeKolste" <tekolste at fastmail.net>
> To: "Andrew Moylan" <amoylan at wolfram.com>, "Mathgroup"
> <mathgroup at smc.vnet.net>
> Sent: Tuesday, February 15, 2011 11:47:43 PM
> Subject: [mg116466] Re: [mg116439] NInegrate Bug
> 
> Comforting, but expensive.  Do you have a patch for 7?
> 
> On Tue, 15 Feb 2011 23:17 +1100, "Andrew Moylan" <amoylan at wolfram.com>
> wrote:
> > Hi Kurt,
> > 
> > You should not encounter any problem in Mathematica 8. E.g.
> > 
> > In[1]:= NIntegrate[Sin[x^2], {x, -5, -2}]
> > 
> > Out[1]= -0.276859
> > 
> > In[2]:= N[Integrate[Sin[x^2], {x, -5, -2}]]
> > 
> > Out[2]= -0.276859
> > 
> > Andrew Moylan
> > Wolfram Research
> > 
> > 
> > 
> > On Feb 15, 2011, at 10:34 PM, Kurt TeKolste wrote:
> > 
> > > Has there been a resolution of the NIntegrate bug?
> > > 
> > > Apparently NIntegrate produces the negative of the right answer for
> > > integrations that start and end to the left of zero -- some of the time.
> > > (Cos[x] and Sin[x^2] get the wrong result, Sin[x] is good).
> > > 
> > > Since it is not clear what criterion Mathematica uses in deciding to
> > > give the wrong answer it is not clear when to use NIntegrate[] and when
> > > to use NIntegrate[*Sign[independent variable]].
> > > 
> > > And this calls into question any results for analysis that uses
> > > NIntegrate -- not a happy situation.
> > > 
> > > Kurt TeKolste
> > > 
> > 
> > 
> 
> 



  • Prev by Date: Re: Another point about Mathematica 8.0
  • Next by Date: Re: k-permutations enumeration
  • Previous by thread: Re: NInegrate Bug
  • Next by thread: Re: NInegrate Bug