Here's a tutorial on markov chains. http://flowingdata.com/2014/08/08/markov-chains-explained-visually/
Or, skipping into the meat of an example: http://setosa.io/markov/index.html We can paste in a matrix like: [[0.3,0.1,0.4,0,0.1,0.1], [0,0.3,0.1,0.4,0.1,0.1], [0.2,0.3,0.3,0.1,0.1,0], [0.3,0,0.1,0.4,0.1,0.1], [0.1,0.1,0.1,0.6,0,0.1], [0.6,0.2,0.2,0,0,0] ] It might be fun to write a routine that conditions a matrix and formats it for this kind of thing. So... here's a formatter: C=: rplc&' ,'@deb@":"1 B=: LF,~'[',']',~] A=: B@;@:(<@B@C) And here's a conditioner: D=:3 :'(+=@i.@#*1-+/"1)<.&.(*&20)(%+/"1)y' Example use: A D ?6 6$0 [[0.3,0.15,0.2,0.15,0.05,0.15] [0.25,0.1,0.2,0.25,0.05,0.15] [0.05,0.25,0.15,0.05,0.25,0.25] [0.25,0,0.3,0.3,0,0.15] [0.35,0.35,0.05,0,0.2,0.05] [0.3,0.2,0.2,0,0,0.3] ] But this approach has an ugliness in it: A D i.5 5 [[_2.22045e_16,0.1,0.2,0.3,0.4] [0.1,0.25,0.2,0.2,0.25] [0.15,0.15,0.3,0.2,0.2] [0.15,0.15,0.2,0.3,0.2] [0.15,0.15,0.2,0.2,0.3] ] There's a simple fix for this (4 characters added to the above code can make the first element of the 5 by 5 matrix be zero), but there might be a better way? Ideas? Thanks, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
