# Know it all!

This recent tweet

which expands to “Now I know how I know that I know what I know.” reminded me again of the song “Besserwisser” (Know-It-All) by the German Acapella group Wise Guys. I fear, the beginning of the chorus will be stuck in my head for the next few days:

Ich weiß, was ich weiß,
doch nur das, was ich nicht weiß,
macht mich heiß, weil ich’s gerne besser wüsste.
Weißt du was? Du musst wissen,
dass ich wirklich gerne wüsste,
was ein Besserwisser besser wissen müsste.

This loosely translates to:

I know what I know
but I only care about
what I don’t know,
You know? [You need to know]
that I’d really like to know
what a know-it-all
all needs to know.

(Improvements are very welcome, especially those that make it rhyme.)

The song continues with a praise to science, asking all kinds of questions about everyday science, such as why foam from green shampoo is white, but also some less serious ones, such as about the frustration of an erased pencil stroke. The full German lyrics are available online. I didn’t find an English translation, so I let Google Translate give it a try. … Oh well.

Enjoy responsibly!

# Happy Halloween!

Happy Halloween to you all!

For the first time, we tried to carve a pumpkin and make pumpkin soup. The first pumpkin soup recipe I found looked easy enough. We even had almost all the ingredients at home.

But the complications started right away: getting the pumpkin stuff out of the pumpkin through that tiny hole at the top. We were hungry and impatient, so we used a minor cheat by cutting the pumpkin in half, cutting some of the flesh out with a small knife and scraping the rest out with a spoon. After that, making the soup was easy. It tasted good, but wasn’t as orange as I had hoped.

So what is your favourite pumpkin soup recipe? And how should we really go about making the soup and a Jack-O-Lantern?

This slideshow requires JavaScript.

# Pretty plots: Automatically create TikZ source code for plots in LaTeX with Matlab

Example TikZ plot from Matlab code

LaTeX …
I have just finished the first chapter draft for my thesis. As you’d expect from a mathematician, I write my thesis in LaTeX (or $\LaTeX$). In the evenings, when I couldn’t concentrate enough for creating text that would make sense to anyone, I instead played around with the plots I wanted to include.

… and Matlab don’t work too well together
I used to create all my plots in Matlab (MathWorks), save them as eps (for latex) and png (for pdflatex) and include those in the LaTeX file via \includegraphics. This causes a few annoyances. The size of the included pictures is decided in LaTeX, but rescaling has an effect on everything, including the text in the labels and legend. This meant that for every type of plot (and every decision to use a different scaling) I need to fiddle with the font size in the Matlab figures, until it fits and create all those files again. In addition, although Matlab understands some LaTeX, there were some symbols it has problems with. Finally, the font in the labels is never the same as in the text.

Enter TikZ
I recently heard about this on TeX StackExchange. It’s a way to code your pictures like you code everything else in LaTeX. Unlike pstricks, which I had used in the past and can hardly remember, it works natively with pdflatex. In this way, you hand over the responsibility for any text in your plot to LaTeX. Great! To get started with TikZ, there are an extensive manual, a minimal introduction, loads of answered questions on TeX StackExchange and more.

Automate
To plot a function in TikZ, you interpolate it linearly through many points. That’s a lot of source code per function. There will be loads of plots in my thesis, each showing several functions. Oh, and want axes, too. Naturally, this calls for automation. I wrote two functions in Matlab that would automatically create the tikz code for the axes and a function plot. The plot at the beginning of this post was created with the following code (and cut to size).

Matlab code
x=(0:0.1:7); sinx=sin(x); cosx=cos(x); fid=fopen('tikzcodefrommatlab.tex','w'); tikzaxes(fid,[0 1 7],[-1 0.5 1],'$x$','$y$','2em'); tikzfunctionplot(fid,x,sinx,'blue,ultra thick','sin(x)'); tikzfunctionplot(fid,x,cosx,'orange,dashed,ultra thick','cos(x)'); fclose(fid);

LaTeX source
\documentclass[a4paper,12pt]{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[yscale=1.5] \input{tikzcodefrommatlab} \end{tikzpicture} \end{document}

How do you make sure that your plots and figures fit with the rest of your document? And does anyone have a good idea what to do with 3D plots?

Let me know in the comments below.

Update: I’ve added further links to packages that were pointed out to me: matlab2tikz and PGFplots. I haven’t properly tried them out yet, but especially pgfplots seems awesome.

# Book (noun): Little monster animal that feeds on human time

The printed book, commonly referred to as “book”, is a little winged animal that feeds on human time. Their typical height is roughly around 20cm with a wingspan of about 30cm. However, individuals below 1cm or above 1.5m in height have been spotted.

Behaviour
Books usually live and hunt together in groups of varying sizes and are happy to move to a different group several times in their lives. Usually, they sleep cuddled together on their shelves, but after a successful hunt, a book may be happy to fall asleep just anywhere.

When hunting, the book chooses a vulnerable, unsuspecting victim and paralyses it with its venomous bite, often for hours at a time. It will then drag its victim to a quiet place to feed in peace. A book will often repeatedly feed on the same victim before moving on to the next one.
It is believed that sleeping hours are a special delicacy for books, for which they’ll risk almost anything.

Young books live in big schools, called book shops, but also older books have a tendency to herd together in large groups, called libraries, to increase their hunting success.

Subspecies and related species

Next to the printed book exists the e-book, a rather new subspecies of the book. The e-book lives in huge colonies, called an e-book reader, which can house several thousand individuals, and often the whole colony feeds on just one or two victims.

Another related species is the so called blog post. Blog posts live in family groups, known as blogs, spread far across the internet. These animals are a lot smaller than books, so each individual needs a lot less human time to survive, however there is evidence that the different blogs communicate and inform each other of potential victims in the vicinity. This makes the blog post very dangerous to humans, because a victim can lose a lot of time when attacked by several blogs at the same time.

While the numbers of the printed book are in decline and it may soon become an endangered species, both the e-book and the blog post strive and increase their numbers continually.

Books as pets
Books can be domesticated, however, many book owners are unaware of their vicious and parasitic nature. Breeding books is a very complicated and laborious endeavour and many people fail doing it. Blog posts, on the other hand, are happy to reproduce even in captivity.

Scientific classification
Species: Book
Subspecies: Printed Book, Ebook

Which books feed on you these days?

# What do you feed an elephant?

What do you give a king–who already has everything–as a present?
Let’s give him an elephant!

What do you feed an elephant?
A bit of grass will do.

And what does an elephant drink?
You couldn’t give it water. Not back in the old days, it would have gotten sick.
You couldn’t give it beer, either. Obviously, you can’t give beer to an elephant. That would be silly.
Let’s give it wine instead.

… The elephant didn’t last very long.

(From the Yeoman Warder tour at the Tower of London, from memory.)

This slideshow requires JavaScript.

Some of the other animals held at the Tower didn’t fare much better, either. An ostrich died after being fed nails, because people believed they’d eat iron. And the polar bear probably didn’t quite enjoy fishing in the dirty Thames either. Apparently, the Tower was home to the Royal Beasts for over 600 years, until the London Zoo opened in 1826.

Imperial State Crown (Wikipedia)

Of course, you also get to hear all the gruesome execution stories during the The Yeoman Warder tour. For example, there was mention of those three bishops burnt at the stake in Oxford, one of whom supposedly haunts Broad Street each year at midnight on the 26 October. The tour alone is absolutely worth a visit at the Tower. And once you’re there, you could also have a look at the crown jewels. Although to be honest, I was expecting some more … well, jewellery that’s not a crown. Something to dream about and be jealous of.

What else should I not miss in London, Oxford or the rest of the UK?