I've written a function that returns the steady state given a regular, column-stochastic matrix. I want to use it to solve a larger problem, finding steady states that satisfy certain conditions.
The function seems to work fine on its own. But not as part of the larger problem.
Here's the function definition:
SteadyState[M_] :=
First[Eigenvectors[M]] / Total[First[Eigenvectors[M]]]
Used on its own it seems to work well, e.g.:
SteadyState[
{{1/2, 1/2},
{1/2, 1/2}}
]
returns {1/2, 1/2}
as it should.
But when I try to use it inside of Solve
, it doesn't behave as expected. For example:
Solve[
SteadyState[
{{c11, c12},
{c21, c22}}
] == {q1, q2} &&
q1 >= 0 && q2 >= 0 &&
q1 + q2 == 1 &&
c11 >= 0 && c12 >= 0 && c21 >= 0 && c22 >= 0 &&
c11 + c21 == 1 &&
c12 + c22 == 1 &&
c11 == 1/2 && c12 == 1/2 && q1 == 1/2 && q2 == 1/2,
{q1, q2, c11, c12, c21, c22},
Reals
]
Returns the empty set of solutions {}
, even though I've effectively handed it the solution in the last two constraints!
Could this be because my SteadyState
function doesn't check that the input is regular and column stochastic? If so, why? And what would be a good way to rectify that?
Solve[SteadyState[{{c11, c12}, {1 - c11, 1 - c12}}] == {q1, 1 - q1}, {c11, c12}]
gives an answer. $\endgroup$