A_index is the loop index (1,2,3...), concatenated with a tab ...
Bell curve?
Started by
Thor
, Apr 25 2008 08:19 PM
25 replies to this topic
#16

Posted 27 April 2008  01:30 AM
one more thing what does the "float" mean
Edit:just saw your post thank you
Edit:just saw your post thank you
#17

Posted 27 April 2008  01:37 AM
In
SetFormat, Float, 4.2it specifies the format of floating point numbers.
#18

Posted 27 April 2008  01:40 AM
thank you again I just found my answer I really wasn't sure what Float was here is the Definition I found I love learning.. : )
float True if var is nonempty and contains a floating point number; that is, a purely numeric string containing a decimal point. Leading and trailing spaces and tabs are allowed. The string may start with a plus sign, minus sign, or decimal point.
#19

Posted 27 April 2008  01:46 AM
That is in case of
If var is [not] typeHere Float is used in SetFormat. Another place in the Help...
#20

Posted 27 April 2008  02:08 AM
The bell curve works great. Just want to say thanks again!
#21

Posted 27 April 2008  11:58 AM
Here is an alternative:
Loop 9 { Random x, 0, 1. MsgBox % ErfInv9(x) } ErfInv9(p) { ; 1.15e9 accurate approximation of the inverse error function Static a1 := 3.969683028665376e+01, a2 := 2.209460984245205e+02, a3 := 2.759285104469687e+02 , a4 := 1.383577518672690e+02, a5 := 3.066479806614716e+01, a6 := 2.506628277459239e+00 , b1 := 5.447609879822406e+01, b2 := 1.615858368580409e+02, b3 := 1.556989798598866e+02 , b4 := 6.680131188771972e+01, b5 := 1.328068155288572e+01 , c1 := 7.784894002430293e03, c2 := 3.223964580411365e01, c3 := 2.400758277161838e+00 , c4 := 2.549732539343734e+00, c5 := 4.374664141464968e+00, c6 := 2.938163982698783e+00 , d1 := 7.784695709041462e03, d2 := 3.224671290700398e01 , d3 := 2.445134137142996e+00, d4 := 3.754408661907416e+00 if (p <= 0 or p >= 1) Return if (p < 0.02425) { q := sqrt(2*ln(p)) Return % (((((c1*q+c2)*q+c3)*q+c4)*q+c5)*q+c6) / ((((d1*q+d2)*q+d3)*q+d4)*q+1) } if (0.97575 < p) { q := sqrt(2*ln(1p)) Return % (((((c1*q+c2)*q+c3)*q+c4)*q+c5)*q+c6) / ((((d1*q+d2)*q+d3)*q+d4)*q+1) } q := p  0.5 r := q*q Return % (((((a1*r+a2)*r+a3)*r+a4)*r+a5)*r+a6)*q / (((((b1*r+b2)*r+b3)*r+b4)*r+b5)*r+1) }The ErfInv9() function transforms a [0,1] real uniform random variable to one of standard normal distribution. It is fast, performing only a dozen multiplications, divisions, and the relative error is so small, that no practical application would see a difference. It was adapted from Peter J. Acklamâ€™s work. (5% of the time it also calls the sqrt and log function.)
#22

Posted 27 April 2008  04:31 PM
img
Don't worry. Laszlo is our resident math geek. (There are others as well). You can trust that his function is properly researched and works as planned. It actually looks pretty cool. And when he says it is fast, he means it.
You will note that I called my method the Brute force way.
#24

Posted 27 April 2008  11:10 PM
Lazlo, your function has worked great for me! It is very useful!
Is it possible to add an option to make the function asymmetric around the center? To make it fall more quickly on one side and phase out more slowly on the other?
The function is great as it is. With this addition I would have even more use of it.
Hope it is possible. Thanks!
Is it possible to add an option to make the function asymmetric around the center? To make it fall more quickly on one side and phase out more slowly on the other?
The function is great as it is. With this addition I would have even more use of it.
Hope it is possible. Thanks!
#25

Posted 03 May 2008  10:35 PM
You define a probability density function, like a skewed bell curve. Its integral (from minus infinity to x) is the Cumulative distribution function, like erf(x), the error function, for the normal distribution. Finally, we need its inverse, if we want to transform uniformly distributed random samples to the desired distribution. For high accuracy it is not an easy task, and quite slow.
A rough approximation can be achieved easier. Cut the range of the distribution into intervals, and give the probability for each interval, that a sample falls there. A search loop can find the right output value pretty fast.
A rough approximation can be achieved easier. Cut the range of the distribution into intervals, and give the probability for each interval, that a sample falls there. A search loop can find the right output value pretty fast.
#26

Posted 03 May 2008  11:31 PM