## ! Binomial

Two-argument form See also one-argument form Factorial or Gamma function

In its two-argument form, with positive arguments, ! tells you how many different ways there are of selecting the number of items specified on the left from the population of items specified on the right. The order of items in each pair is ignored. So if the population of four consisted of the letters A B C D, the 6 possible combinations of 2 letters would be: AB AC AD BC BD CD. The combination BA would be regarded as the same as AB.

                 2 ! 4                   (Number of unique pairs from a population
           6                              of 4)
                 3 ! 20                  (Number of groups of three from a
           1140                           population of 20)
                 2 ! 6 12 20             (Number of pairs from a population
           15 66 190                      of 6 12 20 respectively)
                 TABLE1 „ 2 3½¼6
                 TABLE2 „ 2 3 ½ 3 6 9 12 15 18
                 TABLE1 ! TABLE2         (TABLE1 is table of group sizes, TABLE2
             3                15                84        is table of populations)
           495              3003             18564

Other cases, such as negative or non-integer arguments, are also catered for. The various results that can be obtained are:

          Left       Right     Right-Left      Result
          Argument   Argument
           +ve        +ve        +ve           (!RIGHT)÷(!LEFT)×!RIGHT-LEFT
           +ve        +ve        -ve           0
           +ve        -ve        -ve           (¯1*LEFT)×LEFT!LEFT-RIGHT+1
           -ve        +ve        +ve           0
           -ve        -ve        +ve           (¯1*RIGHT-LEFT)×(|RIGHT+1)!(|LEFT+1)
           -ve        -ve        -ve           0

Topic: APLX Help : Help on APL language : APL Primitives : ! Binomial

[ Previous | Next | Contents | Index ]