Question: Maple solve hangs depending on what letters are used for the unknowns

Could someone help me understand why Maple hangs solving these two equations when the names of unknowns is c__1,c__2   or the old _C1, _C2?

This worksheets shows this. I had to put timelimit of 90 seconds, else it hangs may be forever.    

This example came from looking at why Maple seems to hang randomly when I run the same problem. I still do not know why, but is seems to have something to do with the use of  lower case c__1 or _C1. 

16020

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1744 and is the same as the version installed in this computer, created 2024, April 17, 19:33 hours Pacific Time.`

restart;

dsolve(diff(y(x),x$9)=1,arbitraryconstants=subscripted);

y(x) = (1/362880)*x^9+(1/40320)*c__1*x^8+(1/5040)*c__2*x^7+(1/720)*c__3*x^6+(1/120)*c__4*x^5+(1/24)*c__5*x^4+(1/6)*c__6*x^3+(1/2)*c__7*x^2+c__8*x+c__9

eqs:=[-1/2*arctanh(1/2*sqrt(1 + 2*c__1)*sqrt(2)/sqrt(c__1))*sqrt(2)/sqrt(c__1) = c__2, 1 = (-exp(2*c__2*sqrt(c__1)*sqrt(2)) + 1)*sqrt(c__1)*sqrt(2)/(exp(2*c__2*sqrt(c__1)*sqrt(2)) + 1)];
unknowns:=[c__1,c__2];
time();
C_sol:=[timelimit(90,solve(eqs,unknowns))];
time()

[-(1/2)*arctanh((1/2)*(1+2*c__1)^(1/2)*2^(1/2)/c__1^(1/2))*2^(1/2)/c__1^(1/2) = c__2, 1 = (-exp(2*c__2*c__1^(1/2)*2^(1/2))+1)*c__1^(1/2)*2^(1/2)/(exp(2*c__2*c__1^(1/2)*2^(1/2))+1)]

[c__1, c__2]

.609

Error, (in evalf/hypergeom) time expired

106.125

restart; #try again but do not do the arbitraryconstants=subscripted now.

eqs:=[-1/2*arctanh(1/2*sqrt(1 + 2*c__1)*sqrt(2)/sqrt(c__1))*sqrt(2)/sqrt(c__1) = c__2, 1 = (-exp(2*c__2*sqrt(c__1)*sqrt(2)) + 1)*sqrt(c__1)*sqrt(2)/(exp(2*c__2*sqrt(c__1)*sqrt(2)) + 1)];
unknowns:=[c__1,c__2];
time();
C_sol:=[timelimit(90,solve(eqs,unknowns))];
time()

[-(1/2)*arctanh((1/2)*(1+2*c__1)^(1/2)*2^(1/2)/c__1^(1/2))*2^(1/2)/c__1^(1/2) = c__2, 1 = (-exp(2*c__2*c__1^(1/2)*2^(1/2))+1)*c__1^(1/2)*2^(1/2)/(exp(2*c__2*c__1^(1/2)*2^(1/2))+1)]

[c__1, c__2]

106.234

[[]]

106.390

#see? it finisghed instantly now.


Download why_solve_hangs_with_subscripted_may_15_2024.mw

The same thing happens If I use the old _C1 and _C2 instead of c__1 and c__2. It also hangs. 

The following worksheet shows this.  If I change _C1 and _C2 to other symbols, say C1 and C2, then it does not hang. 

Why the names of the unknowns makes difference to solve?
 

18792

restart;

18792

eqs:=[-1/2*arctanh(1/2*sqrt(1 + 2*_C1)*sqrt(2)/sqrt(_C1))*sqrt(2)/sqrt(_C1) = _C2, 1 = (-exp(2*_C2*sqrt(_C1)*sqrt(2)) + 1)*sqrt(_C1)*sqrt(2)/(exp(2*_C2*sqrt(_C1)*sqrt(2)) + 1)];
unknowns:=[_C1,_C2];
time();
C_sol:=[timelimit(90,solve(eqs,unknowns))];
time()

[-(1/2)*arctanh((1/2)*(1+2*_C1)^(1/2)*2^(1/2)/_C1^(1/2))*2^(1/2)/_C1^(1/2) = _C2, 1 = (-exp(2*_C2*_C1^(1/2)*2^(1/2))+1)*_C1^(1/2)*2^(1/2)/(exp(2*_C2*_C1^(1/2)*2^(1/2))+1)]

[_C1, _C2]

.125

Error, (in evalf/cos) time expired

105.218

restart;

18792

eqs:=[-1/2*arctanh(1/2*sqrt(1 + 2*C1)*sqrt(2)/sqrt(C1))*sqrt(2)/sqrt(C1) = C2, 1 = (-exp(2*C2*sqrt(C1)*sqrt(2)) + 1)*sqrt(C1)*sqrt(2)/(exp(2*C2*sqrt(C1)*sqrt(2)) + 1)];
unknowns:=[C1,C2];
time();
C_sol:=[timelimit(90,solve(eqs,unknowns))];
time()

[-(1/2)*arctanh((1/2)*(1+2*C1)^(1/2)*2^(1/2)/C1^(1/2))*2^(1/2)/C1^(1/2) = C2, 1 = (-exp(2*C2*C1^(1/2)*2^(1/2))+1)*C1^(1/2)*2^(1/2)/(exp(2*C2*C1^(1/2)*2^(1/2))+1)]

[C1, C2]

105.312

[[]]

105.468

 

 

Download why_solve_hangs_with_OLD_C_also_may_15_2024.mw

Only thing I see in help related to name of symbols to solve for is this:

The solve command solves one or more equations or inequalities for the specified unknowns. The unknowns may be names, including indexed names (though for efficiency reasons, indexed names should be avoided when possible), 

ps. This looks like a bug to me. So I send bug report to Maplesoft support also.

 

pps. I tried this in Maple 2023 and Maple 2022 and same behavior. Could someone with earlier version of Maple try to see if this behavior was there also?   It can possibly be correct that the choice of letter used makes difference for solving equations. I have to use c__1 and c__2 etc.. since these equations come from differential equations and this is what I use for constants of integrations., Otherwise I have to make lots of changes now to use different letters.

Update

did trace on solve using _C1 and _C2 and then using A,B for variables to solve for. Code flow is different. This expalins why it hangs. The flow starts the same until it gets to 

TriangularDecomposition: something went wrong during backsubstitution - trying a different variable order

Then when using _C1 and _C2 the code goes into different path than when using A,B. 

Here is flow when using _C1,_C2.

eqs:=[-1/2*arctanh(1/2*sqrt(1 + 2*_C1)*sqrt(2)/sqrt(_C1))*sqrt(2)/sqrt(_C1) = _C2, 1 = (-exp(2*_C2*sqrt(_C1)*sqrt(2)) + 1)*sqrt(_C1)*sqrt(2)/(exp(2*_C2*sqrt(_C1)*sqrt(2)) + 1)];
unknowns:={_C1,_C2};
time();
infolevel[solve]:=5;
C_sol:=[timelimit(60,solve(eqs,unknowns))]; 
time()


Main: Entering solver with 2 equations in 2 variables
Main: attempting to solve as a linear system
Dispatch: dispatching to Radicals handler
Recurse: recursively solving 2 equations and 2 inequations in 2 variables
Dispatch: dispatching to Radicals handler
Transformer:   solving for linear equation in _X000001
Recurse: recursively solving 2 equations and 2 inequations in 2 variables
Dispatch: dispatching to Radicals handler
Recurse: recursively solving 3 equations and 2 inequations in 3 variables
Dispatch: dispatching to Exponentials handler
Transformer:   solving for linear equation in _S000004
Recurse: recursively solving 3 equations and 3 inequations in 4 variables
Dispatch: dispatching to Rename handler
Dispatch: renaming _S000005 = arctanh(1/2*_S000002*RootOf(_Z^2-2,index = 1)/_S000001)
Recurse: recursively solving 3 equations and 3 inequations in 5 variables
Dispatch: handling polynomials of the form a*x^n-b
Dispatch: dispatching to PolynomialSystem handler
Main: polynomial system split into 1 parts under preprocessing
Main: using RegularChains based methods
SolverVariableOrder: using the variable order  _S000003 > _X000002 > _S000005 > _S000002 > _S000001
TriangularDecomposition: using deterministic algorithm for decomposition
TriangularDecomposition: decomposition successfully found 1 components
TriangularDecomposition: backsubstituting to form solutions
TriangularDecomposition: something went wrong during backsubstitution - trying a different variable order
Transformer:   solving the uncoupled linear subsystem in {_S000003, _X000002}
Linear: solving 2 linear equations
Polynomial: # of equations is: 2
Polynomial: best equation / unknown _S000005*_z1 _X000002 2*_S000001
Polynomial: # of equations is: 1
Polynomial: best equation / unknown -_z1*_S000001+1 _S000003 _z1*_S000001+1
Polynomial: backsubstitution at: 2
Polynomial: backsubstitution at: 1
Main: polynomial system split into 1 parts under preprocessing
Main: subsystem is essentially univariate
UnivariateHandler: subsystem has only one equation
UnivariateHandler: solving as if univariate in _S000002
Recurse: recursively solving 1 equations and 0 inequations in 1 variables
Dispatch: dispatching to OnlyIn handler
Transformer:   solving for linear equation in _S000006
Recurse: recursively solving 1 equations and 0 inequations in 1 variables
Transformer:   solving the uncoupled linear subsystem in _S000006
Recurse: recursively solving 1 equations and 1 inequations in 1 variables
Transformer:   solving the uncoupled linear subsystem in t
Error, (in evalf/hypergeom) time expired

 

This is trace when using A,B

 

eqs:=[-1/2*arctanh(1/2*sqrt(1 + 2*A)*sqrt(2)/sqrt(A))*sqrt(2)/sqrt(A) =B, 1 = (-exp(2*B*sqrt(A)*sqrt(2)) + 1)*sqrt(A)*sqrt(2)/(exp(2*B*sqrt(A)*sqrt(2)) + 1)];
unknowns:={A,B};
time();
infolevel[solve]:=5;
C_sol:=[timelimit(90,solve(eqs,unknowns))]; 
time()


Main: Entering solver with 2 equations in 2 variables
Main: attempting to solve as a linear system
Dispatch: dispatching to Radicals handler
Recurse: recursively solving 2 equations and 2 inequations in 2 variables
Dispatch: dispatching to Radicals handler
Transformer:   solving for linear equation in A
Recurse: recursively solving 2 equations and 2 inequations in 2 variables
Dispatch: dispatching to Radicals handler
Recurse: recursively solving 3 equations and 2 inequations in 3 variables
Dispatch: dispatching to Exponentials handler
Transformer:   solving for linear equation in _S000004
Recurse: recursively solving 3 equations and 3 inequations in 4 variables
Dispatch: dispatching to Rename handler
Dispatch: renaming _S000005 = arctanh(1/2*_S000002*RootOf(_Z^2-2,index = 1)/_S000001)
Recurse: recursively solving 3 equations and 3 inequations in 5 variables
Dispatch: handling polynomials of the form a*x^n-b
Dispatch: dispatching to PolynomialSystem handler
Main: polynomial system split into 1 parts under preprocessing
Main: using RegularChains based methods
SolverVariableOrder: using the variable order  _S000003 > B > _S000005 > _S000002 > _S000001
TriangularDecomposition: using deterministic algorithm for decomposition
TriangularDecomposition: decomposition successfully found 1 components
TriangularDecomposition: backsubstituting to form solutions
TriangularDecomposition: something went wrong during backsubstitution - trying a different variable order
Main: polynomial system split into 1 parts under preprocessing
Main: applying the solver for domain=absolute, engine=traditional
PseudoResultant: 225530 [1 200002087 _S000001] 3 3 151 2 45 0
PseudoResultant: 120059 [2 200004772 _S000003] 2 2 131 0 3 0
PseudoResultant: 134507 [1 700002396 _S000002] 1 1 53 0 3 0
PseudoResultant: -10 [] 0 0 3 0 3 0
PseudoResultant: 1 solutions found, now doing backsubstitution
PseudoResultant: backsubstitution of _S000002
PseudoResultant: backsubstitution of _S000003
PseudoResultant: backsubstitution of _S000001
SolutionsLost: setting solutions lost flag
Main: solving successful - now forming solutions
Main: Exiting solver returning 0 solutions

solve: Warning: no solutions found

 

Please Wait...