0
$\begingroup$

I don't know why I can't solve this system of equations in Mathematica. I just want to find $p_{i,j}$ terms that satisfy $\pi_0 * P^3 = \pi_1$, as seen here. But I'm getting an error that this isn't a quantified system...

Can someone help me figure out how to get this to run?

enter image description here

enter image description here

$\endgroup$
  • 1
    $\begingroup$ With four equations you can only solve for four variables. I recommend that you use indexed variables rather than subscripts. You can format the indexed variables to display with subscripts on output. $\endgroup$ – Bob Hanlon Sep 30 at 18:46
1
$\begingroup$
P = Array[Subscript[p, ##] &, {4, 4}];
Subscript[π, 0] = {1, 0, 0, 0};
Subscript[π, 1] = {0, 0, 0, 1};
sols = FindInstance[Thread[Subscript[π, 0].MatrixPower[P, 3] == Subscript[π, 1]], Flatten[P], Integers, 1][[1]];
P /. sols // MatrixForm

enter image description here

Subscript[π, 0].MatrixPower[P, 3] - Subscript[π, 1] /. sols

{0, 0, 0, 0}

$\endgroup$
1
$\begingroup$

If the variable space is limited as shown by the one solution, then another possible solution may be had using the following:

ClearAll[p, P, pi0, pi1, myVars, myConstraints, allEquations, solutions]
P = Array[p, {4, 4}];
pi0 = {1, 0, 0, 0};
pi1 = {0, 0, 0, 1};
myVars = Flatten[P];
myConstraints = Flatten[{# <= 1, # >= 0} & /@ myVars];
allEquations = And @@ Flatten[{pi0.P.P.P == pi1, myConstraints}];
solutions = Solve[allEquations, myVars, Integers];

This gives 704 solutions to the equation above and I have confirmed that the one presented by Suba Thomas is one of these.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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