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 19:21:33 +0200

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 19:46:04 +0200

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 16:08:10 +0200 )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 23:03:44 +0200 )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 19:21:33 +0200

Seen: 665 times

Last updated: Jul 24 '14