## Pattern-matching syntax trees

I’m doing some very fun things with pattern-matching syntax trees today.

For context: I write a computer-based assessment system called Numbas, and it’s focused on assessing mathematics. A big part of that assessment involves asking the student to enter an algebraic expression as the answer to a question. How do you decide whether to mark the student’s answer as correct or not? Historically, there have been two approaches, given a representative “correct” expression written by the teacher:

• Put the student’s answer and the correct answer into a canonical form. If their syntax trees are exactly the same, then the student’s answer is the same as the teacher’s. This is the model used by, for example, STACK.
• Identify the variables used in the student’s answer and the teacher’s. Pick a few random numbers as values for those variables, and evaluate both expressions. If they come out to the same number, then the student’s answer is the same as the teacher’s. This is the model used by systems in the CALM line.

## MathJax hangout on air Q&A

I did a Google+ Hangout on Air Q&A session with MathJax’s Peter Krautzberger and cnx.org’s Phil Schatz last Friday. We spent about an hour and a half answering questions and talking about the way we use MathJax.

It was a bit awkward, since I couldn’t see who was watching, and it wasn’t very clear how to interact with the audience apart from them submitting questions, but some people seem to have found it worthwhile.

For your entertainment, here’s the recording:

Peter wants to run more of these Q&As in the future. I’ll make sure to attend!

## 6 pieces involving patterns and functions by Edmund Harriss

Quite a few months ago, I posted on The Aperiodical about my search for art to decorate the university maths department I work at. The upshot of that was that we commissioned six pieces from Edmund Harriss, who has made some very nice things to do with geometry and tilings in the past.

The pieces he delivered were all constructed from layers of cut card laid on top of each other, with the idea that patterns appear as you change your viewing angle. It took a frankly ridiculous amount of time to get the pieces out of UK customs after Edmund shipped them from the US, and then they sat in our building manager’s office for a month or so while the university estates people got their act together.

Anyway, I really like the pieces. Now they’re finally up on the walls, I’ve taken some pictures and put them on Flickr.

## A bookmarklet to replace WordPress.com’s image-based maths with MathJax

I finally got fed up enough with WordPress.com’s blurry image-based maths rendering to write a bookmarklet which goes through the page replacing them with the equivalent MathJax code. I’ve added it to my MathJax bookmarklet installation page. Drag the “image replacement bookmarklet” to your bookmarks bar, go to a WordPress.com blog (I recommend Gowers’s Weblog), then click the “Replace image maths with MathJax” bookmarklet.

Update 19/09/2013: Following a suggestion by Peter Krautzberger, I’ve updated the bookmarklet to do the image replacement differently, so the images don’t disappear while MathJax is working. I’ve also made it work on Wikipedia.

## Newcastle MathsJam May 2013 Recap

If I type very quickly, I can get this recap posted before June’s MathsJam starts. Hi-ho, silver!
Newcastle MathsJam May 2013 Recap continued »

## Newcastle MathsJam March and April 2013 Recap

Here’s another double-bill MathsJam recap; I’ve been truly awful at keeping up this year.

The first thing I have written down in my notebook for March’s Newcastle MathsJam is a scribbled-upon sketch of what looks like some paths on a torus. I think I might’ve been explaining the definition of the fundamental group of a surface to someone.

Stephen brought in a whole collection of exotic Rubikish shapes. David decided to do art with them.

John brought The Mathematical Coloring Book:

### Looking for $a! = b!c!$

Not sure if this was posted on Twitter or brought up by someone at Newcastle. Here’s a solution:

• Let $n := k!$.
• Then $n! = n \cdot (n-1)!$
• i.e. $(k!)! = k! \cdot (k!-1)!$.
• Quod erat to show.

Underneath that, I have couple of interesting identities:

\begin{align} 8!+7!+1! &= 45361 \\ 871 &= 4!+5!+3!+6!+1! \end{align}

That was tweeted by Jim Wilder, and is related to a very short integer sequence.

We must’ve been talking about nice number facts in general at this point, because I’ve written down my favourite number,

$3435 = 3^3 + 4^4 + 3^3 + 5^5$

Numbers like this are called Münchausen numbers and belong to an exactly as tiny sequence as the factorions mentioned above. The paper “On a curious property of 3435” by Daan van Berkel will tell you all about them.

### Eggs!

Easter happened in March, so Manchester MathsJam’s Katie and I researched ways of drawing mathematically-correct eggs beforehand. It doesn’t look like I kept any of our drawings, so you’ll just have to reconstruct them yourselves. All the literature we found on the subject (eggsegesis, if you will, and I hope you do) came from Germany. Jürgen Köller’s page on egg curves is comprehensive, while Herbert Möller’s paper, “Das 2:3-Ei – ein praktikables Eimodell“, gives a more rigorous treatment.

Inspired by our eggs, John reminded us of this problem that Ji had posed previously:

Given a circle and one point on it, draw an inscribed square with just a compass.

Difficult! I didn’t write down the answer!

I talked a bit about my friend Stacey’s problems with maximal oriented Wicks forms. Stacey copied out part of a proof she was studying on our office blackboard, and it was so attractive I took a picture and sent it in to the What’s on my blackboard? blog.

Next in my notebook is the word “Sarahdohedron”. Sarah made an unusual origami shape and needed a name for it.

We had a go at the jumping frogs puzzle, which the nice people at NRICH have recently made a nice version of. The lengths of solutions to the jumping frogs puzzle form yet another integer sequence, A005563.

We sort of had a conversation with Cardiff MathsJam through our respective Enigma machines. They were using a Pringles paper tube Enigma machine, but we cheated and used the Android app.

### Night-night, Simon!

David presented us with a tricky problem of the utmost importance:

Simon the snake is very sleepy. He might fall asleep at any moment, in any position. What’s the smallest blanket can we use to be sure that we’ll entirely cover him, no matter what position he falls asleep in?

There was quite a lot of discussion about this. We started with a semicircle, which David reckoned you could cut a smaller arc out of the top of. I had some crazy cockahoop scheme involving variational methods that I won’t try to remember. Later on, we found out that Simon is the latest in a long line of sleepy slitherers which began with Moser’s worm. The paper “A smaller sleeping bag for a baby snake” by Svante Linusson, and Johan Wästlund has both a charming title and a much better solution than any of us came up with.

Recorded for posterity, here are our efforts:

Simon, pictured here on the edge of Sleepy Towne

Oh no, Simon has fallen asleep! Fetch the blanket!

Simon is moderately, but not optimally, snug underneath this blanket.

Sweet dreams, Simon. Sorry we weren’t clever enough to tuck you in to your exacting requirements.

Simon got a bit frayed towards the end of the night, so John offered to take him home and give him a bit of TLC. He reappeared in April with a neat heat-shrunk head. I assumed custody after that but I’m ashamed to say I have no idea where he is now. Hopefully, he’s having a little kip in the bottom of my backpack. I am a terrible snake-stepfather.

The last note I have is, “Is 10% the same thing as 0.1?”, prompted I think by an argument I was having with someone on Twitter. I’ll say that we agreed it is, because that way I win the argument.

### Oh no, it’s the PAPAC-00

I’d hoped the main feature of April’s MathsJam would be the PAPAC-00, a cardboard computer I had assembled based on instructions I found on the internet. It didn’t really work though, so I just had to point to the bits that should’ve been moving when I pulled the control lever. Cereal box is not a precision medium. John said he thought it would work if the bits were made on a laser cutter. I expect to be surprised at May’s meeting.

The Papac-00, in its natural state as a dream too beautiful for this mediocre reality.

The idea is that you set each of the two registers to store either 1 or 0, and then waggle the control lever back and forth. Each waggle of the lever adds the current register to the adder at the bottom. The counter at the top dictates which register is read, and alternates with each waggle. Roughly 13% of those things happened when I tried it.

We talked a bit about colourblindness, because I had just found the most marvellous app for my phone, which both simulates and corrects for colourblind vision through the phone’s camera. Everyone else learned how rubbish my view of the world is, and I learned a lot about what colours things are.

I had brought along the Big, Big, Big Book of Brainteasers, a book which made its first appearance at the third Newcastle MathsJam back in 2011. We tried a few puzzles – I’ve written down numbers 201 and 202 – before deciding they were either too easy, too hard, or too ambiguous to bother with. Eamonn had brought Erwin Brecher’s Puzzles, Brainteasers & Mathematical Diversions, which seemed to be a much better book. I’ve written down number 174, which I think might be a puzzle from Brechner’s book that we enjoyed. Any idea what it was, anyone?

### Oh no, more circle construction problems

Here’s one:

A circle is inscribed in a quadrilateral. The ratio of the quadrilateral’s perimeter to the circle’s circumference is 3:2. What’s the ratio of the quadrilateral’s area to the circle’s?

And another:

Given a circle and a point outside it, construct the point’s tangents using only a ruler.

The solution to that one is so hard to find that I commented that many of these puzzles seem to arise when someone chances upon an interesting fact, then phrases it as a question. Asking peopel to do the inverse of that isn’t much fun, in my opinion. (#soreloser, I know)

### The run-away train that failed to run away

Well-known interesting fact: $\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + \dots$ doesn’t converge.

Little-known fascinating fact: the same sum but excluding numbers containing a 9 does converge!

In fact, you can pick any string of digits instead of “9”, even a really long one, and the fact is still true. It’s explained in the paper “Summing curious, slowly convergent, harmonic subseries” by Thomas Schmelzer and Robert Baillie.

Finally in my notebook, just this little bit:

$12^2 + 33^2 = 1233$. Others?

To be precise: we want two numbers such that, when you add their squares, you get their concatenation. Turns out Stephen’s done a lot of work on this since it was posed to him as part of an undergrad course (or problem sheet or something). He’s calculated an enormous number of solutions and put them on his website. He explained his method to us – maybe that’ll appear online too one day.

That’s a snapshot of two months’ worth of Newcastle MathsJams. I’ve missed quite a bit because I didn’t take very good notes, as usual. You’ll have noticed that we’re getting a bit hardcore again, without the influence of many non-academic mathmos. Since I get more than my fill of crazy super maths as a result of having to spend every working day with Cushing, and soon also Ji, I’m very keen to do some stress-free fun maths. So if you have any ideas how we can encourage more varied kinds of people to come to MathsJam, please tell me!

The next Newcastle MathsJam will be on Tuesday the 21st of May. If you’re one of the many people from outside Newcastle who read this blog, the MathsJam website lists over 30 cities round the world where MathsJams take place.

## Newcastle MathsJam January & February 2013 recaps

I’ve got a double-bill MathsJam recap for you this time, because I’ve been doing so much other stuff that I didn’t get round to writing up January’s MathsJam before the February one happened. I feel like I’ve forgotten most of what happened, so I’m working off my very brief notes.
Newcastle MathsJam January & February 2013 recaps continued »

I don’t mention it much, but I’m an entrepreneurial, go-get-’em, many-irons-in-the-fire, have-my-people-call-your-people kind of guy! Barely a day goes by when I don’t start a new business with a choice punning name and announce it on Twitter.

Twitter just switched the switch to let me download my tweets archive, so I immediately did that and grepped it for my many many new business names. Here they are:

## Talk: Computability of Bass-Serre structures in the Grzegorczyk hierarchy

My chum the inimitable David Cushing has started a postgrad pure maths seminar at Newcastle. Because there are only a few pure postgrads here, he asked me to give a talk about the stuff I was looking at for the PhD I gave up on last year.

I’ve written a few posts here in the past about the Grzegorczyk hierarchy, computable groups, and so on, but I think this might be the first time I’ve presented my work to real people (apart from an impromptu hour-long braindump when one of the real seminar speakers cancelled and I decided to test my memory).

## Some of my old BlitzMax games

When I was in school I used to spend a lot of my time making games in Blitz Basic (and later BlitzMax). Eventually, as I got older and more boring, I ran out of ideas and started doing other things. I haven’t sat down and made a satisfying game in years. I used to really enjoy it though, and I made some things that I really liked. I used to think that maybe I would be a trendy game designer one day.

I was thinking about that this morning, so I decided to go through and play a few of my old games. I feel just as much a need to show them off now as I did when I made them, so I’ve recorded a few screencasts. Camtasia broke for Unknown Reasons and it turns out Jing is sort of terrible at recording games, so they’re really jerky and the volume’s quite low, but I’m not going to not share them now I’ve made them.

Here they are:

I’m quite disappointed that a few of my favourites didn’t run. I’m sure if I recompiled them they’d work. All of my code is in a repository on github, and compiled versions of everything are on my original homepage, somethingorotherwhatever.com. Here’s a list of links to the ones that work at least a little bit: