Which formula does randNorm use?

10302017, 08:38 PM
Post: #1




Which formula does randNorm use?
According to Wikipedia, the "BoxMuller method" for generating random values which are "normally" distributed (that is, fitting the "normal" curve, AKA the bell curve) is this: generate two uniformly random numbers between 0 and 1 (e.g. two outputs from Prime's RANDOM function), call them \(U\) and \(V\), then plug them into this formula:
\({\sqrt {2\ln U}}\cdot\cos(2\pi V)\) This returns random numbers which are normally distributed around 0 with a standard deviation of 1. Plot a bunch of them and you'll see a nice bell curve. Of course, if you need normally distributed random numbers centered around a mean of \(M\) with a standard deviation of \(S\), you take the above result and simply stretch it by a factor of \(S\), then shift it up by \(M\), like this: \(M+S\cdot{\sqrt {2\ln U}}\cdot\cos(2\pi V)\) However, I'm puzzled why the "BoxMuller method" uses \(2\pi\) instead of just \(\pi\). Since the range of \(\cos(2\pi V)\) is the same as the range of \(\cos(\pi V)\), it seems to me that multiplying by 2 here is mathematically redundant. The reason I'm even bringing this up is that all the programs (for older HP calculator models) which input \(M\) and \(S\) and return \(randNorm(M,S)\) do NOT multiply by 2. They simply use this formula (notice it's just \(\pi\), not \(2\pi\)): \(M+S\cdot{\sqrt {2\ln U}}\cdot\cos(\pi V)\) Which leads to these questions: 1. Am I right that multiplying by 2 is unnecessary and may be omitted? 1a. If Yes, then why does everybody say that the BoxMuller method needs \(2\pi\)? 2. What formula does the randNorm function in the HP Prime use? 2a. If it uses BoxMuller with \(2\pi\), why is the 2 in there? X<> c Joe 

10302017, 09:11 PM
Post: #2




RE: Which formula does randNorm use?
The CAS code for randNorm is
Code:


10302017, 11:10 PM
Post: #3




RE: Which formula does randNorm use?
Thanks for answering questions 2 and 2a, Bernard! If any of y'all can answer questions 1 and 1a, I'd be most grateful.
X<> c Joe 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)