Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1992
*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 1992

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

Search the Archive

Re: Problem with evaluating Integral

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Re: Problem with evaluating Integral
  • From: David Withoff <withoff>
  • Date: Mon, 13 Apr 1992 15:44:27 -0500

John Yearwood writes:

> Can anyone tell me why Mathematica v2.0 (for windows or Mac) does not
> make any progress with the following:
> 
> f[x_]:= Sin[x]+Exp[x]
> j[x_]:=Evaluate[Normal[Series[f[x],{x,a,4}]]]
> err[a_]:=Integrate[(f[x] - j[x])^2,{x,-6,2}]
> Evaluate[err[a]]

The expanded integrand here has 233 terms.  For various reasons (cancelling
non-elementary summands, etc.) the internal algorithm handles all of these
terms at once, and ends up manipulating enormous intermediate expressions.  

In this example, however, it is perfectly safe to apply the idea that the
integral of the sum is the sum of the integrals, and give the integration
code a far simpler task:

In[4]:= {time, result} = Timing[
            Map[Integrate[#, {x,-6,2}] &, Expand[(f[x] - j[x])^2] ] ];

In[5]:= time

Out[5]= 175.467 Second

 ... a little less than a second for each integral.

Your timing may vary -- I did this on a SPARC.

Dave Withoff
withoff at wri.com






  • Prev by Date: Re: Upgrades that aren't (old and new bugs).
  • Next by Date: Hilbert's Nullstellensatz
  • Previous by thread: Problem with evaluating Integral
  • Next by thread: Hilbert's Nullstellensatz