Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Generate random numbers with fixed sum and different constraints
Replies: 25   Last Post: Sep 17, 2013 2:28 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Roger Stafford

Posts: 5,885
Registered: 12/7/04
Re: Generate random numbers with fixed sum and different constraints
Posted: Nov 19, 2012 6:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <k8dakj$39u$1@newscl01ah.mathworks.com>...
> It seems to me this task
> w = randfixedsum(m,n,1,0,1)
> can be optimized as well. .....

- - - - - - - - -
Yes, I agree, Bruno; 'randfixedsum' is rather cumbersome to use just for a single simplex. How about this instead:

R = bsxfun(@power,rand(m-1,n),1./(m-1:-1:1)');
X = cumprod([ones(1,n);R]).*[ones(m,n)-[R;zeros(1,n)]];

Roger Stafford


Date Subject Author
11/14/12
Read Generate random numbers with fixed sum and different constraints
Dmitrey Yershov
11/17/12
Read Re: Generate random numbers with fixed sum and different constraints
Greg Heath
11/17/12
Read Re: Generate random numbers with fixed sum and different constraints
Roger Stafford
11/17/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/17/12
Read Re: Generate random numbers with fixed sum and different constraints
Roger Stafford
11/18/12
Read Re: Generate random numbers with fixed sum and different constraints
Dmitrey Yershov
11/18/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/19/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/19/12
Read Re: Generate random numbers with fixed sum and different constraints
Dmitrey Yershov
11/19/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/19/12
Read Re: Generate random numbers with fixed sum and different constraints
Dmitrey Yershov
11/19/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/19/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/19/12
Read Re: Generate random numbers with fixed sum and different constraints
Roger Stafford
11/20/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/20/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/20/12
Read Re: Generate random numbers with fixed sum and different constraints
Roger Stafford
11/21/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/21/12
Read Re: Generate random numbers with fixed sum and different constraints
james bejon
11/20/12
Read Re: Generate random numbers with fixed sum and different constraints
james bejon
9/17/13
Read Re: Generate random numbers with fixed sum and different constraints
JS Hong
9/17/13
Read Re: Generate random numbers with fixed sum and different constraints
JS Hong
11/19/12
Read Re: Generate random numbers with fixed sum and different constraints
David Epstein
11/19/12
Read Re: Generate random numbers with fixed sum and different constraints
Roger Stafford
11/20/12
Read Re: Generate random numbers with fixed sum and different constraints
Bruno Luong
11/17/12
Read Re: Generate random numbers with fixed sum and different constraints
Greg Heath

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.