# Revision history [back]

### Solve a system of polynomial equations - getting differetn results using Symbolic Math Toolbox of MATLAB and Sage

Hi all,

I am trying to solve the following system of equations:

eq1 = 0.8 - 1.8352657742116e-5sqrt(x1(3071.1916x2 + (2.19736842105263e-5 *x3 - 0.378721571752863)(3069.38078875823x1 - 802.539479414006x2 - 802.539479414006x3 + 1187113.71566341))/(2.19736842105263e-5x3 - 0.378721571752863))

eq2 = (-0.00117574932506308x2sqrt(-(0.039945461792316x2 + 0.039945461792316x3 - 71.5306505072653)(3071.1916x2 + 32.9605263157895x3 - 568082.357629294)/(2.19736842105263e-5x3 - 0.378721571752863)) + 1.8352657742116e-5sqrt(x1(3071.1916x2 + (2.19736842105263e-5x3 - 0.378721571752863)(3069.38078875823x1 - 802.539479414006x2 - 802.539479414006x3 + 1187113.71566341))/(2.19736842105263e-5x3 - 0.378721571752863))(x2 + x3))/(x2 + x3)

eq3 = eq3 = (0.007585843252x2(x2 + x3) - 0.00117574932506308x3sqrt(-(0.039945461792316x2 + 0.039945461792316x3 - 71.5306505072653)(3071.1916x2 + 32.9605263157895x3 - 568082.357629294)/(2.19736842105263e-5x3 - 0.378721571752863))(2.19736842105263e-5x3 - 0.378721571752863) + (x2 + x3)(2.19736842105263e-5x3 - 0.378721571752863)(-0.00198227251415259x2 - 0.00198227251415259x3 + 42.4521708776886))/((x2 + x3)(2.19736842105263e-5*x3 - 0.378721571752863))

When I use Symbolic Math Toolbox in Matlab through the following command:

[x1_bar,x2_bar,x3_bar] = solve(eqs,[x1,x2,x3], 'MaxDegree',4);

we get the following results:

x1_bar = ans =

1.0e+04 *

-0.0116 + 0.0000i 0.5338 + 0.0000i -0.0232 + 0.0000i 0.2669 + 0.0000i -0.0047 + 0.0000i 1.3191 + 0.0000i -0.0321 - 0.5445i 0.0007 - 0.0113i -0.0321 + 0.5445i 0.0007 + 0.0113i -0.0012 + 0.0000i 5.1569 + 0.0000i

x2_bar = 1.0e+03 *

1.9653 + 0.0000i 1.9653 + 0.0000i 0.2480 + 0.0000i 0.2480 + 0.0000i -0.6495 + 0.0000i -0.6495 + 0.0000i -0.1794 + 0.2236i -0.1794 + 0.2236i -0.1794 - 0.2236i -0.1794 - 0.2236i -0.0393 + 0.0000i -0.0393 + 0.0000i

x3_bar = 1.0e+04 *

-0.0174 + 0.0000i -0.0174 + 0.0000i 0.6522 + 0.0000i 0.6522 + 0.0000i 4.8817 + 0.0000i 4.8817 + 0.0000i 0.2382 + 2.1159i 0.2382 + 2.1159i 0.2382 - 2.1159i 0.2382 - 2.1159i 1.7273 + 0.0000i 1.7273 + 0.0000i

When I try to solve this problem with Sage using:

S = solve([eq1,eq2,eq3],x1,x2,x3)

I obtain the following results:

[{x1: -321.3551367159828 - 5445.311876550251I, x2: -179.359654094372 - 223.5730259195566I, x3: 2381.999033439763 - 21159.38999334523I}, {x1: 6.685918535164614 - 113.2918302698741I, x2: -179.359654094372 - 223.5730259195566I, x3: 2381.999033439763 - 21159.38999334523I}, {x1: 6.685918535164623 + 113.2918302698741I, x2: -179.359654094372 + 223.5730259195566I, x3: 2381.999033439763 + 21159.38999334523I}, {x1: -321.3551367159836 + 5445.311876550251I, x2: -179.359654094372 + 223.5730259195566I, x3: 2381.999033439763 + 21159.38999334523I}]

I tried also to use the ploynomialRing but it is failing to solve the problem.

 2 None slelievre 12676 ●11 ●122 ●252 http://carva.org/samue...

### Solve a system of polynomial equations - getting differetn results using Symbolic Math Toolbox of MATLAB and Sage

Hi all,

I am trying to solve the following system of equations:

eq1 = 0.8 - 1.8352657742116e-5sqrt(x1(3071.1916x2 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5 *x3 - 0.378721571752863)(3069.38078875823x1 - 802.539479414006x2 - 802.539479414006x3 + 1187113.71566341))/(2.19736842105263e-5x3 - 0.378721571752863)) 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))

eq2 = (-0.00117574932506308x2sqrt(-(0.039945461792316x2 + 0.039945461792316x3 - 71.5306505072653)(3071.1916x2 + 32.9605263157895x3 - 568082.357629294)/(2.19736842105263e-5x3 (-0.00117574932506308*x2*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863)) + 1.8352657742116e-5sqrt(x1(3071.1916x2 + (2.19736842105263e-5x3 - 0.378721571752863)(3069.38078875823x1 - 802.539479414006x2 - 802.539479414006x3 + 1187113.71566341))/(2.19736842105263e-5x3 - 0.378721571752863))1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5*x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))*(x2 + x3))/(x2 + x3)

eq3 = (0.007585843252*x2*(x2 + x3) - 0.00117574932506308*x3*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863))*(2.19736842105263e-5*x3 - 0.378721571752863) + (x2 + x3))/(x2 + x3) eq3 = eq3 = (0.007585843252x2(x2 + x3) - 0.00117574932506308x3sqrt(-(0.039945461792316x2 + 0.039945461792316x3 - 71.5306505072653)(3071.1916x2 + 32.9605263157895x3 - 568082.357629294)/(2.19736842105263e-5x3 - 0.378721571752863))(2.19736842105263e-5x3 - 0.378721571752863) + (x2 + x3)(2.19736842105263e-5x3 - 0.378721571752863)(-0.00198227251415259x2 - 0.00198227251415259x3 x3)*(2.19736842105263e-5*x3 - 0.378721571752863)*(-0.00198227251415259*x2 - 0.00198227251415259*x3 + 42.4521708776886))/((x2 + x3)(2.19736842105263e-5*x3 - 0.378721571752863))x3)*(2.19736842105263e-5*x3 - 0.378721571752863))


When I use Symbolic Math Toolbox in Matlab through the following command:

[x1_bar,x2_bar,x3_bar] = solve(eqs,[x1,x2,x3], 'MaxDegree',4);'MaxDegree',4);


we get the following results:

x1_bar =

x1_bar
ans = =

1.0e+04 * *

-0.0116 + 0.0000i
0.5338 + 0.0000i
-0.0232 + 0.0000i
0.2669 + 0.0000i
-0.0047 + 0.0000i
1.3191 + 0.0000i
-0.0321 - 0.5445i
0.0007 - 0.0113i
-0.0321 + 0.5445i
0.0007 + 0.0113i
-0.0012 + 0.0000i
5.1569 + 0.0000i 0.0000i

x2_bar =
1.0e+03 * *

1.9653 + 0.0000i
1.9653 + 0.0000i
0.2480 + 0.0000i
0.2480 + 0.0000i
-0.6495 + 0.0000i
-0.6495 + 0.0000i
-0.1794 + 0.2236i
-0.1794 + 0.2236i
-0.1794 - 0.2236i
-0.1794 - 0.2236i
-0.0393 + 0.0000i
-0.0393 + 0.0000i 0.0000i

x3_bar =
1.0e+04 * *

-0.0174 + 0.0000i
-0.0174 + 0.0000i
0.6522 + 0.0000i
0.6522 + 0.0000i
4.8817 + 0.0000i
4.8817 + 0.0000i
0.2382 + 2.1159i
0.2382 + 2.1159i
0.2382 - 2.1159i
0.2382 - 2.1159i
1.7273 + 0.0000i
1.7273 + 0.0000i0.0000i


When I try to solve this problem with Sage using:

S = solve([eq1,eq2,eq3],x1,x2,x3)solve([eq1,eq2,eq3],x1,x2,x3)


I obtain the following results:

[{x1: -321.3551367159828 - 5445.311876550251I, x2: -179.359654094372 - 223.5730259195566I, x3: 2381.999033439763 - 21159.38999334523I}, {x1: 6.685918535164614 - 113.2918302698741I, x2: -179.359654094372 - 223.5730259195566I, x3: 2381.999033439763 - 21159.38999334523I}, {x1: 6.685918535164623 + 113.2918302698741I, x2: -179.359654094372 + 223.5730259195566I, x3: 2381.999033439763 + 21159.38999334523I}, {x1: -321.3551367159836 + 5445.311876550251I, x2: -179.359654094372 + 223.5730259195566I, x3: 2381.999033439763 + 21159.38999334523I}]

I tried also to use the ploynomialRing PolynomialRing but it is failing to solve the problem.

 3 None slelievre 12676 ●11 ●122 ●252 http://carva.org/samue...

### Solve a system of polynomial equations - getting differetn results using Symbolic Math Toolbox of MATLAB and Sage

I am trying to solve the following system of equations:

eq1 = 0.8 - 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5 *x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))

eq2 = (-0.00117574932506308*x2*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863)) + 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5*x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))*(x2 + x3))/(x2 + x3)

eq3 = (0.007585843252*x2*(x2 + x3) - 0.00117574932506308*x3*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863))*(2.19736842105263e-5*x3 - 0.378721571752863) + (x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863)*(-0.00198227251415259*x2 - 0.00198227251415259*x3 + 42.4521708776886))/((x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863))


When I use Symbolic Math Toolbox in Matlab through the following command:

[x1_bar,x2_bar,x3_bar] = solve(eqs,[x1,x2,x3], 'MaxDegree',4);


we get the following results:

x1_bar
ans =

1.0e+04 *

-0.0116 + 0.0000i
0.5338 + 0.0000i
-0.0232 + 0.0000i
0.2669 + 0.0000i
-0.0047 + 0.0000i
1.3191 + 0.0000i
-0.0321 - 0.5445i
0.0007 - 0.0113i
-0.0321 + 0.5445i
0.0007 + 0.0113i
-0.0012 + 0.0000i
5.1569 + 0.0000i

x2_bar =
1.0e+03 *

1.9653 + 0.0000i
1.9653 + 0.0000i
0.2480 + 0.0000i
0.2480 + 0.0000i
-0.6495 + 0.0000i
-0.6495 + 0.0000i
-0.1794 + 0.2236i
-0.1794 + 0.2236i
-0.1794 - 0.2236i
-0.1794 - 0.2236i
-0.0393 + 0.0000i
-0.0393 + 0.0000i

x3_bar =
1.0e+04 *

-0.0174 + 0.0000i
-0.0174 + 0.0000i
0.6522 + 0.0000i
0.6522 + 0.0000i
4.8817 + 0.0000i
4.8817 + 0.0000i
0.2382 + 2.1159i
0.2382 + 2.1159i
0.2382 - 2.1159i
0.2382 - 2.1159i
1.7273 + 0.0000i
1.7273 + 0.0000i


When I try to solve this problem with Sage using:

S = solve([eq1,eq2,eq3],x1,x2,x3)


I obtain the following results:

[{x1: -321.3551367159828 - 5445.311876550251I,
5445.311876550251*I,
x2: -179.359654094372 - 223.5730259195566I,
223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523I},
21159.38999334523*I},
{x1: 6.685918535164614 - 113.2918302698741I,
113.2918302698741*I,
x2: -179.359654094372 - 223.5730259195566I,
223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523I},
21159.38999334523*I},
{x1: 6.685918535164623 + 113.2918302698741I,
113.2918302698741*I,
x2: -179.359654094372 + 223.5730259195566I,
223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523I},
21159.38999334523*I},
{x1: -321.3551367159836 + 5445.311876550251I,
5445.311876550251*I,
x2: -179.359654094372 + 223.5730259195566I,
223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523I}]21159.38999334523*I}]


I tried also to use the PolynomialRing but it is failing to solve the problem.

 4 None FrédéricC 3705 ●3 ●36 ●73

### Solve a system of polynomial equations - getting differetn results using Symbolic Math Toolbox of MATLAB and Sage

I am trying to solve the following system of equations:

eq1 = 0.8 - 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5 *x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))

eq2 = (-0.00117574932506308*x2*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863)) + 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5*x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))*(x2 + x3))/(x2 + x3)

eq3 = (0.007585843252*x2*(x2 + x3) - 0.00117574932506308*x3*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863))*(2.19736842105263e-5*x3 - 0.378721571752863) + (x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863)*(-0.00198227251415259*x2 - 0.00198227251415259*x3 + 42.4521708776886))/((x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863))


When I use Symbolic Math Toolbox in Matlab through the following command:

[x1_bar,x2_bar,x3_bar] = solve(eqs,[x1,x2,x3], 'MaxDegree',4);


we get the following results:

x1_bar
ans =

1.0e+04 *

-0.0116 + 0.0000i
0.5338 + 0.0000i
-0.0232 + 0.0000i
0.2669 + 0.0000i
-0.0047 + 0.0000i
1.3191 + 0.0000i
-0.0321 - 0.5445i
0.0007 - 0.0113i
-0.0321 + 0.5445i
0.0007 + 0.0113i
-0.0012 + 0.0000i
5.1569 + 0.0000i

x2_bar =
1.0e+03 *

1.9653 + 0.0000i
1.9653 + 0.0000i
0.2480 + 0.0000i
0.2480 + 0.0000i
-0.6495 + 0.0000i
-0.6495 + 0.0000i
-0.1794 + 0.2236i
-0.1794 + 0.2236i
-0.1794 - 0.2236i
-0.1794 - 0.2236i
-0.0393 + 0.0000i
-0.0393 + 0.0000i

x3_bar =
1.0e+04 *

-0.0174 + 0.0000i
-0.0174 + 0.0000i
0.6522 + 0.0000i
0.6522 + 0.0000i
4.8817 + 0.0000i
4.8817 + 0.0000i
0.2382 + 2.1159i
0.2382 + 2.1159i
0.2382 - 2.1159i
0.2382 - 2.1159i
1.7273 + 0.0000i
1.7273 + 0.0000i


When I try to solve this problem with Sage using:

S = solve([eq1,eq2,eq3],x1,x2,x3)


I obtain the following results:

[{x1: -321.3551367159828 - 5445.311876550251*I,
x2: -179.359654094372 - 223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523*I},
{x1: 6.685918535164614 - 113.2918302698741*I,
x2: -179.359654094372 - 223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523*I},
{x1: 6.685918535164623 + 113.2918302698741*I,
x2: -179.359654094372 + 223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523*I},
{x1: -321.3551367159836 + 5445.311876550251*I,
x2: -179.359654094372 + 223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523*I}]


I tried also to use the PolynomialRing but it is failing to solve the problem.

### Solve a system of polynomial equations - getting differetn different results using Symbolic Math Toolbox of MATLAB and Sage

I am trying to solve the following system of equations:

eq1 = 0.8 - 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5 *x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))

eq2 = (-0.00117574932506308*x2*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863)) + 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5*x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))*(x2 + x3))/(x2 + x3)

eq3 = (0.007585843252*x2*(x2 + x3) - 0.00117574932506308*x3*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863))*(2.19736842105263e-5*x3 - 0.378721571752863) + (x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863)*(-0.00198227251415259*x2 - 0.00198227251415259*x3 + 42.4521708776886))/((x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863))


When I use Symbolic Math Toolbox in Matlab through the following command:

[x1_bar,x2_bar,x3_bar] = solve(eqs,[x1,x2,x3], 'MaxDegree',4);


we get the following results:

x1_bar
ans =

1.0e+04 *

-0.0116 + 0.0000i
0.5338 + 0.0000i
-0.0232 + 0.0000i
0.2669 + 0.0000i
-0.0047 + 0.0000i
1.3191 + 0.0000i
-0.0321 - 0.5445i
0.0007 - 0.0113i
-0.0321 + 0.5445i
0.0007 + 0.0113i
-0.0012 + 0.0000i
5.1569 + 0.0000i

x2_bar =
1.0e+03 *

1.9653 + 0.0000i
1.9653 + 0.0000i
0.2480 + 0.0000i
0.2480 + 0.0000i
-0.6495 + 0.0000i
-0.6495 + 0.0000i
-0.1794 + 0.2236i
-0.1794 + 0.2236i
-0.1794 - 0.2236i
-0.1794 - 0.2236i
-0.0393 + 0.0000i
-0.0393 + 0.0000i

x3_bar =
1.0e+04 *

-0.0174 + 0.0000i
-0.0174 + 0.0000i
0.6522 + 0.0000i
0.6522 + 0.0000i
4.8817 + 0.0000i
4.8817 + 0.0000i
0.2382 + 2.1159i
0.2382 + 2.1159i
0.2382 - 2.1159i
0.2382 - 2.1159i
1.7273 + 0.0000i
1.7273 + 0.0000i


When I try to solve this problem with Sage using:

S = solve([eq1,eq2,eq3],x1,x2,x3)


I obtain the following results:

[{x1: -321.3551367159828 - 5445.311876550251*I,
x2: -179.359654094372 - 223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523*I},
{x1: 6.685918535164614 - 113.2918302698741*I,
x2: -179.359654094372 - 223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523*I},
{x1: 6.685918535164623 + 113.2918302698741*I,
x2: -179.359654094372 + 223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523*I},
{x1: -321.3551367159836 + 5445.311876550251*I,
x2: -179.359654094372 + 223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523*I}]


I tried also to use the PolynomialRing but it is failing to solve the problem.

EDIT : Here are the raw equations with the original quantities:

eq1 =w_G_a_in - K_asqrt((x1(RT_a + gL_aM_G_a)((gL_ax1)/V_a - (gL_r(x2 + x3 - L_bhS_bhrho_L))/V_r - F_riser + (RT_ax1)/(V_aM_G_a) + (RT_rrho_Lx2)/(M_G_r_t(x3 - V_rrho_L + L_bhS_bhrho_L))))/(RT_aV_a))

eq2 =K_asqrt((M_G_a((gL_ax1)/V_a + (RT_ax1)/(V_aM_G_a))((gL_ax1)/ V_a - (gL_r(x2 + x3 - L_bhS_bhrho_L))/V_r - F_riser + (RT_ax1)/(V_aM_G_a) + (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L))))/(RT_a))-(GORPI(2F_riser - P_r + gL_bhrho_L + (gL_r(x2 + x3 - L_bhS_bhrho_L))/V_r - (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L))))/(GOR + 1) - (K_ru1x2 sqrt(-((P0 + (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L)))(x2 + x3 - L_bhS_bh*rho_L))/V_r))/(x2 + x3)

eq3 =PI(GOR/(GOR + 1) - 1)(2F_riser - P_r + gL_bhrho_L + (gL_r(x2 + x3 - L_bhS_bhrho_L))/V_r - (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L))) - (K_ru1x3sqrt(-((P0 + (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L)))(x2 + x3 - L_bhS_bh*rho_L))/V_r))/(x2 + x3)

### Solve a system of polynomial equations - getting different results using Symbolic Math Toolbox of MATLAB and Sage

I am trying to solve the following system of equations:

eq1 = 0.8 - 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5 *x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))

eq2 = (-0.00117574932506308*x2*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863)) + 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5*x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))*(x2 + x3))/(x2 + x3)

eq3 = (0.007585843252*x2*(x2 + x3) - 0.00117574932506308*x3*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863))*(2.19736842105263e-5*x3 - 0.378721571752863) + (x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863)*(-0.00198227251415259*x2 - 0.00198227251415259*x3 + 42.4521708776886))/((x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863))


When I use Symbolic Math Toolbox in Matlab through the following command:

[x1_bar,x2_bar,x3_bar] = solve(eqs,[x1,x2,x3], 'MaxDegree',4);


we get the following results:

x1_bar
ans =

1.0e+04 *

-0.0116 + 0.0000i
0.5338 + 0.0000i
-0.0232 + 0.0000i
0.2669 + 0.0000i
-0.0047 + 0.0000i
1.3191 + 0.0000i
-0.0321 - 0.5445i
0.0007 - 0.0113i
-0.0321 + 0.5445i
0.0007 + 0.0113i
-0.0012 + 0.0000i
5.1569 + 0.0000i

x2_bar =
1.0e+03 *

1.9653 + 0.0000i
1.9653 + 0.0000i
0.2480 + 0.0000i
0.2480 + 0.0000i
-0.6495 + 0.0000i
-0.6495 + 0.0000i
-0.1794 + 0.2236i
-0.1794 + 0.2236i
-0.1794 - 0.2236i
-0.1794 - 0.2236i
-0.0393 + 0.0000i
-0.0393 + 0.0000i

x3_bar =
1.0e+04 *

-0.0174 + 0.0000i
-0.0174 + 0.0000i
0.6522 + 0.0000i
0.6522 + 0.0000i
4.8817 + 0.0000i
4.8817 + 0.0000i
0.2382 + 2.1159i
0.2382 + 2.1159i
0.2382 - 2.1159i
0.2382 - 2.1159i
1.7273 + 0.0000i
1.7273 + 0.0000i


When I try to solve this problem with Sage using:

S = solve([eq1,eq2,eq3],x1,x2,x3)


I obtain the following results:

[{x1: -321.3551367159828 - 5445.311876550251*I,
x2: -179.359654094372 - 223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523*I},
{x1: 6.685918535164614 - 113.2918302698741*I,
x2: -179.359654094372 - 223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523*I},
{x1: 6.685918535164623 + 113.2918302698741*I,
x2: -179.359654094372 + 223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523*I},
{x1: -321.3551367159836 + 5445.311876550251*I,
x2: -179.359654094372 + 223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523*I}]


I tried also to use the PolynomialRing but it is failing to solve the problem.

EDIT : Here are the raw equations with the original quantities:

eq1 =w_G_a_in - K_asqrt((x1(RT_a + gL_aM_G_a)((gL_ax1)/V_a - (gL_r(x2 + x3 - L_bhS_bhrho_L))/V_r - F_riser + (RT_ax1)/(V_aM_G_a) + (RT_rrho_Lx2)/(M_G_r_t(x3 - V_rrho_L + L_bhS_bhrho_L))))/(RT_aV_a))

eq2 =K_asqrt((M_G_a((gL_ax1)/V_a + (RT_ax1)/(V_aM_G_a))((gL_ax1)/ V_a - (gL_r(x2 + x3 - L_bhS_bhrho_L))/V_r - F_riser + (RT_ax1)/(V_aM_G_a) + (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L))))/(RT_a))-(GORPI(2F_riser - P_r + gL_bhrho_L + (gL_r(x2 + x3 - L_bhS_bhrho_L))/V_r - (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L))))/(GOR + 1) - (K_ru1x2 sqrt(-((P0 + (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L)))(x2 + x3 - L_bhS_bh*rho_L))/V_r))/(x2 + x3)

eq3 =PI(GOR/(GOR + 1) - 1)(2F_riser - P_r + gL_bhrho_L + (gL_r(x2 + x3 - L_bhS_bhrho_L))/V_r - (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L))) - (K_ru1x3sqrt(-((P0 + (RT_rx2)/(M_G_r_t(L_bhS_bh - V_r + x3/rho_L)))(x2 + x3 - L_bhS_bh*rho_L))/V_r))/(x2 + x3)

### Solve a system of polynomial equations - getting different results using Symbolic Math Toolbox of MATLAB and Sage

I am trying to solve the following system of equations:

eq1 = 0.8 - 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5 *x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))

eq2 = (-0.00117574932506308*x2*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863)) + 1.8352657742116e-5*sqrt(x1*(3071.1916*x2 + (2.19736842105263e-5*x3 - 0.378721571752863)*(3069.38078875823*x1 - 802.539479414006*x2 - 802.539479414006*x3 + 1187113.71566341))/(2.19736842105263e-5*x3 - 0.378721571752863))*(x2 + x3))/(x2 + x3)

eq3 = (0.007585843252*x2*(x2 + x3) - 0.00117574932506308*x3*sqrt(-(0.039945461792316*x2 + 0.039945461792316*x3 - 71.5306505072653)*(3071.1916*x2 + 32.9605263157895*x3 - 568082.357629294)/(2.19736842105263e-5*x3 - 0.378721571752863))*(2.19736842105263e-5*x3 - 0.378721571752863) + (x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863)*(-0.00198227251415259*x2 - 0.00198227251415259*x3 + 42.4521708776886))/((x2 + x3)*(2.19736842105263e-5*x3 - 0.378721571752863))


When I use Symbolic Math Toolbox in Matlab through the following command:

[x1_bar,x2_bar,x3_bar] = solve(eqs,[x1,x2,x3], 'MaxDegree',4);


we get the following results:

x1_bar
ans =

1.0e+04 *

-0.0116 + 0.0000i
0.5338 + 0.0000i
-0.0232 + 0.0000i
0.2669 + 0.0000i
-0.0047 + 0.0000i
1.3191 + 0.0000i
-0.0321 - 0.5445i
0.0007 - 0.0113i
-0.0321 + 0.5445i
0.0007 + 0.0113i
-0.0012 + 0.0000i
5.1569 + 0.0000i

x2_bar =
1.0e+03 *

1.9653 + 0.0000i
1.9653 + 0.0000i
0.2480 + 0.0000i
0.2480 + 0.0000i
-0.6495 + 0.0000i
-0.6495 + 0.0000i
-0.1794 + 0.2236i
-0.1794 + 0.2236i
-0.1794 - 0.2236i
-0.1794 - 0.2236i
-0.0393 + 0.0000i
-0.0393 + 0.0000i

x3_bar =
1.0e+04 *

-0.0174 + 0.0000i
-0.0174 + 0.0000i
0.6522 + 0.0000i
0.6522 + 0.0000i
4.8817 + 0.0000i
4.8817 + 0.0000i
0.2382 + 2.1159i
0.2382 + 2.1159i
0.2382 - 2.1159i
0.2382 - 2.1159i
1.7273 + 0.0000i
1.7273 + 0.0000i


When I try to solve this problem with Sage using:

S = solve([eq1,eq2,eq3],x1,x2,x3)


I obtain the following results:

[{x1: -321.3551367159828 - 5445.311876550251*I,
x2: -179.359654094372 - 223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523*I},
{x1: 6.685918535164614 - 113.2918302698741*I,
x2: -179.359654094372 - 223.5730259195566*I,
x3: 2381.999033439763 - 21159.38999334523*I},
{x1: 6.685918535164623 + 113.2918302698741*I,
x2: -179.359654094372 + 223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523*I},
{x1: -321.3551367159836 + 5445.311876550251*I,
x2: -179.359654094372 + 223.5730259195566*I,
x3: 2381.999033439763 + 21159.38999334523*I}]


I tried also to use the PolynomialRing but it is failing to solve the problem.

EDIT : Here are the raw equations with the original quantities:

eq1 =w_G_a_in - K_asqrt((x1(RT_a + gL_aM_G_a)((gL_ax1)/V_a -
(gL_r(x2 K_a*sqrt((x1*(R*T_a + g*L_a*M_G_a)*((g*L_a*x1)/V_a -
(g*L_r*(x2 + x3 - L_bhS_bhrho_L))/V_r L_bh*S_bh*rho_L))/V_r - F_riser + (RT_ax1)/(V_aM_G_a)
+ (RT_rrho_Lx2)/(M_G_r_t(x3 - V_rrho_L + L_bhS_bhrho_L))))/(RT_aV_a)) (R*T_a*x1)/(V_a*M_G_a)
+ (R*T_r*rho_L*x2)/(M_G_r_t*(x3 - V_r*rho_L + L_bh*S_bh*rho_L))))/(R*T_a*V_a))

eq2 =K_asqrt((M_G_a((gL_ax1)/V_a + (RT_ax1)/(V_aM_G_a))((gL_ax1)/
=K_a*sqrt((M_G_a*((g*L_a*x1)/V_a + (R*T_a*x1)/(V_a*M_G_a))*((g*L_a*x1)/
V_a - (gL_r(x2 (g*L_r*(x2 + x3 - L_bhS_bhrho_L))/V_r L_bh*S_bh*rho_L))/V_r - F_riser + (RT_ax1)/(V_aM_G_a)
+ (RT_rx2)/(M_G_r_t(L_bhS_bh (R*T_a*x1)/(V_a*M_G_a)
+ (R*T_r*x2)/(M_G_r_t*(L_bh*S_bh - V_r + x3/rho_L))))/(RT_a))-(GORPI(2F_riser x3/rho_L))))/(R*T_a))-(GOR*PI*(2*F_riser - P_r + gL_bhrho_L + (gL_r(x2 g*L_bh*rho_L + (g*L_r*(x2 + x3 - L_bhS_bhrho_L))/V_r
- (RT_rx2)/(M_G_r_t(L_bhS_bh L_bh*S_bh*rho_L))/V_r
- (R*T_r*x2)/(M_G_r_t*(L_bh*S_bh - V_r + x3/rho_L))))/(GOR + 1) - (K_ru1x2 (K_r*u1*x2*
sqrt(-((P0 + (RT_rx2)/(M_G_r_t(L_bhS_bh (R*T_r*x2)/(M_G_r_t*(L_bh*S_bh - V_r + x3/rho_L)))(x2 x3/rho_L)))*(x2 + x3 - L_bhS_bh*rho_L))/V_r))/(x2 + x3) L_bh*S_bh*rho_L))/V_r))/(x2 + x3)

eq3 =PI(GOR/(GOR =PI*(GOR/(GOR + 1) - 1)(2F_riser 1)*(2*F_riser - P_r + gL_bhrho_L + (gL_r(x2 g*L_bh*rho_L + (g*L_r*(x2 + x3
- L_bhS_bhrho_L))/V_r - (RT_rx2)/(M_G_r_t(L_bhS_bh L_bh*S_bh*rho_L))/V_r - (R*T_r*x2)/(M_G_r_t*(L_bh*S_bh - V_r + x3/rho_L)))
- (K_ru1x3sqrt(-((P0 + (RT_rx2)/(M_G_r_t(L_bhS_bh (K_r*u1*x3*sqrt(-((P0 + (R*T_r*x2)/(M_G_r_t*(L_bh*S_bh - V_r + x3/rho_L)))(x2 x3/rho_L)))*(x2 + x3 - L_bhS_bh*rho_L))/V_r))/(x2 + x3)L_bh*S_bh*rho_L))/V_r))/(x2 + x3)