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

That was a great rendition!

I was watching TV with someone the other day. The CIA was transporting a terrorist, and the flight they all were on were brought down. When...