Safe Haskell | None |
---|
Symetric Group S4 as related to the composition "Nomos Alpha" by Iannis Xenakis. In particular in relation to the discussion in "Towards a Philosophy of Music", Formalized Music pp. 219 -- 221
- data Label
- type Half_Seq = [Int]
- type Seq = [Int]
- complement :: Half_Seq -> Half_Seq
- full_seq :: Half_Seq -> Seq
- lower :: Half_Seq -> Half_Seq
- l_on :: Label -> Label -> Label
- seq_of :: Label -> Seq
- half_seq_of :: Label -> Seq
- half_seq :: Seq -> Half_Seq
- reverse_lookup :: Eq a => a -> [(b, a)] -> Maybe b
- label_of :: Seq -> Label
- complementary :: Half_Seq -> Half_Seq -> Bool
- type Rel = (Bool, Permute)
- relate :: Half_Seq -> Half_Seq -> Rel
- relate_l :: Label -> Label -> Rel
- relations :: [Half_Seq] -> [Rel]
- relations_l :: [Label] -> [Rel]
- apply_relation :: Rel -> Half_Seq -> Half_Seq
- apply_relations :: [Rel] -> Half_Seq -> [Half_Seq]
- apply_relations_l :: [Rel] -> Label -> [Label]
- data Face
- faces :: [([Int], Face)]
- viii_6_l :: [Label]
- viii_7 :: [[Label]]
- viii_6b_l :: [Label]
- viii_6b_p' :: [Half_Seq]
- viii_6b' :: [(Label, Half_Seq)]
- viii_6b :: [(Label, Seq)]
- viii_6_relations :: [Rel]
- viii_6b_relations :: [Rel]
S4 notation
Label
s for elements of the symmetric group P4.
Initial half of Seq
(ie. #4). The complete Seq
is formed by
appending the complement
of the Half_Seq
.
complement :: Half_Seq -> Half_SeqSource
Complement of a Half_Seq
.
map complement [[4,1,3,2],[6,7,8,5]] == [[8,5,7,6],[2,3,4,1]]
lower :: Half_Seq -> Half_SeqSource
Lower Half_Seq
, ie. complement
or id
.
map lower [[4,1,3,2],[6,7,8,5]] == [[4,1,3,2],[2,3,4,1]]
l_on :: Label -> Label -> LabelSource
Application of Label
p on q.
l_on Q1 I == Q1 l_on D A == G [l_on L L,l_on E D,l_on D E] == [L2,C,B]
half_seq_of :: Label -> SeqSource
reverse_lookup :: Eq a => a -> [(b, a)] -> Maybe bSource
Reverse table lookup
.
reverse_lookup 'b' (zip [1..] ['a'..]) == Just 2 lookup 2 (zip [1..] ['a'..]) == Just 'b'
complementary :: Half_Seq -> Half_Seq -> BoolSource
Rel
type Rel = (Bool, Permute)Source
Relation between to Half_Seq
values as a
(complementary,permutation) pair.
relations_l :: [Label] -> [Rel]Source
apply_relation :: Rel -> Half_Seq -> Half_SeqSource
apply_relations_l :: [Rel] -> Label -> [Label]Source
Variant of apply_relations
.
apply_relations_l (relations_l [L2,L,A,Q1]) L2 == [L2,L,A,Q1]
Face
Enumeration of set of faces of a cube.
faces :: [([Int], Face)]Source
Table indicating set of faces of cubes as drawn in Fig. VIII-6 (p.220).
lookup [1,4,6,7] faces == Just F_Left reverse_lookup F_Right faces == Just [2,3,5,8]
Figures
Fig. VIII-6. Hexahedral (Octahedral) Group (p. 220)
length viii_6_l == 24 take 7 viii_6_l == [L2,L,A,Q1,Q7,Q3,Q9]
Fig. VIII-7 (p.221)
map (take 4) (take 4 viii_7) == [[I,A,B,C] ,[A,I,C,B] ,[B,C,I,A] ,[C,B,A,I]]
Fig. VIII-6/b Labels
(p.221)
length viii_6b_l == length viii_6_l take 8 viii_6b_l == [I,A,B,C,D2,D,E2,E]
viii_6b_p' :: [Half_Seq]Source
Fig. VIII-6/b Half_Seq
.
viii_6b_p' == map half_seq_of viii_6b_l nub (map (length . nub) viii_6b_p') == [4]
viii_6b :: [(Label, Seq)]Source
Fig. VIII-6/b.
map (viii_6b !!) [0,8,16] == [(I,[1,2,3,4,5,6,7,8]) ,(G2,[3,2,4,1,7,6,8,5]) ,(Q8,[6,8,5,7,2,4,1,3])]