Why does calculating a symbolic integral take much longer in MATLAB 7.9 (R2009b) than in MATLAB 7.6 (R2008a)?
5 views (last 30 days)
Show older comments
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)
Accepted Answer
MathWorks Support Team
on 22 Oct 2010
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
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!