Click here to Skip to main content
15,891,136 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionRandom Number Generation Pin
BobInNJ5-Nov-08 13:47
BobInNJ5-Nov-08 13:47 
AnswerRe: Random Number Generation Pin
73Zeppelin5-Nov-08 21:36
73Zeppelin5-Nov-08 21:36 
GeneralRe: Random Number Generation Pin
BobInNJ6-Nov-08 6:29
BobInNJ6-Nov-08 6:29 
GeneralRe: Random Number Generation Pin
73Zeppelin6-Nov-08 8:28
73Zeppelin6-Nov-08 8:28 
GeneralRe: Random Number Generation Pin
BobInNJ6-Nov-08 9:56
BobInNJ6-Nov-08 9:56 
GeneralRe: Random Number Generation Pin
73Zeppelin6-Nov-08 10:21
73Zeppelin6-Nov-08 10:21 
GeneralRe: Random Number Generation Pin
BobInNJ6-Nov-08 12:51
BobInNJ6-Nov-08 12:51 
GeneralRe: Random Number Generation [modified] Pin
73Zeppelin6-Nov-08 20:50
73Zeppelin6-Nov-08 20:50 
Yes, this will work. To be perfectly clear, this method will work if the random numbers you are generating are being drawn from a normal/Gaussian distribution with mean 0 and variance 1. Bear in mind that as a result of the law of large numbers[^] you will probably require a large number of samples to get close to the mean and variance that you want. I would suggest a minimum of 1000 samples and go up from there. Also, if you want the variance to be, say, 0.3 then you have to multiply (a normal variable with mean 0 and variance 1) by the square root of 0.3.

To summarize, if U is your Cholesky factor, and X is distributed as a normal variable with mean zero and covariance matrix I (the identity) then:

U*X is distributed as normal with mean zero and covariance matrix C.

Also, if you want a normal variable Z with mean m and covariance matrix C then Z = m + U*X where X is normal with mean 0 and variance-covariance matrix I (the identity). To change the variance of a given column of X, simply multiply that column by the square root of the variance you want to use. Since these are linear transformations, they will also preserve your correlation structure.

modified on Friday, November 7, 2008 2:58 AM

QuestionRecords and Clusters [modified] Pin
DQNOK5-Nov-08 4:40
professionalDQNOK5-Nov-08 4:40 
AnswerRe: Records and Clusters Pin
Member 41945935-Nov-08 6:28
Member 41945935-Nov-08 6:28 
GeneralRe: Records and Clusters Pin
DQNOK5-Nov-08 6:56
professionalDQNOK5-Nov-08 6:56 
GeneralRe: Records and Clusters Pin
Member 41945935-Nov-08 7:44
Member 41945935-Nov-08 7:44 
GeneralRe: Records and Clusters Pin
DQNOK6-Nov-08 4:54
professionalDQNOK6-Nov-08 4:54 
GeneralRe: Records and Clusters Pin
Member 41945936-Nov-08 7:57
Member 41945936-Nov-08 7:57 
GeneralRe: Records and Clusters Pin
Member 419459325-Apr-09 4:28
Member 419459325-Apr-09 4:28 
GeneralRe: Records and Clusters Pin
DQNOK27-Apr-09 3:13
professionalDQNOK27-Apr-09 3:13 
GeneralRe: Records and Clusters Pin
DQNOK27-Apr-09 5:57
professionalDQNOK27-Apr-09 5:57 
GeneralRe: Records and Clusters Pin
Member 419459327-Apr-09 11:22
Member 419459327-Apr-09 11:22 
QuestionRePosted from C# Forums: A Job Exam Question Pin
Bulky Fellow4-Nov-08 20:31
Bulky Fellow4-Nov-08 20:31 
AnswerRe: RePosted from C# Forums: A Job Exam Question Pin
Arash Partow4-Nov-08 21:59
Arash Partow4-Nov-08 21:59 
AnswerRe: RePosted from C# Forums: A Job Exam Question Pin
Mark Churchill5-Nov-08 1:46
Mark Churchill5-Nov-08 1:46 
GeneralRe: RePosted from C# Forums: A Job Exam Question Pin
riced9-Nov-08 4:03
riced9-Nov-08 4:03 
GeneralRe: RePosted from C# Forums: A Job Exam Question Pin
Bulky Fellow9-Nov-08 7:45
Bulky Fellow9-Nov-08 7:45 
GeneralRe: RePosted from C# Forums: A Job Exam Question Pin
Mark Churchill9-Nov-08 11:33
Mark Churchill9-Nov-08 11:33 
QuestionTrammel method for constructing an ellipse Pin
hxhl9525-Oct-08 19:38
hxhl9525-Oct-08 19:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.