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

Zeno for the computer age

If you wish to better understand Zeno's worry about the continuum, you could do worse than to consider loops in software. Case 1: You...