MathGroup Archive 2005

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

Search the Archive

Re: Integrate vs Nintegrate for impulsive functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61779] Re: Integrate vs Nintegrate for impulsive functions
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sat, 29 Oct 2005 01:32:47 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 10/28/05 at 3:25 AM, pdesai1 at umbc.edu (Pratik Desai) wrote:

>Bill Rowe wrote:

>>Integrate will first get a symbolic answer then compute the final
>>answer by substituting the end points into the symbolic answer. It is
>>entirely possible this leads to problems even when the orginal
>>function being integrated has reasonable values over the range of
>>integration.

>>So, I would be inclined to accept the answer given by NIntegrate as
>>valid and reject the answer given by Integrate. But I would not
>>consider this to be a bug. Instead, I would chalk this up as one of
>>the issues with doing machine precision computations.

>I tried to increase the precision of my calculation (I hope this my
>understanding of your post is correct ), but to no avail. 

I should have been a bit clearer. My comments regarding machine precision are my best *guess* as to why there is a difference between the values returned by Integrate and NIntegrate. If this is the problem, increasing the precision enough will solve it. But, there is no easy way to determine how much is enough.

Another thing you could check is to see if Integrate returns different answers when you change the precision of the arguements. If there is an issue with machine precision the values should change.

In any case, I would definitely use NIntegrate at any time I wanted a numeric rather than symbolic answer. In general, NIntegrate runs faster with less memory requirements than Integrate. Additionally, it typically has less problems with machine precision. NIntegrate should only have issues with machine precision when the integrand needs higher precision to be evaluated correctly. Since Integrate produces a symbolic answer before evaluating it at the end points, problems with machine precision can occur even though evaluation of the integrand doesn't have significant issues.

Finally, based on other posts here and my experience, whenever there is a disagreement between Integrate and NIntegrate and there are no obvious problems such as discontinuities or singularities, I would take the value return by NIntegrate as being far more likely to be correct. And while I might increase the precision of the arguments as a diagnostic tool, I would not generally use this as a solution to the problem.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: A Problem with the NonlinearFit?
  • Next by Date: Re: A Problem with the NonlinearFit?
  • Previous by thread: Re: Re: Integrate vs Nintegrate for impulsive functions
  • Next by thread: Re: Test for "valid variable"