 Distinguishable and Indistinguishable eharetea

Distinguishable and Indistinguishable boxes and objects. Combinations and permutations. Placing objects into boxes.

Distinguishable and Indistinguishable boxes and objects. Combinations and permutations. Placing objects into boxes.

Date Created:Thursday October 30th, 2008 05:18 PM
Date Modified:Wednesday November 05th, 2008 12:52 AM

PERMUTATIONS
Finding permutations of objects is found by the function

where n is the number of elements to choose from and k represents the number objects in an ordered arrangement.
(define (permute n k)
(/ (factorial n) (factorial (- n k))))


COMBINATIONS

(define (choose n k)
(/ (permute n k) (factorial k)))

PLACING N DISTINGUISHABLE OBJECTS INTO K DISTINGUISHABLE BOXES

Since there is k choices for n objects:

(define (d-to-d n k)
(** k n))


PLACING N INDISTINGUISHABLE OBJECTS INTO K DISTINGUISHABLE BOXES

Since there are n balls, and k-1 walls:

(define (i-to-d n k)
(choose (+ n k (- 1)) k))


PLACING N DISTINGUISHABLE OBJECTS INTO K DISTINCT OBJECTS

in box where and

(define (d-to-d-with-rep n list-k)
(/ (factorial n) (accumulate * 1 (map (lambda (y) (factorial y)) list-k)))) 