The Mathematics of Musical Set Theory
The Mathematics of Musical Set Theory
by Dr. Jim Arlow
© 2019, 2020, Clear View Training Limitedwww.clearviewtraining.comTHIS BOOK CONTAINS SOFTWARE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THIS BOOK CONTAINS LIVE CODE. BE SAFE AND EXAMINE ALL CODE BEFORE EXECUTING IT. ONLY USE COPIES OF THIS BOOK OBTAINED LEGITIMATELY FROM WWW.CLEARVIEWTRAINING.COM OR THE WOLFRAM NOTEBOOK ARCHIVE.
Table of contents
■
The Mathematics of
Musical Set Theory
Musical Set Theory
■
Table of contents
■
Introduction
■
Reading mathematical notation
■
Reading the code
■
Getting started
■
1 Pitches & Scientific Pitch Notation (SPN)
■
1.1 What is a pitch?
■
1.2 Scientific Pitch Notation (SPN)
■
1.3 Enharmonic equivalence
■
1.4 Twelve tone equal temperament (12TET)
■
1.5 Fretted instruments - a digression
■
1.6 Chapter summary
■
2 Introduction to set theory
■
2.1 What is a set?
■
2.2 Set builder notation
■
2.3 The cardinality of a set |S|
■
2.4 Set membership ∈
■
2.5 Set complement A^C
■
2.6 Subset ⊂ and superset ⊃
■
2.7 Proper subset ⊆ and proper superset ⊇
■
2.8 Generating subsets
■
2.9 Set union ⋃
■
2.10 Set intersection ⋂
■
2.11 Set difference \ (relative complement)
■
2.12 Symmetric difference
■
2.13 Venn diagrams
■
2.14 Set equality
■
2.15 Cartesian product ×
■
2.16 The partition of a set
■
2.17 Equivalence relations
■
2.18 Equivalence classes
■
2.19 Chapter summary
■
3 Pitch classes
■
3.1 What is a pitch class?
■
3.2 Pitch class notation
■
3.3 Parsing pitch class names into letter and accidental
■
3.4 Parsing Scientific Pitch Notation into a pitch class and octave
■
3.5 Pitch class representatives
■
3.6 Converting between pitch classes and pitch class representatives
■
3.7 Equality of pitch classes
■
3.8 MIDI numbers
■
3.9 Chapter summary
■
4 Pitch class collections and pitch class sets
■
4.1 What are pitch class collections and pitch class sets?
■
4.2 The number of pitch class sets of cardinality N
■
4.3 Integer representation of pitch class sets
■
4.4 Chapter summary
■
5 Visualising pitch class sets - the 12TET pitch clock
■
5.1 Defining a 12 tone equal temperament pitch clock
■
5.2 Pitch class color space
■
5.3 Pitch clock coordinate space
■
5.4 Pitch clock graphics language
■
5.5 Pitch class set geometry
■
5.6 Pitch class set polygons
■
5.7 Pitch class set piano
■
5.8 The musical staff
■
5.9 Discussion of the 5 line treble staff
■
5.10 Chapter summary
■
6 Intervals, prime forms and interval vectors
■
6.1 Pitch class intervals
■
6.2 Interval classes
■
6.3 Pitch class directed intervals
■
6.4 Pitch class range
■
6.5 What is total interval content?
■
6.6 Interval vectors
■
6.7 Integer representation of interval vectors
■
6.8 Chapter summary
■
7 Pitch class transposition and group theory
■
7.1 Pitch class transposition
■
7.2 Transpositional equivalence of pitch class sets
■
7.3 The major/natural minor controversy
■
7.4 What is a group?
■
7.5 Group property 1: Closure
■
7.6 Group property 2: Associativity
■
7.7 Group property 3: Identity
■
7.8 Group property 4: Inverse
■
7.9 Group property 5 (Abelian groups): Commutativity
■
7.10 The Cayley table
■
7.11 How many groups are there for a given set?
■
7.12 Group operations as transformation rules
■
7.13 Chapter summary
■
8 Inversion and transposition-inversion
■
8.1 What are pitch class and pitch class set inversion?
■
8.2 Symmetric pitch class sets
■
8.3 Generalizing pitch class inversion - reflection
■
8.4 Transposition-inversion
■
8.5 When inversion is equivalent to one or more transpositions
■
8.6 Transposition-inversion and group theory
■
8.7 Chapter Summary
■
9 Normal and prime forms of pitch class sets
■
9.1 Introduction
■
9.2 Normal and prime forms
■
9.3 Permutations
■
9.4 Combinations
■
9.5 Number of ordered pitch class sets
■
9.6 Number of unordered pitch class sets
■
9.7 Cyclic permutations of an ordered set
■
9.8 Visualizing permutations of pitch class sets
■
9.9 Circular permutations of a set
■
9.10 Permutations as a compositional tool
■
9.11 Chapter summary
■
10 Calculating normal forms and prime forms
■
10.1 Introduction
■
10.2 Forte and Rahn normal forms
■
10.3 Forte and Rahn prime forms
■
10.4 Comparing Forte and Rahn normal and prime forms
■
10.5 Chapter summary
■
11 Calculating and naming the Forte prime forms
■
11.1 Creating a table of all the prime forms
■
11.2 Symmetric sets
■
11.3 Z related sets
■
11.4 Forte set names and FDataset database
■
11.5 Forte prime form database
■
11.6 Canned queries
■
11.7 Prime forms and set names
■
11.8 Interval vectors
■
11.9 Z related sets
■
11.10 Listing the pitch class sets for a prime form
■
11.11 Chapter summary
■
12 Interval vector properties
■
12.1 The importance of interval vectors
■
12.2 Unique interval vector entries
■
12.3 Maximum number of an interval class
■
12.4 Equal distribution of entries in the interval vector
■
12.5 Near equal distribution of entries in the interval vector
■
12.6 Chapter summary
■
13 Subsets, supersets, complementary sets and invariance
■
13.1 Prime form proper subsets and supersets
■
13.2 The complementary set
■
13.3 Invariant pitch classes (intersection)
■
13.4 Invariant pitch classes on transposition
■
13.5 Total invariance under transposition
■
13.6 Transpositionally invariant subsets
■
13.7 Total invariance under inversion followed by transposition
■
13.8 Subsets invariant under transposition following inversion
■
13.9 Chapter summary
■
14 Similarity relationships between prime forms
■
14.8 Combining relationships
■
14.9 The R relationship
■
14.10 Mathematical properties of the similarity relationships
■
14.11 Transitive tuples
■
14.12 Chapter summary
■
15 Set complexes and order relations
■
15.1 Pitch class set complexes and subcomplexes
■
15.2 Ordered sets, interval pattern and basic interval pattern (BIP)
■
15.3 Chapter summary
■
Bibliography
Introduction
This is a book about the mathematics of musical set theory.
From our perspective, there are two distinct aspects to musical set theory:
■
Mathematics - a wide variety of interesting mathematical concepts are involved in the formulation of musical set theory. We will cover this here.
■
Analysis - musical set theory can be used as a powerful tool for the analysis of different types of music. We will not cover this here.
As the title of this book indicates, our emphasis here is almost exclusively on the mathematical aspects of the theory. One could easily write another book, probably much longer than this one, on the use of the theory in analysis, but there are already several good texts listed in the bibliography that do that. However, we have not found any other book out there that focuses on the mathematics of the theory in the way we do. This lack has meant that the would-be musical set theorist has had to consult a wide range of mathematics books, or take courses in mathematics, in order to acquire the necessary mathematical know-how. We aim to address that issue by discussing each of the mathematical principles used in musical set theory as, and when, they are needed. As such, the book includes primers on set theory, group theory, symmetry, modulo arithmetic and permutations and combinations.
Musical set theory provides some very useful and powerful concepts that can help give a real insight into the structure of music. These concepts are mostly very simple, and quite logical when considered from the mathematical and musical points of view. Unfortunately, we have found that when these mathematical concepts are embedded in a dense text such as [Forte1], they can appear quite obscure. This is one of the reasons for writing this book - to simplify the presentation of the key concepts by separating the mathematics from the analysis aspects of the theory.
As well as mathematics, this book incorporates a lot of code. In fact, the text is fully executable. One of the main ideas of this book was to show how you can use the Wolfram Language to explore the concepts of musical set theory. Every concept in musical set theory, is, where possible, implemented in Wolfram Language code and there is also often one or more demonstrator programs to elucidate the concepts. If you are reading a PDF of this book, the code will not be executable within the PDF, but you can download a completely free executable version of this book from the Wolfram Notebook Archive (search on Arlow). We strongly advise you to get the executable version of this text so you can play with the demonstrations. The code also provides a very complete toolkit that theorists can use in their own investigations.
Reading mathematical notation
Reading mathematical notation
If you are a musician or programmer with a limited amount of mathematical background, then one of the challenges of musical set theory is reading mathematical notation. Firstly - don’t panic! Mathematical notation is often dense, and even experienced mathematicians can take a long time to read it. Reading mathematical notation is different to reading text, or even code. You may have to go back and forwards several times through an expression before you understand it. This is normal! According to [Alcock1] the best way to learn to read mathematical notation is to say it out loud (or silently to yourself if that is not possible). We will try to help you with this. For example, whenever we introduce a mathematical expression, we will often on the next line say, “This reads as: ...”, and then we will explain the notation. For example:
{ x ∈ | x > 0 }
“This reads: the set ( { ...} ) of x, where x is a member (∈) of the set of real numbers () such that ( | ) x > 0. So this is the set of positive real numbers. ...”
Even though you can read it, to understand it, you need to know what a set is, and what real numbers are, so there are both symbols and concepts that you need to know. All the concepts we use will have a clearly highlighted definition, and all symbols will be defined and explained, often several times, so that as you read the book, you slowly build up a working knowledge of the mathematical concepts and notation you need for musical set theory. However, it is important to either read the “This reads as:...” text out loud or say it to yourself silently, as this is a proven way to rapidly become comfortable with mathematical notation [Alcock2] .
Reading the code
Reading the code
The code is written in the Wolfram Language. This uniquely elegant, powerful and expressive language is probably best known as the language of Mathematica, but it has also made possible innovations such as the voice assistant Siri and the knowledge engine Wolfram Alpha. We assume that you will have some working knowledge of programming, possibly in another programming language such as Java, JavaScript or Python (if not, then this book may not be for you!). You will find that Wolfram Language code is a bit different, because it comes from the Lisp family of languages. Whilst you generally read programs in conventional languages more or less top to bottom, you read all of the Lisp-like languages inside out! This is because programs in these languages are generally structured as nested functions, rather than as a sequence of functions. Start with the innermost function, work out what that does, and proceed outwards, through the nested functions, until you get to the top level. You should soon get the hang of this, because we have used indentation to make the reading easier and most of the code in this text is just a few lines long. Any longer code is generally for demonstration programs, which have a certain irreducible complexity around providing a user interface and a display, and you don’t necessarily have to understand the full details of these. Reading Lisp style code is a bit like reading mathematical notation, because it is very concise. You may need to spend some time understanding a single line, but that single line would equate to many lines in a non-Lisp language.
We are not going to provide an introduction to the Wolfram Language here, because there is already an excellent, free, online tutorial. If you are not familiar with the language then we suggest you take some time to do the tutorial before going further:
(If you are reading the PDF and the hyperlink doesn’t work, just Google this and you will go right there)
There is also a free book by Stephen Wolfram, the inventor of the Wolfram Language, and this is well worth reading:
The other key thing you need to know about the Wolfram Language is that is has exemplary online help in the form of the Wolfram Language & System Documentation Center. For convenience, we have begun almost all of our function names with lowercase letters, so when you see a function name in uppercase, you know that this is a built-in Wolfram Language function, and you can find full details with examples etc. in the Documentation Center.
Once you get used to it, reading Lisp style code is actually a lot simpler than reading conventional code, and you may come to prefer it.
Getting started
Getting started
Before we get into the main text, there is a bit of housekeeping that we have to do.
Clearing the namespace
Clearing the namespace
The first thing we have to do is to set up the Wolfram Language to execute the code in the rest of this text. When we define a symbol in the global namespace of the Wolfram Language, that symbol is there for the whole session. This can lead to unexpected results, so it is a good idea to begin with a call to ClearAll[...] in order to purge the namespace of unwanted, unknown or unexpected symbols:
If you are developing software with the Wolfram Language, a good tip is to do a ClearAll[...] every now and then to make sure there are no older versions of your code cluttering up the namespace. As an exercise, we suggest you look up ClearAll[...] in the Wolfram Language & System Documentation Center so you get used to looking up any functions you do not understand. Just type ClearAll into the search box. Look under the subheading, “Generalizations & Extensions”, to find the meaning of ClearAll[...] as we have used it here.
Displaying examples with formValue and gridFormValue
Displaying examples with formValue and gridFormValue
We will often need to show a piece of Wolfram Language code and its value. By default, the code will appear on one line in an input cell, and the result (value) will appear in the output cell below it. That’s OK, but it is sometimes not very neat. The utility function below takes a Wolfram Language expression, and returns a List where the first element is the unevaluated expression (in Wolfram Language terminology, the form of the expression), and the second element is the result of evaluating the expression. This is useful for constructing tables of examples that show forms and then the results of evaluating them.
In the Wolfram Language, functions can have attributes that specify their properties. In this case, we give the formValue[...] function the attribute HoldAll, which means that it does not immediately evaluate its arguments, and Listable, which means that the function will be automatically applied to each element when given a List of arguments. In that case it will return a List of results. Here is an example of this function in use:
You can see that the first item in the returned List is the unevaluated expression, and the second item is the result of the expression. We will almost always use formValue[...] to create a table of results, so here is a convenience function to encapsulate that:
For example:
Another useful utility is a simple labelling function for our demo programs. You will see this in action shortly: