I haven’t listened to it yet, but Charles Stross has to be one of my favourite authors, so it’s bound to be worth listening to. Get it here.

http://subterraneanpress.com/index.php/magazine/winter-2008/audio-trunk-and-disorderly-by-charles-stross/#

Say I wanted to calculate something like \displaystyle\sum_{i=10}^{40} r^2 - r -1

With Haskell:

> sum[r^2-r-1|r<-[10..40]]
21049

This can be generalised to something like the following:

sumseries what from to = sum[what n|n<-[from..to]]

Example:

> sumseries (\r->r^2) 1 10
385
> sumseries (\r->r^2-r-1) 10 40
21049

On paper, I’d have to

  • split this into two sums: \displaystyle\sum_{i=1}^{40} (r^2 - r -1) - \sum_{i=1}^{9} (r^2 - r -1)
  • find an expression for \displaystyle\sum_{i=1}^{n} (r^2 - r -1) using standard sums of the first n squares and naturals, giving \displaystyle\sum_{i=1}^{n} (r^2 - r -1) = \frac{1}{3}(n-2)n(n+2)
  • substitute n = 40 and n = 9 into this, and subtract the latter from the former

Using Newton’s Law of Restitution and the Law of Conservation of Momentum one can calculate the final velocities of two bodies after a collision, given the masses of each body; their initial velocities and the coefficient of restitution between them. I wanted to display this visually, with controllable initial conditions, so I coded something up in python.

The program plots the displacements of the two bodies every second, with one body on the x axis, and the other on the y axis.

Collisions in Phase Space

Collisions in Phase Space

Each point is the position at an integer number of seconds. The starting point is one that lies at (x2, x1) – the position of the second body is the x-coordinate, the position of the first body is the y-coordinate.
e – coefficient of restitution
u1 – initial velocity of body 1
u2 – initial velocity of body 2
m1 – mass of body 1
m2 – mass of body 2
x1 – initial displacement of body 1
x2 – initial displacement of body 2

The code: Read the rest of this entry »

I got an offer to read maths at oxford.

Conditions:

  • A in Further Maths
    • A in (Physics or German)
    • OR
    • (II in STEP II or III) or (Merit in AEA)

St Johns:

Draw a triangle, form inequality that the sum of any two sides is greater than or equal to the third side.
Now draw a quadrilateral, draw in diagonals.
Deduce that sum of the diagonals is greater than the sum of two opposite sides.

There are a collection of points on a plane. Join them together to make a circuit. Uncrossed circuits can be made by finding crossings, and simply uncrossing them. Repeat until uncrossed.

Deduce that there exists a shortest circuit – there are a finite number of points, hence there are a finite number of circuits. A finite set has a smallest member, hence there exists a shortest circuit. This circuit will not have any crossings, since the the length of the corresponding uncrossed circuit (created by uncrossing the crossing) would be longer (using result found above).

Mansfield:

When f(x+y) = f(x)f(y), prove f(0) = 1 where f is a non-zero, real valued function.

My eventual solution

\textrm{find a value of } x \textrm{ such that } f(x) = a \textrm { where } a \ne 0
\textrm{let } y = 0
\Rightarrow f(x+y) = f(x+0) = f(x) = a = f(x)f(y) = f(x)f(0) = a f(0)
\Rightarrow a f(0) = a
\Rightarrow f(0) = 1

A great quote from Marcus du Sautoy, speaking to New Scientist in this article.

I think that our brain is evolutionarily programmed to do mathematics. Because that’s the way that you survive this world. Those who managed to understand geometry were able to avoid things being thrown at them and able to hit things that they wanted to aim at. Those who could count were able to assess whether to fight or flee – they could work out whether they were bigger than the other lot. So those who can do mathematics have survived.

When people say, “I don’t have a brain for mathematics,” I would say that’s not true – that everyone has a brain to do mathematics. [Popular chef] Jamie Oliver has done Anyone Can Learn to Cook in 24 Hours – maybe I should do.

For some reason, every time I tried to print CUPS was asking me for my username/password. This is fine when using applications which support this, and wasn’t enough of a hassle for me to bother with. Some applications however don’t have the capability to authenticate, and so it became an issue.

The solution is, however, trivial.
Open /etc/cups/printers.conf as root and comment out the line starting AuthInfoRequired like so:

<DefaultPrinter Canon>
#AuthInfoRequired username,password
Info This
Location Yes
...


then restart cups for the change to take effect.
On archlinux:
# /etc/rc.d/cups restart

After the upgrade to xorg1.5, my beloved keyboard map was once again rewritten, luckily I could salvage it from emacs’ backup files, but in the future I may not be so lucky, so thought I’d post here.

Keymap is fairly standard dvorak, with a few changes
– @ and ” placed in the ‘american’ places – I learnt with them there, so it’s strange to have ” on the 2 key now.
– added umlauts dead key and Eszett: ü ß…
– added thorn þ and mu µ for fun


partial alphanumeric_keys
xkb_symbols "dvorak" {
include "us(dvorak-intl)"

name[Group1]="United Kingdom - Dvorak";

key { [ numbersign, asciitilde ] };
key { [ 2, at, twosuperior, NoSymbol ] };
key { [ 3, sterling, threesuperior, NoSymbol ] };
key { [ backslash, bar ] };
key { [ apostrophe, quotedbl, dead_diaeresis, NoSymbol ] };
key { [ comma, less, acute, NoSymbol] };
key { [ period, more, grave, NoSymbol] };
key { [ s, S, ssharp, NoSymbol] };
key { [ t, T, thorn, THORN] };
key { [ m, M, mu, NoSymbol ] };
};

Ingredients

4oz sr flour
4oz sugar
4oz porridge oats
4oz margarine
1tbsp golden syrup
1tbsp hot water
1/2 tsp bic soda
pinch of salt

Instructions

  • Set oven to 180C
  • Mix together dry ingredients
  • Put margarine, syrup, water and salt into a pan, heat slowly until all melted
  • Add bicarb to pan and add resulting slightly fizzy liquid to the wet ingredients
  • Make into biscuit-y shaped things and back until they’re golden – underbaking is better than overbaking

Very very very slightly adapted version of a recipe here.

I can move to an empty tag, launch openoffice, go back to browser while it’s loading, and it’ll load on the tab I launched it on. Magic!

Add the following somewhere (pretty much anywhere, but after the inclusion of awful, and before the hook_manage function)

spawn = awful.util.spawn
move_to = {}
awful.util.spawn = function (spawnwhat, screen)
    screen = screen or mouse.screen
    local current_tag = awful.tag.selected(screen)
    move_to[#move_to+1] = {tag=current_tag, screen=screen}
    spawn(spawnwhat, screen)
end

Now add to hook_manage

if #move_to then
   c.screen = move_to[#move_to].screen
   awful.client.movetotag(move_to[#move_to].tag, c)
   move_to.remove()
end