Polynomials in Symbolic Toolbox: Basic operations extremely slow

3 views (last 30 days)
Basic operations on polynomials seem to be extremely slow in Matlab.
The follow
syms x y
p = 1 + x + y + x*y
tic
for i=1:10000
coeffs(p);
end
toc
tic
for i=1:10000
q=expand(p*p);
end
toc
On my computer it yields:
Elapsed time is 9.021812 seconds.
Elapsed time is 31.494963 seconds.
In a MuPAD notebook (type "mupad" in the command window of Matlab) the same thing takes about a second:
p := 1 + x + y + x*y
for i from 1 to 10000 do coeff(p);monomials(p); end_for
for i from 1 to 10000 do q:=expand(p*p); end_for
On the other hand, it seems like MuPAD will be shut down in future versions of Matlab. Here are my questions:
(1) Doesn't the Matlab symbolic toolbox use the MuPAD symbolic engine to do basic polynomial operations?
(2) Why Matlab symbolic toolbox so much slower than MuPAD?
If MuPAD is shut down, I think will that I will never use Matlab for my purposes again. I use it for trying to solve polynomial optimization problems using semidefinite programs.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!