# How to clear Integrate internal memory?

I noticed that when I call Integrate for the first time, on an integral that I know will take longer than the time limit I give it, it will abort for the first time, as expected when wrapped by TimeConstrained. But on the third try (not the second!), it will return the antiderivative very quickly within the same time limit.

This tells me that Integrate seems to be loading things or caching things each time it is called?

Is it possible to somehow start each call of Integrate fresh, as the first call, but without restarting the kernel? Here is an MWE. Run the following from a fresh kernel:

res = AbsoluteTiming[ TimeConstrained[Integrate[
(Sqrt[1 - x]*x*(1 + x)^(2/3))/(-((1 - x)^(5/6)*(1 + x)^(1/3)) +
(1 - x)^(2/3)*Sqrt[1 + x]), x], 500 $TimeUnit]]  Here is a screen shot An interesting thing is that I needed 3 calls to get an answer. You might have to adjust the multiplier on $TimeUnits on your PC. For me, 500 seems to work just right for this illustration.

Using 11.1 on Windows 7, 64 bit.

I am trying to get predictable results each time, and would like the next integral calls not to be affected by the previous integral calls made in terms of timing.

• Have you tried ClearSystemCache["Symbolic"]? – J. M. is away Mar 30 '17 at 5:10
In general, whenever you suspect that Mathematica's internal caching is affecting your results, it is a good idea to run ClearSystemCache[] first. If more specificity is necessary, one can try ClearSystemCache["Numeric"] for numeric computations, or ClearSystemCache["Symbolic"] for symbolic computations.
For more control of how caching is done for various objects, you can look at SystemOptions["CacheOptions"]. In particular, you can set SetSystemOptions["CacheOptions" -> {"Symbolic" -> {"Cache" -> False}}] if you want no caching of symbolic results during your entire session.