This might have been asked before but I couldn't find the answer. I want to perform an indefinite integral. I tried it both on Mathematica and Maple and the commutation time is significantly different. It takes roughly 45 seconds on Mathematica while it's instantaneous with Maple. Could someone give an answer to why this is and how to speed up the computation on Mathematica? Here is the integral:
Integrate[-(1/((1/2 + x) (1.`15.048133091869577 - 0.7271265201866038` x -
0.14586605445765533` x^2 - 0.14353734279040942` x^3 -
0.34371764036609265` x^4 + 0.04221841339432375` x^5 -
6.584428946770302` x^6))), x] // Timing
Now I tried to speed it up by using Apart and Distribute like this
-(1/((1/2 + x) (1.`15.048133091869577 - 0.7271265201866038` x -
0.14586605445765533` x^2 - 0.14353734279040942` x^3 -
0.34371764036609265` x^4 + 0.04221841339432375` x^5 -
6.584428946770302` x^6)));
Apart[%];
Distribute[Integrate[%, x]] // Timing
But this I had to stop because it was giving me anything after several minutes. The workaround is to Distribute "integrate" and then replace it with Integrate.
-(1/((1/2 + x) (1.`15.048133091869577 - 0.7271265201866038` x -
0.14586605445765533` x^2 - 0.14353734279040942` x^3 -
0.34371764036609265` x^4 + 0.04221841339432375` x^5 -
6.584428946770302` x^6)));
Apart[%];
Distribute[integrate[%, x]];
%/. integrate -> Integrate // Timing
And in this case, the computation only takes 0.04 seconds.
Note that all 3 approaches worked just fine on Maple and gave result as soon as I pressed enter.
Distribute[Integrate[...]]
is not doing what you intend.Map
would get it done quickly. Trye1=...; e2 = Apart[e1];Timing[Map[Integrate[#, x] &, e2]]
. $\endgroup$ – Daniel Lichtblau Feb 2 '18 at 18:06