How to get beautifully typeset maths on your blog

Lots of people have blogs where they talk about maths. Lots of these people just use plain text for mathematical notation which, while it gets the point across, isn’t as easy to read or as visually appealing as it could be.

MathJax lets you write LaTeX and get beautifully typeset mathematical notation. And it’s really really easy to set up: you just need to paste some code into the header of your blog’s theme. To make it really really really easy, I’ve written some very detailed instructions of what to do for each big blogging service. (If you’re reading this after I wrote it, which you definitely are, beware that the interfaces I describe may have changed, so the advice below might be inaccurate. If it is, or if you’re just having trouble following along, please leave a comment below.)

Once you’ve got everything set up, make a post containing this text to check that it works:

Maths between dollars is inline: $\sum_{k=1}^n k = \frac{n(n+1)}{2}$.

Maths between slash-square-brackets is display: \[\sum_{k=1}^n k = \frac{n(n+1)}{2}\]

How to get beautifully typeset maths on your blog continued »

Testing MathJax

Maths between dollars is inline: $\sum_{k=1}^n k = \frac{n(n+1)}{2}$.

Maths between slash-square-brackets is display: \[\sum_{k=1}^n k = \frac{n(n+1)}{2}\]

Interesting Esoterica Summation

I’m going to try collecting additions to my Interesting Esoterica collection in let’s-say-weekly posts. I’ll link to each item, maybe paste its abstract, and write a sentence or two about it. Let’s see if it catches on. I’m not sure if I’ll have the will to do this regularly. I’m in a bit of a getting-things-done mood today.

As this is the first one, and I’ve added loads of stuff in January, for this first post I’m using everything  I’ve added since the New Year. Future posts shouldn’t be anywhere near as long.

I should explain what the Interesting Esoterica collection is about. Basically, it’s where I put interesting stuff that I find. Most of the entries are proper research papers, though quite often a funny title is enough to merit inclusion. I certainly don’t read or even understand everything that goes in. I reckon it’s a fairly even split between stuff that’s really fascinating maths and stuff that’s just… esoteric. It’s a bit like a research-level maths version of QI.

The titles are links to the original sources, and I’m trying to sprinkle explanatory links throughout the rest of the text.

Interesting Esoterica Summation continued »

The sign on my office door

Recently, someone left my office at Newcastle University and a new person took their place, so we needed a new sign on our front door. I wanted to do something clever with it, but it needed to be instantly legible to lost supervisors trying to find their students.

My first thought was that since there are seven of us, something to do with the Fano plane would look good. Our names didn’t have enough of the right letters in the right places for it to work, though.

That got me thinking about the Levenshtein distance. The Levenshtein distance between two strings is a measure of how many changes you need to make to one to end up with the other. I wrote a Python script which calculated the distance between each pair of names: The sign on my office door continued »

Newcastle MathsJam December 2011 Recap

Amazingly, December’s MathsJam had a non-trivial attendance of six whole people. And not just any people! Puzzling heavyweight David Cushing had yet more Renaissance-era riddles to test us all, and the other regulars were in similarly bamboozling form.

I balanced things out by failing to prepare anything or bringing anything to take notes on and subsequently forgetting most of what the others talked about. So this isn’t going to be a very accurate record of what happened, unless I get some reminders in the comments.

Newcastle MathsJam December 2011 Recap continued »

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.

Avoid eqnarray.

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.

Solving the “princess on a graph” puzzle continued »

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.

November MathsJam topics covered - christianp - Flickr

Newcastle MathsJam November 2011 recap continued »