# The Ace of Base(-three numbers) trick

This trick was shown to me by one of the excellent MathsBusking people. They didn’t explain why it works or how to generalise it to other numbers of cards, so I did a bit of thinking and then I made this video.

# Personal opinions on LaTeX

I’m editing a paper (12 months and counting!) and I’ve had a few thoughts about LaTeX that I thought I’d write down. I don’t even care if this makes me a neckbeard, that’s the mood I’m in currently.

The hyperref package makes your references clickable when you compile to PDF. I can’t think of a reason not to use it.

I dislike people who set their editors to have a fixed maximum line-width! Word-wrap works fine, and means the window is full no matter how big it is. Also, newlines can be used to separate thoughts more clearly.

# Solving the “princess on a graph” puzzle

This post is about the best logic puzzle I’ve seen in absolutely ages. It’s easy to explain and doesn’t require any silly tricks, but has a decent amount of depth to it and challenges your intuition. I’m going to present the puzzle, an extended version of the puzzle, and a general solution to the extended version.

The “classic” puzzle was told to me by David Cushing, who was told it by Alistair Bird, who himself found it on the MathOverflow “math puzzles for dinner” thread.

The setup goes like this:

• there is a castle with 17 rooms in it, arranged in a line.
• the princess who lives in the castle sleeps in a different room each night, but always one adjacent to the one she slept in the previous night. She is free pick any room to sleep in on the first night.
• a prince would like to find the princess, but she will not tell him where she is going to sleep each night.
• the prince can look in a single room each night, with no other restrictions

And the puzzle is:

Is there a strategy the prince can follow to guarantee he looks in the room the princess is sleeping in within a finite number of days?

If you haven’t seen this puzzle before, look away from the screen now and spend some time working out the solution. Try starting with castles of just a few rooms, and see if you can spot a pattern in the winning strategies. This version of the puzzle is definitely solvable by just sitting and thinking for a while.

# grunt -> hunt, grow -> how, ground -> hound, grandstand -> handstand, etc.

I noticed that a remarkable number of words starting with gr are still words if you swap the gr for h. For example, the words in the title of this post. How many words is this true for? Which pair of prefixes has the most words in common?

Here’s a Python script I wrote to answer those questions. Here’s the list of words I used. And here are the results. I only looked at prefixes of one or two letters.

The best pair was no and u. Here’s the list of suffixes they have in common. Most of it is words which can be prefixed with un or non. That isn’t very interesting, so I think the real winner is (b,st), with 1085 suffixes in common. It’s the first pair where one of the prefixes is two letters, and where most of the words aren’t just words with another Latin prefix in front of them.

I could do loads of calculations like this. If you import the Python script as a module, you can have a look at all the data it computes. Very interesting!

The word list I used probably skewed the results quite a bit because it contains lots of words which are conjugations or pluralisations or whatever of the same root word, as well as a load of really weird words which probably occur once in the whole corpus. I think if I look at this again I’ll use something like this frequency list, and use the frequencies of words as a weighting for scoring prefix-pairs.

# Newcastle MathsJam November 2011 recap

Phew!

November’s MathsJam happened last night, and I’m totally pooped. We had a record twelve attendees and did absolutely loads of maths – so much that I ran out of space in my little notebook.

# Writing maths for the web is easy now!

I’m still tired from the big MathsJam weekend so I thought I’d do something tedious and write up some links to go with the tedious talk about writing maths on the web that I gave.

The most important thing was MathJax, which renders LaTeX on any page. I forgot to mention in the talk that you don’t need to install anything on your browser or on your server – you can just paste the code they give you into your page’s header and it all works. I’ve previously blogged about a bookmarklet which will add MathJax to any page which doesn’t already have it.

LaTeX is quite hard to learn, particularly all the commands to get the symbols you want. Draw the symbol you want in Detexify and it will tell you the LaTeX command. Problem solved!

There’s also a new site called Shapecatcher, which does the same thing but for Unicode characters. I drew a snowman: !

Next I showed JSXGraph, which produces nice interactive geometry and graphs and which, again, runs in any browser and has some code you can paste in to load it without installing anything on your server.

Finally, I showed something I made, takenot.es, which rolls all of the above into a nice interface for quickly writing notes with maths in. I’ve been using it for all my maths-heavy blog posts since I made it and it really has saved a lot of time. Being able to instantly see how your LaTeX is rendered is very useful.

# Resources for first-year engineers

Maths-Aid, the drop-in maths help service at Newcastle University where I do a bit of work, commissioned some worksheets and accompanying videos for engineers, to be completed over the Summer. The idea was that they would cover the most commonly-requested topics at Maths-Aid, providing pretty much the same information as we would give in a one-to-one session but not acting as a replacement for lecture notes and textbooks.

They’re finally just about finished after a lot of employee-herding and you can see them on the Maths-Aid website. Each worksheet consists of a brief introduction followed by worked example questions. Embedded in each question is a video of me going through the solution from start to finish. They were very quick to produce, and I think they will be very useful. By the way, all these videos and a few others I’ve made are available on our Vimeo account.

The original worksheets were written in Word, so I translated them to HTML+MathJax because it’s much much more convenient. I’ve left links to the Word documents on the page in case people want to print it out, but there’s a nice print stylesheet so just printing out the page itself produces good results.

Now that the worksheets and videos are finished, we’re adding some interactive revision questions using Numbas. At the moment there’s one for the simple second-order ODEs sheet. It produces a randomly generated ODE to solve each time you run it, and can give hints or a full worked solution if you get stuck. There’s a button to re-randomise each question, so you can just stick at it for as long as you like.

I’m trying to make a case in the E-Learning Unit for more of this kind of thing being produced: I think they’re very useful, and complement lecture notes and textbooks very well.

# Newcastle MathsJam October 2011 Recap

The third Newcastle MathsJam was yesterday. I felt last time round that it might be worth writing up what we did, both so new people can get an idea of what MathsJam is about, and also as a reference in case something comes up again in a later meeting.

First of all, I posed a problem which was first told to me by another student at Newcastle, and which I can’t find anywhere on the web. It’s called,

# A bookmarklet which typesets TeX on any page using MathJax

MathJax is the best thing to happen to the web since the web began. I’ve said this a lot of times.

Update 21/05/2012: Jakub Kozisek has started maintaining a much better version of the bookmarklet on Github, so I’ll just link to that now: http://dzejkej.github.com/mathjax-bookmarklet/

Update 30/01/2013: Google+ uses some of the same CSS class names as MathJax, which made maths look all mangled when you run the bookmarklet there. I’ve updated the bookmarklet to override Google+’s CSS. For now, I’ve put the fixed version up here so you can install it, and I’ve started pull request on Jakub’s Github repository so he can merge the fix in.

Bloggers: if you’re looking for instructions on how to use MathJax on your blog, I’ve written another post with very detailed instructions.

# Numbas v1.4

I’ve just released v1.4 of Numbas on Github. I increase the version number whenever there are significant additions to the system, and there are loads this time.

Here’s what’s changed since v1.3: