MATLAB: Does calculating a symbolic integral take much longer in MATLAB 7.9 (R2009b) than in MATLAB 7.6 (R2008a)

molassespokeyslowslowerSymbolic Math Toolbox

Some symbolic integrals seem to take much longer to compute in MATLAB 7.9 (R2009b) than in MATLAB 7.6 (R2008a). For example, the following code takes at least 10 times longer to execute in MATLAB 7.9 (R2009b) as compared to MATLAB 7.6 (R2008a)
syms x x0 x1 x2 x3 f0 f1 f2 f3 h
y= ((x-x1)*(x-x2)*(x-x3))/((x0-x1)*(x0-x2)*(x0-x3))*f0...
+((x-x0)*(x-x2)*(x-x3))/((x1-x0)*(x1-x2)*(x1-x3))*f1...
+((x-x0)*(x-x1)*(x-x3))/((x2-x0)*(x2-x1)*(x2-x3))*f2...
+((x-x0)*(x-x1)*(x-x2))/((x3-x0)*(x3-x1)*(x3-x2))*f3
I=int(y,x,x0,x3)

Best Answer

This enhancement has been incorporated in Release 2010b (R2010b). For previous product releases, read below for any possible workarounds:
As of MATLAB 7.7 (R2008b), the Symbolic Math Toolbox uses the MuPAD symbolic engine, which is the cause of the performance difference in this case. This issue is most apparent when using the INT function to calculate the definite integrals. Therefore, one potential workaround is to calculate the definite integral from the indefinite integral manually:
I2=int(y,x)
p1 = subs(I2, x, x0)
p2 = subs(I2, x, x3)
I3 = p2-p1