Maple 11 solve command does not seem to be able to solve systems Maple 10 can

The following system of equations can be solved by Maple 9.5 and Maple 10, but either takes a long time in Maple 11 or else simply won't solve. Is anyone else experiencing problems with the solve command? Earlier I noticed that Maple 11 was returning duplicates in solutions, but this is more serious. We tried this system on Maple 9.5 and Maple 10, and it solves easily, but on two computers with Maple 11, in classic worksheet mode, minutes went by with no solution.

{2*a[2,6]*a[2,9]-2*a[2,8]*a[2,9], 2*a[1,5]*a[3,1]+2*a[1,7]*a[3,1], 2*a[2,6]*a[3,4]-2*a[2,8]*a[3,4], 2*a[1,5]*a[2,1]+2*a[1,7]*a[2,1], 2*a[1,2]*a[3,1]+2*a[1,3]*a[3,1], 2*a[1,2]*a[2,1]+2*a[1,3]*a[2,1], -2*a[3,4]*a[3,6]+2*a[3,4]*a[3,8], 2*a[2,8]*a[3,8]-2*a[2,9]*a[3,4], -2*a[2,8]*a[3,8]+2*a[2,9]*a[3,4], 2*a[1,2]*a[1,5]+2*a[1,2]*a[2,6]+2*a[1,5]*a[3,6], 2*a[2,6]*a[3,6]-2*a[2,9]*a[3,4], -2*a[2,6]*a[3,6]+2*a[2,9]*a[3,4], -2*a[2,6]*a[3,4]+2*a[2,8]*a[3,4], 2*a[2,9]*a[3,6]-2*a[2,9]*a[3,8], -2*a[2,9]*a[3,6]+2*a[2,9]*a[3,8], 2*a[1,2]*a[2,1]+2*a[2,1]*a[2,4]+2*a[2,8]*a[3,1], 2*a[1,2]*a[2,9]+2*a[1,5]^2+2*a[1,5]*a[3,9], 2*a[1,2]^2+2*a[1,2]*a[2,4]+2*a[1,5]*a[3,4], -2*a[2,4]*a[2,9]+2*a[2,6]^2-2*a[2,6]*a[3,9]+2*a[2,9]*a[3,6], 2*a[1,2]*a[1,5]+2*a[1,2]*a[2,8]+2*a[1,5]*a[3,8], -2*a[2,4]*a[3,8]+2*a[2,8]*a[3,4]-2*a[3,4]*a[3,9]+2*a[3,8]^2, -2*a[1,3]*a[1,7]+2*a[1,3]*a[2,6]+2*a[1,7]*a[3,6], -2*a[1,3]*a[1,7]+2*a[1,3]*a[2,8]+2*a[1,7]*a[3,8], 2*a[1,3]*a[2,1]-2*a[2,1]*a[2,4]-2*a[2,6]*a[3,1], 2*a[1,3]*a[2,9]-2*a[1,7]^2+2*a[1,7]*a[3,9], 2*a[1,5]*a[2,1]+2*a[2,1]*a[2,6]+2*a[2,9]*a[3,1], 2*a[1,7]*a[2,1]-2*a[2,1]*a[2,8]-2*a[2,9]*a[3,1], 2*a[1,7]*a[3,1]-2*a[2,1]*a[3,8]-2*a[3,1]*a[3,9], 2*a[1,2]*a[3,1]+2*a[2,1]*a[3,4]+2*a[3,1]*a[3,8], 2*a[1,5]*a[3,1]+2*a[2,1]*a[3,6]+2*a[3,1]*a[3,9], 2*a[1,2]*a[2,1]+2*a[1,3]*a[2,1]+2*a[1,5]*a[3,1]+2*a[1,7]*a[3,1], -2*a[1,3]^2+2*a[1,3]*a[2,4]+2*a[1,7]*a[3,4], 2*a[2,4]*a[2,9]-2*a[2,8]^2+2*a[2,8]*a[3,9]-2*a[2,9]*a[3,8], -2*a[2,6]*a[3,8]+2*a[2,8]*a[3,6]-2*a[3,6]*a[3,9]+2*a[3,8]*a[3,9], 2*a[2,4]*a[2,6]-2*a[2,4]*a[2,8]-2*a[2,6]*a[3,8]+2*a[2,8]*a[3,6], 2*a[1,3]*a[3,1]-2*a[2,1]*a[3,4]-2*a[3,1]*a[3,6], 2*a[2,4]*a[3,6]-2*a[2,6]*a[3,4]+2*a[3,4]*a[3,9]-2*a[3,6]^2}

roman_pearce's picture

solving polynomial systems

At first I assumed this was due to the Groebner changes in Maple 11, but that seems to not be the case. Thank you for the interesting benchmark. Try the following:

sys := {...your system...}:
sol := Groebner[Solve](sys):
sol := map(a->[solve(a[1],[op(a[2])]), map(`<>`, a[3], 0)], sol):
sol := {seq(seq([i,j[2]], i=j[1]), j=sol)}:

This should write the solutions in a nice form. There may be duplicate or equivalent solutions, but you shouldn't lose any.

jpmay's picture

Another Workaround

This looks like a bug in one of the internal solve routines in Maple 11. Here is another way to solve this:

sys:={...your system...};
SolveTools[PolynomialSystem](sys, indets(sys));

From ?SolveTools[PolynomialSystem]:

The PolynomialSystem command uses a number of heuristic techniques to find solutions efficiently. If these techniques are not successful, the function uses Groebner Bases methods.

Issue has been tracked

The issue mentioned in this post is now tracked in Maple's internal bug-tracking system. While we are fixing this bug, please try the workarounds mentioned above.

Solve still defective

Maple 9.5 and Maple 10 can solve the following system of equations found at this link Download 2448_system.mws

in about 5 or 10 minutes. They both properly come up with 128 solutions.

Maple 11, and now Maple 12, cannot solve the system.

The workaround given by jpmay does not work since it only returns 1 of the 128 solutions.

It is disappointing that this tracked bug was not fixed before Maple12 was released

jpmay's picture

Clarifications

The solve problem reported in penkavmr's  original post in has been fixed.  In Maple 12, solve finds solutions for that system in less than one second. Try it:

time( solve(sys) );
                                     0.404

As far as the new system given by Alex, it looks like Maple versions 10-12 cannot solve it  (I stopped 10 and 12 each at 3000 seconds) while Maple 9.5 solves it in 200 seconds or so.  Even though it is a system similar to penkavmr's, the underlying problem appears to be completely different.

Also, in Maple 12, SolveTools[PolynomialSystems] does solve Alex's system (in about 250 seconds), and since solve pretty much immediately calls SolveTools[PolynomialSystems] in this case, that means the problem here is much weirder than the problem penkavmr's system was encountering (I suspect it is subtle interaction due to the renaming of the indexed variables). 

As for returning only one solution, that is the default, but SolveTools[PolynomialSystems] will return more if asked.  Take a look at its help page.

John May
Math Developer
Maplesoft

jpmay's picture

Subtle Problem + Work around

In fact it is a very subtle problem.  Indexed variables a[i,j] can cause problems in some solve subroutines, so one of the first things solve does is rename these variables to new symbols like x_nn.  In the case of this system, the order in which the polynomial system solver handles the variables matters a lot, and when the variables get renamed, they get ordered differently.  It seems more or less chance that the original variable names get ordered in a way so the polynomial system solver returns quickly.

Here is another work around (use symbols instead of indexed names):

vars := indets(sys);
vars2 := map(x->evaln(cat(op(0,x),'_',op(1,x),'_',op(2,x))), vars);
sys := subs([seq(vars[i]=vars2[i], i=1..nops(vars))], sys):
time(solve(sys));
                                    275.825

John

alec's picture

evalindets

That could be done more simple using evalindets.

sys:=evalindets(sys,'indexed',curry(cat@op,0..-1));

Alec

jpmay's picture

as one line

*edit: or that ---^

True, a one-liner would do it:

subsindets(sys, 'indexed', x->cat(op(0,x),'_',op(1,x),'_',op(2,x)) );

John

alec's picture

with underscores

Or, I missed the underscores! With underscores, that could be also done as

sys:=evalindets[flat](sys,'indexed',
x->cat(ListTools:-Join([op(0..-1,x)],_)[]));

Alec

jpmay's picture

Very nice.

Very nice.

John

alec's picture

Thank you!

Thank you,

Originally, I hadn't realized that both a{1,11] and a[11,1] would get converted to the same variable a111 if underscores were not used.

Also, in the second version, I forgot to quote the underscore. It should be '_' instead of _, I just noticed that you quoted it in your version of the code above.

Alec

It is better

The workaround that John May and Alec propose is productive. When I ran it, Maple 12 returned 92 solutions, whereas Maple 9.5 returned 128 solutions, but we will check theory, etc. to see if the discrepancy is real.

I suppose that my colleagues and I could figure this next step out on our own ("exercise for the reader"!), but John May and Alec seemed primed to do this four orders of magnitude faster:

How can we take the returned solutions that contain variables such as a_1_1 and efficiently convert the solutions to variables such as a[1,1]? 

Thanks!

alec's picture

No problem

Suppose that sol is the list of solutions with a_1_1, then the following should convert them to the list of solutions with a[1,1],

f:=proc(x) local a;
a:=StringTools:-Split(x,'_');
if nops(a)>1 then
parse(cat(a[1],sprintf("%a",map(parse,a[2..-1]))))
else x fi
end:

sol:=evalindets(sol,'symbol',f);

Not tested, because I couldn't login to the server with Maple 12 that I used last few days and I don't have Maple installed at home.

Alec

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}