Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a notebook in Mathematica 4. I'm trying to convert it to use in Mathematica 9. One of the problem is the long computation of definite integral in the new version of Mathematica.

Here's the example:

enter image description here

I understand that the new Mathematica produces more accurate answer, but even NIntegrate loses in speed of calculations. Is there any simple solution to make the integration work faster?

share|improve this question
I don't know why it's slower, but if this is a calculation you perform more than once, you may benefit by storing the results (i.e., use b[i_]:=b[i]=integral). –  David Skulsky Nov 22 '13 at 18:55

2 Answers 2

Compute the indefinite integral instead.

b[i_] := b[i] = Integrate[(Sin[x] - 1) x^i, x]
Timing@N[Sum[(b@i /. x -> 5) - (b@i /. x -> -5), {i, 30}], 8]
{0.359375, -3.7741840*10^20}
share|improve this answer
up vote 5 down vote accepted

I found a good solution. The new version of Mathematica is using the symbolic processing, so we can just turn it off.

b[i_] := NIntegrate[(Sin[x] - 1) x^i, {x,-5,5}, Method->{Automatic,"SymbolicProcessing"->0}]

source: Techniques for Accelerating NIntegrate Evaluations http://support.wolfram.com/kb/3442

share|improve this answer
Please add concrete version info, otherwise this will be ambiguous, especially in a few years time ;-) –  Yves Klett Nov 22 '13 at 20:11
@YvesKlett Mma 10.0 for XBox. 3 billion devices run Mathematica. –  belisarius Nov 23 '13 at 2:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.