Which formula does randNorm use?
|
10-30-2017, 08:38 PM
Post: #1
|
|||
|
|||
Which formula does randNorm use?
According to Wikipedia, the "Box-Muller 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 "Box-Muller 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 Box-Muller method needs \(2\pi\)? 2. What formula does the randNorm function in the HP Prime use? 2a. If it uses Box-Muller with \(2\pi\), why is the 2 in there? <0|ɸ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Which formula does randNorm use? - Joe Horn - 10-30-2017 08:38 PM
RE: Which formula does randNorm use? - parisse - 10-30-2017, 09:11 PM
RE: Which formula does randNorm use? - Joe Horn - 10-30-2017, 11:10 PM
|
User(s) browsing this thread: 1 Guest(s)