CombinatorialCase000/100: Difference between revisions

From NARS2000
Jump to navigationJump to search
(Created page with "<apll>L</apll> Pigeons into <apll>R</apll> holes Cases '''000''' and '''100''' are both trivial. * <apll>L</apll> unlabeled (0) or labeled (1) balls into <apll>R</apll> unla...")
 
No edit summary
Line 4: Line 4:


* <apll>L</apll> unlabeled (0) or labeled (1) balls into <apll>R</apll> unlabeled boxes (0), at most one per box (0)
* <apll>L</apll> unlabeled (0) or labeled (1) balls into <apll>R</apll> unlabeled boxes (0), at most one per box (0)
* Not ⎕IO-sensitive
* Not <apll>⎕IO</apll>-sensitive
* Counted result is a Boolean scalar
* Counted result is a Boolean scalar
* Generated result is a Boolean matrix.
* Generated result is a Boolean matrix.

Revision as of 13:21, 29 April 2017

L Pigeons into R holes

Cases 000 and 100 are both trivial.

  • L unlabeled (0) or labeled (1) balls into R unlabeled boxes (0), at most one per box (0)
  • Not ⎕IO-sensitive
  • Counted result is a Boolean scalar
  • Generated result is a Boolean matrix.

The count for this function is L≤R.

If L>R, then there is no answer, or more accurately, the result is an empty matrix of shape 0 R. If L≤R, then the result is a one-row matrix with L leading 1s and the rest 0s. Combining these two cases yields a result of ((L≤R) R)⍴R↑L⍴1.

For example:

If we have 3 unlabeled balls (●●●) and 5 unlabeled boxes with at most one ball per box, there is only 1 (↔ 3≤5) way to meet these criteria:

 
 
 
 
   
 
   

as well as

 
 
 
   
 
   
 

The diagram above corresponds to

      000 1‼3 5
1 1 1 0 0

      ⍝ L pigeons into R holes
      ⍝ Unlabeled balls & boxes, ≤1 #bpb
      000 1‼4 5
1 1 1 1 0