Monday, July 25, 2016

Turning a probability vector into a state

The problem I faced was in programming a Markov chain application, I wanted to turn a probability vector into an actual state of affairs. Here is what I came up with:



This seems to do the job, but is there an easier way?

UPDATE: As soon as I looked at this again, I realized I did not need to create a map or do two loops:


1 comment:

  1. Ah, I already see I can do this in one loop: new code tonight!

    ReplyDelete

An orgy

“The advancement of science and the rationality of politics are interwoven in a social process that, in the perspective of a more distant f...