## How to solve this system of equation in Xcas

Messages in english

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

### How to solve this system of equation in Xcas

Hi,

I have a system of equations over Q(rootof(z^3-2)) that if I give in maple I get solutions with different branches and some of them are given as algebraic numbers. The code in maple looks like this:

Code : Tout sélectionner

``````p1 := 2*RootOf(_Z^3-2)^2*z*x^2+8*RootOf(_Z^3-2)^2*z^2*x+2*x^3*RootOf(_Z^3-2)+8*x^2*RootOf(_Z^3-2)*z-2*w^2*x-14*w^2*z+126*w*x*z+28*x^3-42*x^2*z+3*x*y^2-42*x*y*z-296*x*z^2-294*y*z^2-700*z^3;
p2 := 2*RootOf(_Z^3-2)^2*x^3+22*RootOf(_Z^3-2)^2*z*x^2+56*RootOf(_Z^3-2)^2*z^2*x+6*x^3*RootOf(_Z^3-2)+24*x^2*RootOf(_Z^3-2)*z+2*w^2*z-42*w*x*z-10*x^3+2*x^2*z-x*y^2+28*x*z^2+42*y*z^2+100*z^3;
p3 := 2*w*RootOf(_Z^3-2)^2*x^2+8*x*w*RootOf(_Z^3-2)^2*z+2*y*RootOf(_Z^3-2)*x^2+8*x*y*RootOf(_Z^3-2)*z+42*x^2*z+168*x*z^2;
f := p1^2+p2^2+p3^2;
solve({p1 = 0, p2 = 0, p3 = 0});
``````
Using Xcas, I have this code

Code : Tout sélectionner

``````r:=rootof(x^3-2);
p1 := 2*r^2*z*x^2+8*r^2*z^2*x+2*x^3*r+8*x^2*r*z-2*w^2*x-14*w^2*z+126*w*x*z+28*x^3-42*x^2*z+3*x*y^2-42*x*y*z-296*x*z^2-294*y*z^2-700*z^3;
p2 := 2*r^2*x^3+22*r^2*z*x^2+56*r^2*z^2*x+6*x^3*r+24*x^2*r*z+2*w^2*z-42*w*x*z-10*x^3+2*x^2*z-x*y^2+28*x*z^2+42*y*z^2+100*z^3;
p3 := 2*w*r^2*x^2+8*x*w*r^2*z+2*y*r*x^2+8*x*y*r*z+42*x^2*z+168*x*z^2;
f := p1^2 + p2^2 + p3^2;
solve([p1,p2,p3])
``````
The output is
Algebraic extensions not allowed in a rootof Error: Bad Argument Value
Am I already encountering a giac limitation? Is there a way to get the solution similar to maple? Maple provides the following solution

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

### Re: How to solve this system of equation in Xcas

Don't define r as a rootof and solve by adding the equation r^3-2=0 and you will have a polynomial system without algebraic extensions inside. For example:

Code : Tout sélectionner

``````restart;
p1 := 2*r^2*z*x^2+8*r^2*z^2*x+2*x^3*r+8*x^2*r*z-2*w^2*x-14*w^2*z+126*w*x*z+28*x^3-42*x^2*z+3*x*y^2-42*x*y*z-296*x*z^2-294*y*z^2-700*z^3;
p2 := 2*r^2*x^3+22*r^2*z*x^2+56*r^2*z^2*x+6*x^3*r+24*x^2*r*z+2*w^2*z-42*w*x*z-10*x^3+2*x^2*z-x*y^2+28*x*z^2+42*y*z^2+100*z^3;
p3 := 2*w*r^2*x^2+8*x*w*r^2*z+2*y*r*x^2+8*x*y*r*z+42*x^2*z+168*x*z^2;
``````
Then

Code : Tout sélectionner

``````solve([p1,p2,p3,r^3-2],list_of_unknowns)
``````
Beware that solve does not necessarily return all the solutions if there are parameters, it depends if it can solve equations after elimination. If there are no parameters, then rational univariate representation is used and you will get all solutions.
By the way, p3 has 3 factors, you will get (fast) answers without defining r if you solve for each factor of p3 (there is currently no factorization check in the solve code).

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

### Re: How to solve this system of equation in Xcas

Hi Bernard,

My unknowns are x,y,z and w. I think the solutions are parametrizable surfaces, so it can be parametrized by at least 2 parameters and not less. So we could assume the unknowns to be say z and w. But here, giac is struggling to find a solution (computation in my laptop does not end).

Edit: I see now what you mean. I should just use gbasis instead and just work on each factors of p3. Is there any advantage of using solve here?

Jose

parisse
Messages : 5112
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

### Re: How to solve this system of equation in Xcas

solve will mostly be useful if there is a set of isolated solutions that can be described with the rational univariate representation (all solutions as a list of rational fractions in terms of roots of a single polynomial). Otherwise, gbasis is safer, it will not miss solutions by assuming generic values for parameters.