Skip to content

Brute forcing first species counterpoint

The last post in the music category dates from almost 3 years ago. And even longer ago I started a not so long-lived series on computational composition using Strasheela. Time to change this situation.

Last week as a programming finger exercise I decided to implement a brute-force first species counterpoint solver in Python, enumerating all legal solutions and then scoring them. The first part is finished now, and can be seen at GitHub.

There are several directions in which I would like to take this little project. First of all it needs to be faster, which might be feasible by multi-threading (something I’d like to try just for getting some experience with multi-threading in Python). Observe that the code certainly hasn’t been written with speed in mind, I went for conceptually clear code not some super-fast C-type implementation. Then of course, I want to implement the scoring system. But before that, there are some rules that aren’t implemented yet (e.g. hidden fifths and octaves come to mind) and some of the rules have an ugly implementation.

Going to second species will be a significantly harder task: one has to interpret the function of a note correctly.

Feel free to chime in with suggestions! I have discovered a similar project and I should definitely try to implement something like melodypy.com but for now you’ll have to look at plaintext and hear the notes in your head.

Examples of spectral sequences in algebra and algebraic geometry

I just gave a lecture on examples of spectral sequences in algebra and algebraic geometry for the ANAGRAMS seminar and without further ado, here are the notes. Nothing new or insightful in there, just some facts and examples taken together to help me during the lecture.

Nitpicking on Čech cohomology notation

A long time ago I wrote about how to produce Čech cohomology groups in LaTeX, while in the previous post there is the Čech-to-derived spectral sequence making an appearance, and when I took the first screenshot in that blogpost I realised there was something wrong with the positioning of the exponent. Compare:
Positioning of the exponent in Cech cohomology: bad
to
Positioning of the exponent in Cech cohomology: good
The first one is the naive approach, obtained by using

\DeclareMathOperator\cHH{\check{\HH}}
\DeclareMathOperator\HH{H}

The problem with it is that the accent raises the height of the box, thereby raising the exponent too. But visually speaking the q and p should be on the same height. This is done by using the \smash macro (which already exists in Plain TeX, and is not part of mathtools which I mistakingly thought up to today) which basically annihilates the height from its argument in all layout computations. It can create a horrendous mess, but here it is the solution.

To make sure that our macro is as generally applicable as possible we do insert the height of the argument which will then act as the total height of the result using the \vphantom macro:

\newcommand\cechit[1]{\smash{\check{#1}}\vphantom{#1}}

\DeclareMathOperator\cHH{\cechit{\HH}}
\DeclareMathOperator\HH{H}

which results in the second screenshot.

The irony is that if I wouldn’t be using macros, there wouldn’t be a problem, as TeX will not treat it as one high box if you hardcode everything. Oh well…

Adding an equation to the table of contents

Next week I’ll be giving a lecture on spectral sequences in algebraic geometry, and in the notes I’m preparing I wanted to put the spectral sequence below the title of the corresponding section in the table of contents. The \addcontentsline command was known to me, but \addtocontents wasn’t, and there is one caveat in using it: you need to make sure you put \par at the end of the what you are adding (if it is actual text), forcing the next item to get its own paragraph.

So the macro

\newcommand\tocequation[1]{\addtocontents{toc}{\vspace{.7em}#1\par}}

does the trick (change the vertical spacing to your liking), and using it just requires to say \tocequation{$a^2+b^2=c^2$} after the corresponding \section. A small excerpt of the result is

Table of contents containing an equation

The final results will be posted somewhere next week. I’ll be posting a follow-up blogpost on some nitpickery regarding the notation for Čech cohomology later.

What to do if a proof is psychologically uncomfortable?

Robert Thomason suggests the following in his article The classification of triangulated subcategories:

The reader may find the indirectness of the proof of this useful corollary psychologically uncomfortable. If so, rather than dosing himself with a benzodiazepine, he may find relief in deducing Corollary 2.3 from the following criterion for equality of two classes in \mathrm{K}_0(\mathcal{D}), whose proof is very similar to that of Lemma 2.2. […]

I never checked whether we have diazepines next to the pens in the office supplies closet in the department.

Bernhard Keller won the Prix Sophie Germain

Last week at the Maurice Auslander Memorial Workshop* I was talking to Claire Amiot and she told me nice news about Bernhard Keller (who was her PhD advisor, and my MSc advisor). Last month he won the Prix Sophie Germain. This news about Bernhard might not have been picked up sufficiently by the non-French speaking part of the math community (or maybe I’m just slow on picking up on these things).

Congratulations Bernhard!

* I was considering a blogpost about the event, but as I had no internet connection at the place I was staying at that plan was doomed from the start. The talks were all really nice, and the notes made by a team of German PhD students will come online soon I have been told. If you like algebraic geometry I especially suggest looking at the notes of the talks by Becker, Buchweitz and Wemyss.

How do I properly cite a preprint in `biblatex`?

This question has been nagging me for a while, and thanks to TeX – LaTeX Stack Exchange I have found an answer: Audrey’s answer to the question What should BibTeX for arXiv entries look like? references the file biblatex-examples.bib where the entries baez/article and baez/online indicate how it should be done. If you are referencing an article, which also has a preprint, it should be like (this part I knew)

@article{baez/article,
  author       = {Baez, John C. and Lauda, Aaron D.},
  title        = {Higher-Dimensional Algebra V: 2-Groups},
  journaltitle = {Theory and Applications of Categories},
  date         = 2004,
  volume       = 12,
  pages        = {423-491},
  version      = 3,
  eprint       = {math/0307200v3},
  eprinttype   = {arxiv},
  langid       = {english},
  langidopts   = {variant=american},
  annotation   = {An \texttt{article} with \texttt{eprint} and
                  \texttt{eprinttype} fields. Note that the arXiv reference is
                  transformed into a clickable link if \texttt{hyperref} support
                  has been enabled.  Compare \texttt{baez\slash online}, which
                  is the same item given as an \texttt{online} entry},
}

and if it’s only a preprint without a published version (and not occurring in some conference proceedings or something), one uses the @online field (which settles my questions)

@online{baez/online,
  author       = {Baez, John C. and Lauda, Aaron D.},
  title        = {Higher-Dimensional Algebra V: 2-Groups},
  date         = {2004-10-27},
  version      = 3,
  langid       = {english},
  langidopts   = {variant=american},
  eprinttype   = {arxiv},
  eprint       = {math/0307200v3},
  annotation   = {An \texttt{online} reference from arXiv. Note the
                  \texttt{eprint} and \texttt{eprinttype} fields. Compare
                  \texttt{baez\slash article} which is the same item given as an
                  \texttt{article} entry with eprint information},
}

without any other frizzles such as url fields or something.

Actually, it is best to also use the eprintclass field for arXiv preprints, which is the main subject class under which a preprint is catalogued. This would mean you’d have to add eprintclass = {math.QA}.

Tomorrow I will leave for the Auslander Auslander Memorial Workshop, and I don’t know whether I will feel like producing a long post on Thursday, which as you might have noticed has been something that I started doing since the first week of October. I have some drafts, but I guess you’ll have to wait for those.

Maybe I will even try live blogging the event (or discuss the talks in the evening, or something, or write down some things during my longish train ride back). Who knows?

Follow

Get every new post delivered to your Inbox.

Join 31 other followers