[Audacity-nyquist] Pascal's triangle done
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: paul b. <sni...@fa...> - 2010-05-28 09:38:05
|
I tried (binomial-dist 5 .5) from the command line but got "unbound function". The graph in the document, (Fig 18) seems to be nonsense. I think this should be the output. 0.0313 0.1563 0.3125 0.3125 0.1563 0.0313 -------------- Sub bn0() p = 0.5: q = 1# - p Cells(1, 2) = q ^ 5 Cells(2, 2) = 5 * q ^ 4 * p Cells(3, 2) = 10 * q ^ 3 * p ^ 2 Cells(4, 2) = 10 * q ^ 2 * p ^ 3 Cells(5, 1) = 0.01: Cells(5, 2) = 5 * q * p ^ 4 Cells(6, 1) = 0.012: Cells(6, 2) = p ^ 5 End Sub > Are you refering to the probability distribution? Here's the code from > lib/distributions.lsp: > > (defun bernoulli-dist (px1 &optional (x1 1) (x2 0)) > (let ((u (rrandom))) > (if (< u px1) x1 x2))) > > (defun binomial-dist (n p) > (let ((suc 0)) > (dotimes (count n suc) > (setf suc (+ suc (bernoulli-dist p)))))) > > -Roger > > > > http://mathworld.wolfram.com/BinomialDistribution.html > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Audacity-nyquist mailing list > Aud...@li... > https://lists.sourceforge.net/lists/listinfo/audacity-nyquist -- paul beach sni...@fa... |