=Apl2ToDoStatisticsDistributionAlgorithms =
This is a sub-page of PhraseBook/ToDo/Apl2Idioms
V←N+.×Y⌹N←X∘.*0 1 ⍝ Least squares linear fit given X,Y values.
C←Y⌹X∘.*⍳IS+1 ⍝ IS degree polynomial fit given X,Y values.
C←Y⌹X∘.*(⍳IS+1)-1 ⍝ IS degree polynomial fit given X,Y values.
N←(,['']NA)⊥⌽N ⍝ Eval. asc. ord. N-coeff poly. at points NA.
N←(,['']NA)⊥N ⍝ Eval. dec. ord. N-coeff poly. at points NA.
C←K!N ⍝ Combinations of N things taken K ways.
M←⌽(K=+⌿M)/M←(N⍴2)⊤⍳1+2⊥N↑K⍴1 ⍝ Binary matrix of (N,K) combinations.
I←⍋N ⍝ Inverting a permutation.
NS←(!K)×K!N ⍝ Number of permutations of (N,K) combinations.
M←(<⌿M)/M←(2,IS*2)⍴(,⍉M),,M←IS IS⍴1+⍳IS ⍝ All possible pairs of 1 through IS.
M←(<⌿M)/M←(2,IS*2)⍴(,⍉M),,M←IS IS⍴⍳IS ⍝ All possible pairs of 1 through IS.
M←(^⌿2<⌿M)/M←1+((-K)↑⍳N+1)⊤⍳(!K)×K!N ⍝ Numeric matrix of (N,K) combinations.
M←(^⌿2<⌿M)/M←1+((-K)↑⍳N)⊤⍳(!K)×K!N ⍝ Numeric matrix of (N,K) combinations.
M←⍉(⍳1+IS)∘.!⍳1+IS ⍝ Binomial coefficients from 1-IS.
M←⍉(0,⍳IS)∘.!0,⍳IS ⍝ Binomial coefficients from 1-IS.
N←(N!X)×(Y*N)×(1-Y)*X-N←⍳X+1 ⍝ Binomial distribution of X trials at prob. Y.
N←(N!X)×(Y*N)×(1-Y)*X-N←¯1+⍳X+1 ⍝ Binomial distribution of X trials at prob. Y.
N←(⍳1+IS)!IS ⍝ Coefficients of the binomial.
N←(0,⍳IS)!IS ⍝ Coefficients of the binomial.
N←÷Y×(X-1)!Y×X-1 ⍝ Beta function.
N←!N-1 ⍝ Gamma function.
N←(*-Y)×(Y*X)÷!X ⍝ Poisson distribution of states X and Y avg.
M←÷1+(⍳IS)∘.+⍳IS ⍝ Hilbert matrix of order IS.
M←÷¯1+(⍳IS)∘.+⍳IS ⍝ Hilbert matrix of order IS.
V←V∘.!V←⍳IS+1 ⍝ Pascal's triangle of order IS.
V←V∘.!V←0,⍳IS ⍝ Pascal's triangle of order IS.
N←+/Y×(X*N)÷!N←⍳⍴Y ⍝ Taylor series at point X, coefficients Y.
N←+/Y×(X*N)÷!N←¯1+⍳⍴Y ⍝ Taylor series at point X, coefficients Y.
CA←' *'[BA] ⍝ Plotting a curve from boolean values.
CA←' *'[1+BA] ⍝ Plotting a curve from boolean values.
CM←⊃(⌊N)⍴¨'*' ⍝ Create a histogram from numeric vector.
APL Wiki