Posts

Parallel Transport - a metaphor for how people change their minds

Image
  How do we change our minds?  We like to think we're reasonable people - that we listen to the argument and if it is good enough we change our minds!  According to Carl Sagan that barely ever happens outside of science: "In science it often happens that scientists say, 'You know that's a really good argument; my position is mistaken,' and then they actually change their minds and you never hear that old view from them again. They really do it. It doesn't happen as often as it should, because scientists are human and change is sometimes painful. But it happens every day. I cannot recall the last time something like that happened in politics or religion." -- Carl Sagan, 1987 CSICOP keynote address So what about the rest of the world?  People do change their minds, so how do they go about it?  It occurred to me that a good metaphor for the mechanism is a concept from general relativity.  The concept is Parallel Transport and the animation above illustrates

Parkinson's Law - a correction

 

Why do climate models vary so much?

Image
It may be a sign we're close to one or more tipping points The latest report from the Intergovernmental Panel on Climate Change is known as Assessment Report 6, or IPCC AR6 for short.  Rather than contain new research, AR6 summarizes the latest work of climate scientists, and synthesizes thousands of papers.  An important element of this are the climate models.  The climate models examined by AR6 are called CMIP6 models, for Coupled Model Intercomparison Project v6. Climate models can provide answers to "what if?" questions.  Some of these What Ifs are described by the IPCC in their Shared Socioeconomic Pathways, or SSPs for short.   But these What Ifs combine questions about physics (how the Earth will respond) with assumptions about our future behaviour.  What we would like is to be able to factor out the human influence and get a single number that measures just how sensitive the Earth's climate is to CO2?  That's where Equilibrium Climate Sensitivity (ECS) com

Resistance between two points in a plane

Image
I got well and truly nerd sniped the other day when my friend showed my this XKCD cartoon Credit: XKCD.com

 Lanchester's laws and Risk

Image
  Credit: Colony of Gamers/Flickr   My family settled down to a perfectly civil game of Risk this Christmas.  At one stage my wife, who controlled most of Asia, challenged my total control of Australia by attacking my territory of Indonesia from her territory of South East Asia, with about 100 armies. Attacks in Risk consist of a series of "battles".  In the initial battles two armies are always lost: either two attackers, two defenders, or one of each.  After enough battles either one defending army remains or two attackers.  From this point on only one army is lost per battle.  Eventually either the defender is completely obliterated or the attacker reduced to one army (which is needed to defend the originating territory) and the attack is over. In the initial battles (when the attacker has at least 3 armies remaining - not including one set aside to defend the originating territory - and the defender at least 2) the attacker rolls 3 red dice and the defender 2 blue dice. 

Pythagorean Triples

Image
A Pythagorean triple is a set of three non-zero integers $a,b,c$ satisfying Pythagoras' formula $$ c^2 = a^2 + b^2 $$ Pythagoras certainly wasn't the first to know that this formula applied to the sides of right angled triangles, or to compile lists of Pythagorean triples, but he may have been the first to present a proof .  In this post I'm going to show a simple method of finding all Pythagorean triples, using complex numbers. First we need to introduce Gaussian Integers .  These are complex numbers $z=a+ib$ where $a,b$ are integers.  If $z$ is any complex number then, since multiplication is commutative, $$ (zz^*)^2 = z^2(z^2)^* $$ However, in the case where $z$ is a Gaussian Integer the LHS is a square of an ordinary integer, and the RHS is the sum of two squares of integers.  For it to be a sum of two non-zero squares we need $z^2$ to be neither purely real or purely imaginary, or equivalently, that $z$ is neither purely real, purely imaginary, or on a diagonal $a =

Below absolute zero

Image
Is it possible to bring a temperature below absolute zero? And if so, what does, say, -1K look like? Surprisingly, negative temperatures are in fact possible, but only in some circumstances. To understand how, we need to get a better idea of what temperature actually means from a statistical thermodynamics point of view. Suppose you have a system of $N$ particles$^{\dagger}$, each of which can have an energy level from a discrete list $$ 0 < E_1 < E_2 < E_3 < ... $$ Now suppose that there are $N_1$ particles in state $E_1$, $N_2$ in $E_2$ and so on. Using combinatorics$^{\dagger_2}$ we can see that the number of ways this particular configuration can be achieved is given by $$ \Omega = \frac{N!}{N_1!N_2!N_3!...} $$ The next question is: if we know the total energy of the system $E_{total}$ can we work out the distribution of particles across the energy states? Well, we know the most likely distribution is that which can be achieved in the greatest number of ways. I.e. we

Two things I didn't expect to see at the London Climate Technology Show

Image
The Saudi British Joint Business Council and... ...a Perpetual Motion machine!   I spent yesterday wandering around the London Climate Technology Show, and I had many interesting conversations.  There were way too many middlemen selling questionable climate offsets.  These all provided an account and a fancy online dashboard for companies wanting to demonstrate their carbon neutrality.  At least 4 of the companies were using Blockchain as a buzzword.  The idea is that you write a contract with the farmer/landowner/whatever to improve soil carbon/not cut down trees/whatever and then you sign that contract and put it in an online ledger like the Ethereum blockchain.  This prevents the existence of the contract being denied and enables ownership to be transferred, like with digital coins.  Although in principle this can work it requires a single joined up database.  With multiple companies offering the same service, but on incompatible systems, there's nothing to stop an offset bein

Wordle

Image
Programmers: first they ruined chess, now they ruin ... Wordle (Okay, so ruining chess is a bit harder) Step 4 was a sacrifice move I got stuck yesterday doing Wordle and I couldn't think of a single word that might work.  So... I wrote a short script to prompt me with suggestions.  I've noted that, so far, the solution has never been a plural.  So it's probably a good idea to take the first suggestion that doesn't end in 's'. And here it is:

Guesstimating the distance to the moon

Image
Here's a neat trick for estimating the distance to objects.  Stick out your thumb and look at it with just one eye open, then with just the other eye open.  The distance to the object is the distance it appears to jump multiplied by 10 .  This works because the distance from your eyes to your thumb on your outstretched arm is about 10 times the distance between your eyes.   I thought I'd have a go at using this to measure the distance to the moon

Higher dimensional shoelace theorems

Image
Here's a nice theorem by Gauss The (2D) shoelace theorem Suppose $\mathbf{x_1},\mathbf{x_2},...,\mathbf{x_n}$ are ordered vertices of a polygon.  Let $x_i, y_i$ be the coordinates of $\mathbf{x_i}$ and define $\mathbf{x_{n+1}}$ to be $\mathbf{x_1}$.   Then the area of the polygon is plus or minus $$ \frac{1}{2}\sum_i{x_iy_{i+1} - x_{i+1}y_i} $$ This formula gives rise to the name of the theorem as shown by the illustration below Proof We're going start off by proving the simple case where the polygon is a triangle.  The first thing to notice is that if you take any two adjacent vertices, .e.g. $\mathbf{x_1}$ and $\mathbf{x_3}$, they form a triangle with the origin.  This has an area equal to half of the parallelpiped formed by the two vertices (treated as vectors from the origin). And the area of the parallelpiped is plus or minus $det(\mathbf{x_1}\vert \mathbf{x_3})$, with the sign being positive if the columns taken in order produce an anti-clockwise motion around the origin.

Limits to Economic Growth

Atmospheric methane per head of cattle

Image
Rough and ready order of magnitude calculation: Cows burp 100kg methane each year, which lasts 10 years before decaying in the atmosphere, and has about 100x the warming potential of carbon dioxide while it's up there. Cows (and other ruminants such as sheep) continuously burp CH$_4$, a powerful greenhouse gas.  In fact, gram for gram methane warms the planet 87 times more than carbon dioxide .  However, CH$_4$ reacts in the atmosphere so that the carbon atom eventually finds itself in a CO$_2$ molecule.  We can think of it as having an atmospheric half life of about 8.6 years .  For this reason, the Global Warming Potential (GWP) of methane is sometimes averaged over 100 years to give a GWP100 figure of 27-30, i.e. twenty seven to thirty times as powerful (over 100 years) as carbon dioxide. Methane enters the atmosphere from a number of sources.  Two significant ones are biogenic sources such as cows, and fossil sources, such as when unwanted methane is flared by oil rigs, or when

mpool

Image
An overhead free aligned memory allocator (Well, almost overhead free)      I designed this memory allocator for a Linux device driver I wrote 20 years ago .  It has the property that if you ask for 64 bytes you get a 64 byte aligned block; if you ask for 128, you get a 128 byte aligned block; and so on.  The other nice thing about it is that it automatically defragments, which is to say that if, for example, a 128 byte aligned 128 byte block is free then it can be allocated as a 128 byte block, even if it one or both halves have previously been allocated as 64 byte blocks and later freed. The key to the design is the data structure.  Each free block has a 64 byte header consisting of 16 pointers (I wrote this for a 32-bit architecture, although it could easily be ported).  For this reason 64 bytes is the smallest block size that can be allocated.  The pointers are all either NULL or point to another free block of the same size, forming a 16-ary tree of equal-sized free blocks.  At th

Everything, Everywhere, All At Once

Image
What's going on right now, 70,000 light years away on the nearest galaxy to our own, Canis Major?  Or put it another way, if we're at $x = y = z = t = 0$, what's happening at $y = z = t = 0$ and $x$ = 70,000 light years? According to Einstein's special theory of relativity it depends who you ask.  The most natural coordinates to use depend on your inertial frame.  Sitting in frame $S$, I may use the coordinates $x,y,z,t$ but someone in frame $S'$ would need to use $x',y',z',t'$ in order to observe the universe operating according to the same physical laws.  To make it more concrete, imagine $S$ and $S'$ share their $y$ and $z$ axes, and $S'$ is moving at velocity $v$ along the $x$ axis of $S$.  In this case the transform for converting between the two reference frames is $$ \begin{align} x' &= \frac{x - vt}{\sqrt{1-\frac{v^2}{c^2}}} \\ y' &= y \\ z' &= z \\ t' &= \frac{t - \frac{vx}{c^2}}{\sqrt{1-\frac{v^2}{c^

Principal Component Analysis - A Geometric Approach

Image
Overview Principal Component Analysis is a neat statistical trick, with a simple bit of linear algebra backing it up.  Imagine you've got a dependent, or response variable, $Y$ and a large number of independent, a.k.a. explanatory, variables $X_1, ... X_p$.  You also have $n$ measurements of each, giving you a matrix $$ \begin{align} X = & \begin{pmatrix} x_{11} & x_{12} & ... & x_{1n}\\ \vdots & & & \\ x_{p1} & x_{p2} & ... & x_{pn}\\ \end{pmatrix} \\ = & \begin{pmatrix} -\mathbb{x_1}- \\ \vdots \\ -\mathbb{x_p}- \\ \end{pmatrix} \\ \end{align} $$ You want to build a model explaining how $Y$ depends on the $X_i$, perhaps a linear model like $$ Y = \beta_0 + \sum_{i=1}^p \beta_i X_i $$ but first you need to check that the $X_i$ are more or less independent of each other, otherwise there's no way of uniquely setting the $\beta_i$ values and the stats package is likely to produce an unreliable output.  In general the $X_i$ are not inde

Ubuntu hack

Image
Getting the faffing auto-suspend feature working properly I use Ubuntu on all my computers and it always works 99% well.  But there's always one minor issue that I could live with, were it not for my pathological perfectionism.  On this one it's the auto-suspend, which just wasn't working at all.  This computer lives in the living room and I don't like any noise pollution there, or the idea of pointlessly consuming power.  I think the ethernet card was continuously keeping the machine awake, even if auto suspend was enabled in System Settings -> Power Management .  Eventually I found a solution Add a startup program via Preferences -> Startup Applications Disable auto suspend Log out and back in again (or reboot) For the disabling of auto-suspend I actually just removed the power manager altogether with sudo apt remove mate-power-manager .  If you're using gnome instead it's probably sudo apt remove gnome-power-manager .  The one-line startup program was

Taking Liberties

Image
This Go problem was presented to me by my Tsumego Pro mobile app this morning.  It's not particularly difficult, but I think it nicely demonstrates some ideas about liberties. It's Black's turn to go, and it's pretty obvious that a race is on, and the winner is going to take some stones.  If Black wins it'll take the 3 white stones in a row, and if White wins it'll take the six connected black stones just below. A connected group of stones is taken prisoner when the other player removes it's last "liberty", i.e. the last place into which that connected group can grow.  At the moment White has 4 liberties and Black has 3.  So it would seem Black is on to a loser, since the players can just take turns removing one liberty at a time from each other's stones.  However, it's not quite as simple as that. Black's move can leave White's liberties unchanged or reduce them by one. It can also leave it's own liberties unchanged or reduce t