Posts Tagged numbers
I’ve developed a bit of a habit of recording entire concerts of musicians who don’t mind their concerts being recorded, splitting them into individual songs, and uploading them to my YouTube channel with copious notes in the video descriptions. My first upload was, appropriately, the band featured in the first image on the web, Les Horribles Cernettes, singing Big Bang. I first got enough camera batteries and SD cards to record entire concerts for the K’s Choice comeback concert in Dranouter in 2009, though the playlist is short, so perhaps I didn’t actually record that entire show.
I’ve also developed a habit of going on a week-long cruise packed with about 25 days of entertainment every year, and recording 30 or so hours of that entertainment. So my YouTube channel is getting a bit ridiculous. I currently have 2723 publicly-visible videos on my channel, and 2906 total videos — the other 183 are private or unlisted, either because they’re open mic or karaoke performances from JoCo Cruise and I’m not sure I have the performer’s permission to post them, or they’re official performances that we were requested to only share with people that were there.
I’ve been wondering just how much I’ve written in my sometimes-overly-verbose video descriptions over the years, and the only way I found to download all that metadata was using the YouTube API. I tested it out by putting a URL with the right parameters in a web browser, but it’s only possible to get the data for up to 50 videos at a time, so it was clear I’d have to write some code to do it.
Late Friday evening, after uploading my last video from JoCo Cruise 2020, I set to writing a document-based CoreData SwiftUI app to download all that data. I know my way around CoreData and downloading and parsing JSON in Swift, but haven’t had many chances to try out SwiftUI, so this was a way I could quickly get the information I wanted while still learning something. I decided to only get the public videos, since that doesn’t need authentication (indeed, I had already tried it in a web browser), so it’s a bit simpler.
By about 3a.m, I had all the data, stored in a document and displayed rather simply in my app. Perhaps that was my cue to go to bed, but I was too curious. So I quickly added some code to export all the video descriptions in one text file and all the video titles in another. I had planned to count the words within the app (using enumerateSubstrings byWords or enumerateTags, of course… we’re not savages! As a linguist I know that counting words is more complicated than counting spaces.) but it was getting late and I knew I wanted the full text for other things, so I just exported the text and opened it in Pages. The verdict:
- 2723 public videos
- 33 465 words in video titles
- 303 839 words in video descriptions
The next day, I wanted to create some word clouds with the data, but all the URLs in the video descriptions got in the way. I quite often link to the playlists each video is in, related videos, and where to purchase the songs being played. I added some code to remove links (using stringByReplacingMatches with an NSDataDetector with the link type, because we’re not savages! As an internet person I know that links are more complicated than any regex I’d write.) I found that Pages counts URLs as having quite a few words, so the final count is:
- At least 4 633 links (this is just by searching for ‘http’ in the original video descriptions, like a savage, so might not match every link)
- 267 567 words in video descriptions, once links are removed. I could almost win NaNoWriMo with the links from my video descriptions alone.
I then had my app export the publish dates of all the videos, imported them into Numbers, and created the histogram shown above. I actually learnt quite a bit about Numbers in the process, so that’s a bonus. I’ll probably do a deeper dive into the upload frequency later, with word clouds broken down by time period to show what I was uploading at any given time, but for now, here are some facts:
- The single day when I uploaded the most publicly-visible videos was 25 December 2017, when I uploaded 34 videos — a K’s Choice concert and a Burning Hell concert in Vienna earlier that year. I’m guessing I didn’t have company for Christmas, so I just got to hang out at home watching concerts and eating inexpertly-roasted potatoes.
- The month when I uploaded the most publicly-visible videos was April 2019. This makes sense, as I was unemployed at the time, and got back from JoCo Cruise on March 26.
So, onto the word clouds I cleaned up that data to make. I created them on wordclouds.com, because wordle has rather stagnated. Most of my video titles mention the artist name and concert venue and date, so some words end up being extremely common. This huge variation in word frequency meant I had to reduce the size from 0 all the way to -79 in order for it to be able to fit common words such as ‘Jonathan’. Wordclouds lets you choose the shape of the final word cloud, but at that scale, it ends up as the intersection of a diamond with the chosen shape, so the shape doesn’t end up being recognisable. Here it is, then, as a diamond:
The video descriptions didn’t have as much variation between word frequencies, so I only had to reduce it to size -45 to fit both ‘Jonathan’ and ‘Coulton’ in it. I still don’t know whether there are other common words that didn’t fit, because the site doesn’t show that information until it’s finished, and there are so many different words that it’s still busy drawing the word cloud. Luckily I could download an image of it before that finished. Anyway, at size -45, the ‘camera’ shape I’d hoped to use isn’t quite recognisable, but I did manage a decent ‘YouTube play button’ word cloud:
One weird fact I noticed is that I mention Paul Sabourin of Paul and Storm in video descriptions about 40% more often than I mention Storm DiCostanzo, and I include his last name three times as much. To rectify this, I wrote a song mentioning Storm’s last name a lot, to be sung to the tune of ‘Hallelujah’, because that’s what we do:
We’d like to sing of Paul and Storm.
It’s Paul we love to see perform.
The other member’s name’s the one that scans though.
So here’s to he who plays guitar;
let’s all sing out a thankful ‘Arrr!’
for Paul and Storm’s own Greg “Storm” DiCostanzo!
DiCostanzo, DiCostanzo, DiCostanzo, DiCostanzo
I’m sure I’ll download more data from the API, do some more analysis, and mine the text for haiku (if Haiku Detector even still runs — it’s been a while since I touched it!) later, but that’s enough for now!
This is the fifth in a series called ‘Forms and Formulae‘ in which I write about articles in the Princeton Companion to Mathematics using poetic forms covered by articles in the Princeton Encyclopedia of Poetry and Poetics. This installment’s mathematics article is entitled ‘From Numbers to Number Systems’ and the poetic form is allegory, making this the third poetic form in a row that isn’t actually a poem.
A long time ago in Greece, there was a community of numbers where everybody lived as one, or two, or three. They were not all equal, because each was unique, but they were all numbers, and that’s what counted. They were the true numbers, and they lived alongside the false, or negative, numbers.
Then One day, which was the day when the number One was celebrated, One Seventh came along. The other numbers looked at it with pity.
“You poor, broken thing,” they said. But the seventh didn’t feel broken.
“I’m not broken. I’m a number, just like you!” said One Seventh.
Seven looked at One Seventh with trepidation. “I don’t think it’s safe to be around a part of seven. What if it wants to take more of my parts?”
Three agreed. “It’s just not wholesome.”
One Seventh pointed to its numerator. “Is this not a one, like the number of the day? How can I not be a number when my very numerator is the purest number of all?”
One was flattered by the description, and in the spirit of the celebration, declared, “One must not only celebrate Oneself, but also display kindness to all those around One. I declare One Seventh to be a number, along with all little Ones like it!” After that, the other numbers were largely kind to the unit fractions, and the fractions always reciprocated.
The next day, Two Fifths came along. Emboldened by the success of One Seventh, Two Fifths said, “I’m a number too! Can I join the celebration?”
Two, whose day it was, said, “But you’re just One Fifth plus One Fifth. It’s just not proper to be going around as if you’re a single number. Split into unit fractions before you scare the little Ones!”
But Two Fifths persisted. “What are you,” it said to Two, “if not One plus One?”
Two did not like the idea two bits, but it could not find a problem with the argument.
Five, who was never any good at acting composed, protested. “This is preposterous! Two, I always knew you weren’t quite as prime as us. Think about it. If we let these two fifths…”
“This two fifths,” corrected Two Fifths.
Five shot it an incalculable look. “If we let these two fifths act like a whole number, next we’ll have matrices, or lengths, or linear graphs wanting to be numbers. It’s a steep gradient!”
“That’s not true!” said Two Fifths. “In other cultures I am a perfectly acceptable number. In Mesopotamia, nobody thinks twice about my being a number, but they would never allow One Seventh. It’s all a matter of culture! And graphs are not numbers there either, so you needn’t worry about that.”
Two was divided by Five’s argument. It worried about diluting the number system, of course, but it was aware that even it could have been excluded from the primes using such an argument. Having always felt like an outsider itself, it had pity on Two Fifths, and declared the fraction and others like it to be numbers.
The next day, The Square Root of Two, who could not be expressed as a fraction, decided to join the numbers. Three said, “Don’t be absurd. You’re not really the square root of two; only square numbers have square roots. You’re just a fraction who’s confused. You look like about one and a hundred and sixty nine four hundred and eighths, to me.”
But the square root was resolute. “Look,” it said, holding up a square. “If we say the sides have length one, then the diagonal has length the square root of two. There is no way we can find a unit that can measure both of them as whole numbers. I can prove it to you!” And The Square Root of Two proved it.
“Okay,” said Three. “You’ve shown that the diagonal can’t be measured with the same unit as the sides. But they’re just lengths, not numbers. All you’ve done is show that not all lengths can be measured with numbers. The numbers are not going to be happy about this, you know.”
“But I am a number! I am the number which can measure that diagonal!”
“That’s just irrational. Lengths are not numbers. Either you’re a number, in which case you should show yourself as a fraction instead of wearing that radical outfit, or you’re a length, or a ratio of lengths, and you should go back where you belength. Make up your mind.”
“I told you this would happen!” said Five. “I told you lengths would be next!”
So the Square Root of Two skulked back to geometry, and commiserated, but did not commensurate, with the ratio of a circumference to a diameter.
Meanwhile, Two Fifths told all its new number friends about its adventures in Babylon, and the sexy sexagesimal numbers there. Before long, it became fashionable for numbers to represent themselves using decimal places instead of fractions. Some of them had to use zeros to make sure their digits hung in the right places.
Zero saw its chance, and claimed its right to be considered a number.
“But you’re not a number!” said Four. “You’re just a placeholder that the fractions use when they’re dressing up in their costumes for their unwholesome sexagesimal parties.” Four looked down its slope at a nearby decimal.
“But if I add myself to you, is there not equality? I should be treated the same as you.”
“But,” said One, “numbers have to be able to multiply. If you multiply you only get yourself. Only multiplying with me should do that! I’m the Unit around here, not you.”
“You’re destroying the family Unit!” shouted Five, in defense of its onely other divisor.
“I can’t even tell whether you’re true or false!” cried One Seventh, nonplussed.
So Zero went back to dutifully holding places, quietly adding itself to everyone and everytwo it met, until they were all convinced it held a place in society.
On the Seventh day, which was the day when One Seventh’s acceptance as a number was celebrated, they rested.
On the Tenth day, which was the day when The Tenth was celebrated, The Tenth returned from a vacation in Flanders and declared, “There are no absurd, irrational, irregular, inexplicable, or surd numbers!”
Five and Three cheered, and made obtuse gestures at The Square Root of Two and its friends. “You see? You’re not numbers.”
“All numbers are squares, cubes, fourth powers, and so on. The roots are just numbers. Quantities, magnitudes, ratios… they are all just numbers like us. We can all fit along the same line.”
Five and Three looked at each other in primal disgust. “I’m not a point on a line! I’m a number! A real number!” Five shouted.
“Real numbers,” countered The Tenth, “include everyone, and everyfraction, and everylength in between.”
The Square Root of Two led its friends into their places between the other numbers, and they celebrated with unlimited sines, cosines, and logarithms. Some of the stuffier primes and fractions protested, but they backed down when they realised just how many of these strange new numbers there were.
But even as The Tenth spoke, it knew that not everything it said was true. After all, false numbers were not the square of anything, even though it had seen them act like they were in some delightful formulae.
At Length, which was the day when the acceptance of lengths as numbers was celebrated, somereal wondered what would happen if false numbers were squares of something too. It imagined a new kind of radical, like those the square roots wore, but for false numbers. It imagined a world where every polynomial equation had roots, be they real, false, or imaginary. These were clearly not like all the other numbers The Tenth had listed.
Soon after, the imaginary numbers came out of hiding. “We do exist!” they said. “And we can add and subtract and multiply and divide just like you!”
The other numbers were wary, for they could not work out where the imaginaries fit amongst them. They could not even tell who was bigger. Five was disgusted that such numbers had been secretly adding themselves to real numbers all along.
The real numbers were nonetheless intrigued by and slightly envious of these exotic creatures, and despite having become accustomed to all having equal status as numbers, sought new ways to distinguish themselves from the crowd. The whole numbers had never quite got over the feeling of being generally nicer than the other numbers, so they used the new trend to vaunt their natural wholesomeness. The ratio of a circumference to a diameter, who had taken on the name Pi, discovered that in addition to not being expressible as a fraction, it was so much more interesting than The Square Root of Two that it couldn’t even be expressed in such roots. It called itself ‘transcendental’, and had quite some cachet until most of its admirers realised that they had the same property.
Finally they discovered that instead of trying to organise everynum into a line, they could arrange themselves in two dimensions, with the imaginaries along one axis and the reals along the other, and the vast plane in between filled with complex combinations of both.
Some of the more progressive numbers were so excited by this system that they tried to find new numbers that they could arrange into a three-dimensional volume, but they couldn’t find any. However, during their search they found things called quaternions, which lived in a fourth dimension.
An excited transcendental, whose name is too long to write here, brought a subgroup of quaternions in front of the crowd and announced, “I have travelled to the fourth dimension, and found numbers there just like us. We are not alone!”
Five kept its fury pent up this time, but Four Sevenths called out, “They are not numbers like us. I have seen how they multiply. When two quaternions multiply, they can give different results depending on which comes first!”
The numbers clattered their numerals in shock, and a great amount of whispering about unlikeabel multiplication practices ensued.
A complex transcendental sneered, “And what were you doing watching them multiply, eh?”
“Oh, get real!” retorted Four Sevenths, crudely conveying what the transcendental should do with its complex conjugate.
The pair fought, and disorder spread throughout the dimensions. Some sets of numbers sneaked off into the fields to form their own self-contained communities, sick of the controversy surrounding being or not being numbers. As they did, they found still other communities which functioned much like theirs, and some were communities of functions themselves. Indeed, even matrices and graphs formed structures which the enlightened subgroups found familiar, though rather than trying to be accepted as numbers, these groups took pride in having their own identities. The p-adics were adamant that they were numbers, but did not care to join the rest of the real or complex numbers. The octonions did not associate themselves with such labels, going about their operations however it worked for them, and consenting to be called numbers only when it was useful to act as such.
When peace finally settled, there were more groups of objects than there had been numbers, and still more came about when those groups interacted with each other. Most no longer cared about being called numbers, and simply communicated which rules they followed before participating in a given system. And if the requisite system turned out not to exist yet, well, it just had to be invented.
Turning this particular article into an allegory did not take much work. It almost seemed like one already, when I read it in that frame of mind. There are a few direct quotes in the story. The Tenth’s proclamations come from The Tenth, in which Simon Stevin introduced decimal notation to Europe. The very last line of the story is paraphrased from the last line of the article. All I really did was rephrase it as a story from the perspective of the numbers, and add in far too many mathematical puns of greatly varying levels of subtlety.
I’m sorry to anyone with ordinal linguistic personification who thinks I’ve given the wrong personalities to the numbers. Also, in case anyone was wondering, the Greek numeral for four does have a slope.
The next Forms and Formulae will be an anecdote about geometry.
This is the third in a series called ‘Forms and Formulae‘ in which I write about articles in the Princeton Companion to Mathematics using poetic forms covered by articles in the Princeton Encyclopedia of Poetry and Poetics. This post’s mathematics article is entitled ‘Some Fundamental Mathematical Definitions’ and the poetic form is air, which is a kind of song.
This song covers the first few sections of the article, about the development of the various number sets (Natural numbers [which I learnt as not including zero], whole numbers [including zero], integers, rational numbers, real numbers, and complex numbers) and finally a little abstract algebra. I’ve made a recording of it [direct mp3 link] using my robot choir and some instruments in GarageBand. I didn’t follow all the suggestions relating to airs, but one hallmark of an air is ‘illustrative musical devices highlighting specific words’, and I went overboard on that, illustrating each set using the background music. Airs are typically accompanied by a lute or other plucked instrument, but I used a piano instead, to highlight the word ‘Peano‘ in the first line.
[1 2 3]
You can play the Peano axioms.
Your successor will never fail.
But if you ain’t got nothing you ain’t got enough
so you start lower down the scale.
[0 1 2]
Well you’ve now got zero problems.
You can count on every fact.
You can add without an end, but exceed your subtrahend
or you’ll find you can’t subtract.
[-1 0 1]
So you add in the minus integers.
Zero gains another side.
You can add and take away, but not conquer all the way
’cause you can’t always divide.
Now your system is highly rational,
no division you can’t deal.
But no matter what you do, you can’t find the root of two
though you know that it must be real.
[ɸ, e, π]
So you fill all the gaps with irrationals.
You have a solid number line.
Solve absurdities at will but you’re out of square roots still
when you start with a minus sign.
So you use your imagination.
You take the square of your mind’s i.
Your calculations never stall, but you wonder if that’s all
that this complex plane can fly.
[triangles, snares, cats]
The operations work on all numbers,
but is that all they can do?
They apply to other things; now you’ve groups and fields and rings
to apply that structure to.
This took longer than my last Forms and Formulae, due to the recording. I made several improvements to my robot choir (an app I wrote one weekend to get my Mac to sing for me) including fixing a silly bug which had thrown the timing of my previous recordings off. I’ve also been taking music lessons over Skype with John Anealio, and I used a few of the things I learnt for this; if you know a bit of music theory you might notice a few music theory puns in there.
It’s not especially funny overall, but I mentioned when I called into Dementia Radio last night that I would submit it to the FuMP Sideshow, so I will. [Edit: and here it is!] Another thing that came up were these Tom Lehrer songs about mathematics, which the host was not aware of. They were some of the first Tom Lehrer songs I heard, and definitely worth a listen if you like Tom Lehrer, maths, or both. I found them in 2005 while looking to replace some pirated Tom Lehrer songs I’d accidentally deleted before listening to them (I did eventually buy all of Tom Lehrer’s albums) and in that same search I came across the MASSIVE database of maths and science songs, which led me to Jonathan Coulton and so many other musicians and friends.
One of those other musicians was Monty Harper, and the first tune I came up with was very similar to the verses of his Silly Song. I changed some parts to make it less similar, but mostly I just made it more repetitive and annoying. Dammit, Jim, I’m a poet, not a musician.
The article in the Princeton Companion to Mathematics was actually very long, and I haven’t finished reading it yet. Assuming I do get to the next article instead of writing something about the latter parts of this one, the next Forms and Formulae will be an alba (a dawn song about adulterous love!) about the goals of mathematical research. That should be fun. It will probably take a while, since it’s another song. Also, I will be busy next week at the 13th International Conference on the Short Story in English. I will be reading a story on the Thursday afternoon; probably a slightly revised version of Valet de cœur.