Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce the number of independent variables in mathematica

I am not srue whether this is really a mathematical question, or actually a mathematica question. :D

suppose I have a matrix

{{4/13 + (9 w11)/13 + (6 w12)/13, 
  6/13 + (9 w21)/13 + (6 w22)/13}, {-(6/13) + (6 w11)/13 + (4 w12)/
   13, -(9/13) + (6 w21)/13 + (4 w22)/13}}

with w11, w12, w21, w22 as free parameters.

And I know by visual inspection that 3*w11+2*w12 can be represented as one variable, and 3*w21+2*w22 can be represented as another. So essentially this matrix only has two independent variables. Given any matrix of this form, is there any method to automatically reduce the number of independent variables? I guess I am stuck at formulating this in a precise mathematical way.

Please share your thoughts. Many thanks.

Edit:

My question is really the following. Given matrix like this

{{4/13 + (9 w11)/13 + (6 w12)/13, 
  6/13 + (9 w21)/13 + (6 w22)/13}, {-(6/13) + (6 w11)/13 + (4 w12)/
   13, -(9/13) + (6 w21)/13 + (4 w22)/13}}

or involving some other symbolical constants

{{a+4/13 + (9 w11)/13 + (6 w12)/13, 
  6/13*c + (9 w21)/13 + (6 w22)/13}, {-(6/13)/d + (6 w11)/13 + (4 w12)/
   13, -(9/13) + (6 w21)/13 + (4 w22)/13}}

I want to use mathematica to automatically identify the number n of independent variables (in this case is 2), and then name these independent varirables y1, y2, ..., yn, and then re-write the matrix in terms of y1, y2, ..., yn instead of w11, w12, w21, w22.

like image 419
Qiang Li Avatar asked Feb 15 '11 19:02

Qiang Li


1 Answers

Starting with

mat = {{4/13 + (9 w11)/13 + (6 w12)/13,6/13 + (9 w21)/13 + (6 w22)/13},
  {-(6/13) + (6 w11)/13 + (4 w12)/13, -(9/13) + (6 w21)/13 + (4 w22)/13}};

Form a second matrix, of indeterminates, same dimensions.

mat2 = Array[y, Dimensions[mat]];

Now consider the polynomial (actually linear) system formed by setting mat-mat2==0. We can eliminate the original variables and look for dependencies amongst the new ones. Could use Eliminate; I'll show with GroebnerBasis.

GroebnerBasis[Flatten[mat - mat2], Variables[mat2], Variables[mat]]

Out[59]= {-3 + 2 y[1, 2] - 3 y[2, 2], -2 + 2 y[1, 1] - 3 y[2, 1]}

So we get a pair of explicit relations between the original matrix elements.

---edit---

You can get expressions for the new variables that clearly indicates the dependency of two of them on the other two. To do this, form the Groebner basis and use it in polynomial reduction.

gb = GroebnerBasis[Flatten[mat - mat2], Variables[mat2], Variables[mat]];
vars = Flatten[mat2];

PolynomialReduce[vars, gb, vars][[All, 2]]

Out[278]= {1 + 3/2 y[2, 1], 3/2 + 3/2 y[2, 2], y[2, 1], y[2, 2]}

---end edit---

Daniel Lichtblau Wolfram Research

like image 54
Daniel Lichtblau Avatar answered Nov 16 '22 10:11

Daniel Lichtblau