Page 1 sur 1

### order of variables in solve

Publié : jeu. juil. 18, 2019 7:40 pm
Hello,

the accuracy of solve seems to depend on the order of variables and/or equations in some cases, e.g.

Code : Tout sélectionner

``solve(grad(x^2-y^2-lambda*(x^3+y^3-3*x*y),[x,y,lambda]),[x,y,lambda])``
returns

Code : Tout sélectionner

``[[0,0,sqrt(2*(sqrt(13)-1)/9)],[-expr("rootof([[1,-65,203,-2035],[1,0,10,-936,-3251]])",0)/4032,-expr("rootof([[1,-2,-49,-838],[1,0,10,-936,-3251]])",0)/504,sqrt(2*(sqrt(13)-1)/9)],[0,0,-(sqrt(2*(sqrt(13)-1)/9))],[-expr("rootof([[1,-2,-49,-838],[1,0,10,-936,-3251]])",0)/504,-expr("rootof([[1,-65,203,-2035],[1,0,10,-936,-3251]])",0)/4032,-(sqrt(2*(sqrt(13)-1)/9))],[0,0,lambda]]``
i.e. four solutions, while

Code : Tout sélectionner

``solve(grad(x^2-y^2-lambda*(x^3+y^3-3*x*y),[lambda,x,y]),[lambda,x,y])``
returns just 2 solutions:

Code : Tout sélectionner

``[[lambda,0,0],[0.760927982497,1.45681504207,0.845960595657]]``

### Re: order of variables in solve

Publié : jeu. juil. 18, 2019 8:26 pm
That's because the ideal is not 0-dimensional, rational univariate representation is not applicable, the current implementation of solve computes variables w.r.t. the order given (inverse order to be more precise). If a polynomial can not be solved exactly, approx roots are computed instead, and accuracy errors may propagate.

### Re: order of variables in solve

Publié : ven. juil. 19, 2019 8:04 am
Thanks for the explanation! It helps when using solve programmatically within other algorithms.