Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Simplified Integration Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35591] Re: Simplified Integration Problem
  • From: "Carl K. Woll" <carlw at u.washington.edu>
  • Date: Sun, 21 Jul 2002 01:01:10 -0400 (EDT)
  • Organization: University of Washington
  • Sender: owner-wri-mathgroup at wolfram.com

Arnold,

The explanation for the difference in results when using Integrate versus
NIntegrate lies in how the answers are computed.

The function NIntegrate typically samples the integrand at a sufficient
number of points to approximate the answer, using a strategy similar to but
more sophisticated than the trapezoidal approximation. In general,
NIntegrate will always get the correct answer, although it is possible that
the answer produced by NIntegrate may not be very precise.

The function Integrate, on the other hand, basically does what you or I
would do. It tries to find the antiderivative of the integrand, and then, if
there are limits involved, those limits are plugged into the antiderivative.
Usually, this procedure works perfectly well, and the correct answer is
produced. However, consider the case where the antiderivative has multiple
branches. Then, Integrate must use the same branch when plugging in the
limits into the integrand in order to produce the correct answer. Sometimes,
Integrate will choose one branch for the upper limit, and a different branch
for the lower limit. When this happens, Integrate will get the wrong answer.

The message you should get from the above discussion is that whenever you
want to compute a DEFINITE integral using Integrate, you should be aware
that the resulting answer may be incorrect if the antiderivative of the
integrand has multiple branches. On the other hand, for definite integrals,
NIntegrate should always produce the correct answer. In other words, any
time you are trying to compute a definite integral with Integrate, and the
integrand looks complex, you probably should verify the answer using
NIntegrate.

Carl Woll
Physics Dept
U of Washington

"Arnold Gregory Civ AFRL/SNAT" <Gregory.Arnold at wpafb.af.mil> wrote in
message news:ah8p7q$avj$1 at smc.vnet.net...
> Here's a slightly simplified version of the integration problem I
presented the other day:
>
> int=Integrate[UnitStep[1 - t^2 - c^2*(-4*t + 8*t^3)^2], {t, -1, 1}];
> int /. c->0    Result:2
> int /. c->0.   Result:0.
> int /. c->3    Result:2
> int /. c->3.   Result:0.28817
>
> In fact, "int /. c-> any rational" always yields 2!!!
>
> NIntegrate gets the right answers:
> NIntegrate[UnitStep[1 - t^2 - 0^2*(-4*t + 8*t^3)^2], {t, -1, 1},
> MinRecursion->5,MaxRecursion->30]      Result: 2
>
> NIntegrate[UnitStep[1 - t^2 - 2^2*(-4*t + 8*t^3)^2], {t, -1, 1},
> MinRecursion->5,MaxRecursion->30]      Result: 0.28817
>
> Plot[int,{c,-5,5}]  also gets the right results.
>
> Any help or insight into why Integrate isn't working would be greatly
appreciated!
>
> Greg
>
>
>




  • Prev by Date: RE: data structure for sets
  • Next by Date: Beep P.S.
  • Previous by thread: Simplified Integration Problem
  • Next by thread: Comparison of Mathematica on Various Computers