## [Audacity-nyquist] Permutations plug-in

 [Audacity-nyquist] Permutations plug-in From: paul beach - 2010-06-01 01:25:37 ```Figure 18 is a (random)data set. Toss five pennies, and count the number of heads. Do this 100 times. This cannot represent dice, a multinomial distribution is required. If started up transients are somewhat-random distributions, then steady-state should be the exact distribution. (I think that's part of the reason for all those randon algorithms.) To get things started, I have a plug-in for Permutations. Comments, naughty or nice, are welcome. ;nyquist plug-in ;version 1 ;type generate ;name "Permutations..." ;action "Same ..." ;control n "numerator" int "find n!" 10 1 20 ;control r "denominator" int "find (r-n)!" 4 1 20 ;info " Permutations by Paul Beach. \n Example: How many ways can 10 people be seated in 4 chairs? \n Answer: 5040 different ways." ; Find number of permutations nPr ; Warning! Integer overflow at 15! or 14P1 ; find n!, 10! = 10 x 9 x 8 .... x 1 (setf f 1) (defun fact (n) (dotimes (i n)(setf f (* f (+ i 1) ) ) ) ) ; numerator, num = n! (fact n) (setf num f) ; denominator, den = (n - r)! (setf f 1) (fact (- n r)) (setf den f) ; nPr = n! / (n - r)! (print (/ num den)) -- paul beach sniffyraven@... ```