0
$\begingroup$

I am trying to solve a system of equations based on a matrix in order to find the "stationary" matrix. the code I've written should break the matrix down into a system of equations such that some matrix "s" does the following s*p=s And it works great with any matrix except an absorbing one. What seems to be happening is that when it sees the equation x[1]=x[1] it just replaces it with "true" and then the solver loses one of the equations needed to actually solve it.

My current code is

P = ( {
    {1, 0, 0},
    {0, 1, 0},
    {.2, .4, .4}
   } );
round = .01;

Table[Array[x, Length[P]].Part[P, i] == 
  Part[Array[x, Length[P]], i], {i, 1, Length[P]}]

Solve[Union[
  Table[Array[x, Length[P]].Part[P, i] == 
    Part[Array[x, Length[P]], i], {i, 1, Length[P]}],
  {Total[Array[x, Length[P]]] == 1}]]

which gives the following results

{True, True, 0.2 x[1] + 0.4 x[2] + 0.4 x[3] == x[3]}
{{x[2] -> 0.6 - 0.8 x[1], x[3] -> 0.4 - 0.2 x[1]}}

So if anyone has any advice on how to keep the "true" part of the code from happening, (or point out that's not my real problem) I would much appreciate the advice.

$\endgroup$
1
  • 1
    $\begingroup$ This means that your system of equations is underdetermined, and some variables (like x[1] in this case) can have any value and still satisfy the equations. $\endgroup$
    – Roman
    Apr 25, 2019 at 6:00

1 Answer 1

3
$\begingroup$

Why not use the following:

sol = Solve[Array[x, {3,3}] . P == Array[x, {3,3}], Flatten[Array[x, {3,3}]]]

Solve::svars: Equations may not give solutions for all "solve" variables.

{{x[1, 3] -> 0., x[2, 3] -> 0., x[3, 3] -> 0.}}

Then your solution is:

r = Array[x, {3,3}] /. sol[[1]]

{{x[1, 1], x[1, 2], 0.}, {x[2, 1], x[2, 2], 0.}, {x[3, 1], x[3, 2], 0.}}

Check:

r . P == r //Chop

True

In other words, there are 6 free parameters.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.