It seems to me that FixedPoint is designed to work with a particular value, but what if we want it to operate on a vector instead?

I start with an nxn matrix mat and the function:


I want to find a vector of probabilities vec={p[1], p[2], ..., p[n]} such that:


where each p[i]>0 and the sum of the p[i]'s is 1.

Is there a way to do this in general? Or let's take a specific matrix:

test={{0.5, 0.44, 0.58}, {0.56, 0.5, 0.41}, {0.42, 0.59, 0.5}}

Can I find a vector of probabilities {p1,p2,p3} that works here?

This seems like a FixedPoint type of problem, but I'd settle for any solution, like NSolve or some Module/Block. I've been puzzling over this for a while, so any help would be appreciated.

  • $\begingroup$ You can row-wise standardize the test matrix and then numerically find the convergence ergodic distribution of test by MatrixPower operation. You might want to look at Stochastic Matrix properties. $\endgroup$ – Tugrul Temel Jan 24 '20 at 16:44

FixedPoint[] works with anything, including numbers, matrices, and strings of text. As long as it can compare runs. Your problem does seem to be a fixed point problem (didn't exhaustively explore initial conditions or think it through).

 mat = {{0.5, 0.44, 0.58}, 
       {0.56, 0.5, 0.41}, 
       {0.42, 0.59, 0.5}}

f[vec_] := Exp[-vec]/Total[Exp[-vec]]

FixedPoint[f[mat.#] &, {10, 100, -10}]

(*  {0.331227, 0.336697, 0.332076}  *)
  • $\begingroup$ Thanks for the suggestion, which is so simple I'm wondering where I went wrong when I tried this. Maybe it was because I moved the matrix multiplication phase out of the FixedPoint command. $\endgroup$ – David Pepper Jan 24 '20 at 18:52

Try this:

mat = {(1/1.52)*{0.5, 0.44, 0.58}, (1/1.47)*{0.56, 0.5, 
     0.41}, (1/1.51)*{0.42, 0.59, 0.5}};
MatrixPower[mat, 100]   (*100th power*)

Multiplying each row with a constant standardizes the rows to have a stochastic matrix.

{0.32987, 0.34012, 0.33001}
  • $\begingroup$ Thanks Tugrel for the suggestion. I'll try the FixedPoint approach, but if that has trouble for any reason I'll switch over to this. $\endgroup$ – David Pepper Jan 24 '20 at 18:50

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.