Error using mupadengin​e/feval_in​ternal Invalid input. Expected ']'. Error in mupadengine/feval

I am using the following program given at sums-of-squares.github.io/sos/:
syms x y s t;
p = s*x^6 + t*y^6 - x^4*y^2 - x^2*y^4 - x^4 + 3*x^2*y^2 - y^4 - x^2 - y^2 + 1
prog = sosprogram([x;y], [s;t]);
prog = sosineq(prog, p); % p is sos
prog = sossolve(prog, options);
sosgetsol(prog, [s,t])
I am getting error at (prog = sosineq(prog, p); % p is sos) this line which is as follows:
Error using mupadengine/feval_internal
Invalid input. Expected ']'.
Error in mupadengine/feval
Error in sosconstr (line 65)
degcheck = feval(symengine,'collect',degcheck,charvartable);
Error in sosineq (line 105)
sos = sosconstr(sos,'ineq',symexpr);
Error in sostest1 (line 5)
prog = sosineq(prog, p); % p is sos
I cannot figure out the problem. The same problem occurs with some of the other demos of sostoolbox. For example the sosdemo2.m also gives the error
Error using mupadengine/feval_internal
Invalid input. Expected ')'.
Error in mupadengine/feval
Any help would be appreciated.

3 Comments

I have similar question right now. Have you figured it out?
Yeah. It is the problem with the Matlab version. I ran the same code on Matlab 2015 and it worked. I guess SOSTOOLS need to be updated before it can be used in MATLAB 2020.
Hi, I am having the same issue. Please let me know if this has been resolved. Else, I have to get back to MATLAB older version to run my code.

Sign in to comment.

 Accepted Answer

Change
prog = sosprogram([x;y], [s;t]);
to
prog = sosprogram([x,y], [s,t]);
Also, your code does not define options, so your sample code will fail at that point.

3 Comments

Thank you. It does resolve the issue for this example. But sosdemo2 or the following example does not work with the solution that you have proposed. It is example 2 (b) at https://sums-of-squares.github.io/sos/
syms x y s t;
options.solver = 'sedumi'
p = s*x^6 + t*y^6 - x^4*y^2 - x^2*y^4 - x^4 + 3*x^2*y^2 - y^4 - x^2 - y^2 + 1
prog = sosprogram([x,y], [s,t]);
prog = sosineq(prog, p); % p is sos
prog = sossetobj(prog, s+t); % minimizes s+t
prog = sossolve(prog, options);
sosgetsol(prog, [s,t])
The above example gives the following error, however, decision variables have been defined:
Error using sossetobj (line 65)
There is unknown decision variable
Error in sostest1 (line 29)
prog = sossetobj(prog, (s+t)); % minimizes s+t
Note: All these examples work fine in the older version of MATLAB.
sym2chartable.m needs to be adjusted.
In a range of versions, char() applied to a symbolic list of variables [s t] would return 'matrix([s,t])' and the code would strip off all the [ and ] and then change the remaining 'matrix(s,t)' to '[s,t]' .
In sufficiently new versions, char() applied to a symbolic list of variables [s t] would return '[s,t]'. The code would strip off all the [ and ] to get 's,t' but then since there is no 'matrix(' or trailing ')' the '[' and ']' do not get wrapped.
I would suggest adding at the end
if chartable(1) ~= '['
chartable = ['[' chartable];
end
if chartable(end) ~= ']'
chartable = [chartable ']'];
end
Thank you for the explanation. I will try this :)

Sign in to comment.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Release

R2020a

Community Treasure Hunt

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

Start Hunting!