Ask Your Question

Does Sage have a function that generates a random double stochastic matrix in which the elements of each row and each column add to one?

asked 2014-07-24 12:21:33 -0500

mike gravatar image

Each element is a random probability and no elements are negative.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-07-24 12:46:04 -0500

Nathann gravatar image

There is a theorem that says that every doubly stochastic matrix is a linear combination of permutation matrices.

If you want random stochastic matrices, generate random linear combinations of permutations. See where that gets you.

It is called the Birkhoff Von Neumann theorem, by the way.

And there is this, too:


edit flag offensive delete link more


not very efficient... if you want a n x n matrix then you will need to take care of the n! permutations.

vdelecroix gravatar imagevdelecroix ( 2014-07-26 09:08:10 -0500 )edit

1) depends what you want to do with it, you may be happy with a sum of 5 matrices 2) can be implemented with 4 lines of Sage 3) better than having no way out at all 4) Advertises a cool result

Nathann gravatar imageNathann ( 2014-07-27 16:03:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2014-07-24 12:21:33 -0500

Seen: 348 times

Last updated: Jul 24 '14