I have a system of quadratic equations defined below
nx = 1;
ny = 2;
ne = 1;
nt = 2;
n = nx + ny;
ns = 2;
For[ii = 1, ii <= ns, ii++,
G[ii] = Table[g[ii][i, j], {i, ny}, {j, nx + ne + 1}];
H[ii] = Table[h[ii][i, j], {i, nx}, {j, nx + ne + 1}];
];
eqns = {-1.1111111111111112` g[1][1,
1] + (-0.9703966865736877` + 1.` g[1][1, 1] + 0.9` g[1][2, 1] +
0.11111111111111109` g[2][1, 1] +
0.09999999999999998` g[2][2, 1]) h[1][1, 1],
10.` g[1][1, 1] -
161.` g[1][2,
1] + (143.451` g[1][2, 1] + 15.938999999999995` g[2][2, 1]) h[
1][1, 1],
0.7763173492589502` + 0.6199999999999999` g[1][2, 1] -
0.9703966865736877` h[1][1, 1], -1.1111111111111112` g[2][1,
1] + (-0.9703966865736877` + 0.11111111111111109` g[1][1, 1] +
0.09999999999999998` g[1][2, 1] + 1.` g[2][1, 1] +
0.9` g[2][2, 1]) h[2][1, 1],
10.` g[2][1, 1] -
161.` g[2][2,
1] + (15.938999999999995` g[1][2, 1] + 143.451` g[2][2, 1]) h[
2][1, 1],
0.7763173492589502` + 0.13999999999999996` g[2][2, 1] -
0.9703966865736877` h[2][1, 1]};
polys = eqns /. {0. -> 0};
This system has some structure.
First, I find the variables
vars = Variables[polys];
Deconstruct the polynomials (I know it is a quadratic system). There are 2 nonzero constant terms, 12 nonzero linear terms, and 12 nonzero 2nd-order terms
{m0, m1, m2} = CoefficientArrays[polys, vars]
Confirm the reconstructed polynomials are the same as the originals (just checking)
polys - (m0 + m1.vars + m2.vars.vars) // Expand // Chop
Of the 12 nonzero 2nd-order terms, of which there are 8 distinct cross-products ...
Flatten[Most[ArrayRules[#]] & /@ m2][[All, 1]] // Union // Length
... none of which are purely quadratic
Diagonal /@ m2 // Union
So, it is a quadratic system but nothing purely quadratic
If I apply GroebnerBasis
GBordering =
Flatten[{H[1][[1 ;; nx, 1 ;; nx]], H[2][[1 ;; nx, 1 ;; nx]],
G[1][[1 ;; ny, 1 ;; nx]], G[2][[1 ;; ny, 1 ;; nx]]}]
GB = GroebnerBasis[polys, GBordering];
GB // MatrixForm
soln = Solve[Thread[GB == 0]];
soln // MatrixForm
I get the right solutions. Anyone interested, I will send the code. But you can copy this into your computer and it will give you 9 solutions. Everything OK up to here. But if I make the system a larger (only a little)
nx = 2;
ny = 3;
ne = 1;
nt = 1;
n = nx + ny;
ns = 2;
For[ii = 1, ii <= ns, ii++,
G[ii] = Table[g[ii][i, j], {i, ny}, {j, nx + ne + 1}];
H[ii] = Table[h[ii][i, j], {i, nx}, {j, nx + ne + 1}];
];
eqns = {9.169301858525786` -
1.` g[1][3,
1] + (-19.453328842995205` + 8.169847955946475` g[1][2, 1] +
0.9077608839940525` g[2][2, 1]) h[1][1,
1] + (0.` + 8.169847955946475` g[1][2, 2] +
0.9077608839940525` g[2][2, 2]) h[1][2, 1],
0.` - 1.` g[1][3,
2] + (-19.453328842995205` + 8.169847955946475` g[1][2, 1] +
0.9077608839940525` g[2][2, 1]) h[1][1,
2] + (0.` + 8.169847955946475` g[1][2, 2] +
0.9077608839940525` g[2][2, 2]) h[1][2, 2], -1.` g[1][3,
1] + (0.` - 1.` g[1][1, 1] + 0.9` g[1][3, 1] -
0.11111111111111109` g[2][1, 1] +
0.09999999999999998` g[2][3, 1]) h[1][1,
1] + (1.0999999999999999` - 1.` g[1][1, 2] + 0.9` g[1][3, 2] -
0.11111111111111109` g[2][1, 2] +
0.09999999999999998` g[2][3, 2]) h[1][2, 1], -1.` g[1][3,
2] + (0.` - 1.` g[1][1, 1] + 0.9` g[1][3, 1] -
0.11111111111111109` g[2][1, 1] +
0.09999999999999998` g[2][3, 1]) h[1][1,
2] + (1.0999999999999999` - 1.` g[1][1, 2] + 0.9` g[1][3, 2] -
0.11111111111111109` g[2][1, 2] +
0.09999999999999998` g[2][3, 2]) h[1][2,
2], -178.88888888888889` g[1][1, 1] -
9.` g[1][3,
1] + (159.39` g[1][1, 1] + 17.709999999999994` g[2][1, 1]) h[1][
1, 1] + (159.39` g[1][1, 2] + 17.709999999999994` g[2][1, 2]) h[
1][2, 1], -178.88888888888889` g[1][1, 2] -
9.` g[1][3,
2] + (159.39` g[1][1, 1] + 17.709999999999994` g[2][1, 1]) h[1][
1, 2] + (159.39` g[1][1, 2] + 17.709999999999994` g[2][1, 2]) h[
1][2, 2],
0.` - 0.21199999999999997` g[1][1, 1] +
0.99` h[1][2, 1], -0.792` - 0.21199999999999997` g[1][1, 2] +
0.99` h[1][2, 2], 0.` + 1.` g[1][2, 1] - 1.` h[1][1, 1],
0.` + 1.` g[1][2, 2] - 1.` h[1][1, 2],
9.169301858525786` -
1.` g[2][3,
1] + (-19.453328842995205` + 0.9077608839940525` g[1][2, 1] +
8.169847955946475` g[2][2, 1]) h[2][1,
1] + (0.` + 0.9077608839940525` g[1][2, 2] +
8.169847955946475` g[2][2, 2]) h[2][2, 1],
0.` - 1.` g[2][3,
2] + (-19.453328842995205` + 0.9077608839940525` g[1][2, 1] +
8.169847955946475` g[2][2, 1]) h[2][1,
2] + (0.` + 0.9077608839940525` g[1][2, 2] +
8.169847955946475` g[2][2, 2]) h[2][2, 2], -1.` g[2][3,
1] + (0.` - 0.11111111111111109` g[1][1, 1] +
0.09999999999999998` g[1][3, 1] - 1.` g[2][1, 1] +
0.9` g[2][3, 1]) h[2][1,
1] + (1.0999999999999999` - 0.11111111111111109` g[1][1, 2] +
0.09999999999999998` g[1][3, 2] - 1.` g[2][1, 2] +
0.9` g[2][3, 2]) h[2][2, 1], -1.` g[2][3,
2] + (0.` - 0.11111111111111109` g[1][1, 1] +
0.09999999999999998` g[1][3, 1] - 1.` g[2][1, 1] +
0.9` g[2][3, 1]) h[2][1,
2] + (1.0999999999999999` - 0.11111111111111109` g[1][1, 2] +
0.09999999999999998` g[1][3, 2] - 1.` g[2][1, 2] +
0.9` g[2][3, 2]) h[2][2, 2], -178.88888888888889` g[2][1, 1] -
9.` g[2][3,
1] + (17.709999999999994` g[1][1, 1] + 159.39` g[2][1, 1]) h[2][
1, 1] + (17.709999999999994` g[1][1, 2] + 159.39` g[2][1, 2]) h[
2][2, 1], -178.88888888888889` g[2][1, 2] -
9.` g[2][3,
2] + (17.709999999999994` g[1][1, 1] + 159.39` g[2][1, 1]) h[2][
1, 2] + (17.709999999999994` g[1][1, 2] + 159.39` g[2][1, 2]) h[
2][2, 2],
0.` - 0.14799999999999996` g[2][1, 1] +
0.99` h[2][2, 1], -0.792` - 0.14799999999999996` g[2][1, 2] +
0.99` h[2][2, 2], 0.` + 1.` g[2][2, 1] - 1.` h[2][1, 1],
0.` + 1.` g[2][2, 2] - 1.` h[2][1, 2]};
polys = eqns /. {0. -> 0};
but with exactly the same structure
Find the variables
vars = Variables[polys]
Deconstruct the polynomials (I know it is a quadratic system). There are 10 nonzero constant terms, 228 nonzero linear terms, and 324 nonzero 2nd-order terms
{m0, m1, m2} = CoefficientArrays[polys, vars]
Confirm the reconstructed polynomials are the same as the originals (just checking)
polys - (m0 + m1.vars + m2.vars.vars) // Expand // Chop
Of the 324 nonzero 2nd-order terms, of which there are 180 distinct cross-products ...
Flatten[Most[ArrayRules[#]] & /@ m2][[All, 1]] // Union // Length
... none of which are purely quadratic
Diagonal /@ m2 // Union
Mathematica cannot handle it. I am not sure whether it is a problem of memory, a problem of speed or something like that. I wounder whether I could take advantage of the quadratic structure without purely quadratic components to simplify the problem and make it possible for Mathematica to handle it.

