Posts

AI from scratch

Image
My first neural net Like everybody else I've been playing a lot with ChatGPT recently and I'm gobsmacked by how good it is!  This has led me to start researching how exactly these things work.  In particular I wanted to understand how neural nets - a core component of the technology - are trained. Running a neural net is simple.  The neural net consists of layers of nodes connected by weights and biases.  The first layer is an input layer and setting the activation levels of each node in that layer causes the next layer to adopt values determined by the weights and biases.  The second layer determines the activation levels in the next layer and so on until the final layer, which is interpreted as the output. 

Dobble Connect

Image
    I was given a new version of Dobble for Xmas called Dobble Connect.  Dobble consists of stack of cards with pictures on it where each pair of cards has one match, and each pair of symbols appears on one card.  This is a new version which has 91 symbols in total, 10 symbols per card, and 91 cards.  The fingerprint of the original Dobble was (57 symbols, 8 symbols, 57 cards). An additional innovation in Dobble Connect is that the cards are hexagonal and grouped into a colour per player.  Players build a tiling on the tabletop, placing cards next to each other as soon as they spot a matching symbol between their top card and one of the cards already placed.  The first player to get four of their own colour in a row wins. How is it possible for each pair of cards to have one and only one symbol in common, and for each pair of symbols to appear on one and only one card?  Does that have something to do with the strange number 91?  The answer is "yes" and it turns out this is o

Point of view switcheroo

Image
Rolling marbles  Here's a puzzle: Suppose you have N identical marbles rolling along a one dimensional table-top.  Each marble is randomly rolling to the left or to the right, all with the same speed.  Collisions are elastic, which means the marbles just change direction.  What is the maximum amount of time before all the marbles have rolled off the table? 8 marbles with speed 1 on a table of length 1 Answering this question is really difficult if you simply pick an individual marble and try to work out how long it might stay on the table as it bounces back and forth.  But there's a simpler way to look at it. Prior to each collision you have one marble rolling to the left and one to the right, and afterwards you still have one rolling to the left and one to the right.  If we swap labels following each collision then the labels never change direction.  Now it's easy to see that the answer is the same whether there are 100 marbles or just one.  And all we did was switch our P

Calculation of ECS using simple convection model

Image
Contents Intro Simple stratified model Alternative convection model Tropospheric temperature gradient Approach used in convection model Calculation of Radiative Forcing from CO₂ increase Calculation of Radiative Forcing from H₂O increase Calculation of zero-feedback ECS Effect of including feedbacks Effect of water vapour Effect of cloud cover change Effect of sea ice loss Calculation of ECS including feedbacks Limitations One more thing: Changes to Troposphere depth Intro The goal of this post is to see if we can come up with an estimate of Equilibrium Climate Sensitivity using a simple model in which the atmosphere is treated as well-mixed.  By "simple" I mean that using the model will not require any advanced mathematics or computation, but will still be realistic enough to come up with an estimate within the likely range of 2.5 - 4.0°C predicted by the IPCC Assessment Report 6 .  I will try to take as little on trust as possible and show how the results are arrived at.

Regular solid clock

Image
A while ago I was pondering the symmetries of Platonic solids and a strange thing occurred to me.  The number of rotational symmetries for the tetrahedron, cube, octahedron, dodecahedron, and icosahedron are 12, 24, 24, 60, and 60 respectively $^\dagger$.  These happen to match the number of hours in an afternoon (I'm told mornings have the same number), the number of hours in a day, the number of minutes in an hour,  and the number of seconds in a minute. This is probably a coincidence due to the fact that the Babylonians (who created our time system) used base 60, and 60 is divisible by a lot of small numbers.  But it's nice to imagine, and just possible, that they were thinking about regular solids when then came up with the system for measuring time.  It's just turned midnight When this occurred to me a picture jumped into my head, which I've tried to recreate above.  It's a clock built from platonic solids.  Every second one or more of them rotates and the numb

Cayley graphs for all orthogonal symmetries of Platonic solids

Image
Generator symmetries c, b, and a, applied sequentially to the octahedron, resulting in a composite operation of order 2 I've become a bit obsessed with Cayley graphs recently. I figured out a way to construct a graph for the rotational symmetries of the 5 Platonic solids, and the result was quite elegant, I thought.  And it seemed to me that extending this to the complete set of  orthogonal symmetries (which includes reflections) should be quite simple - it is just twice the number of nodes after all.  However,  it took a surprising amount of staring into the middle distance and mumbling to myself to come up with the answer. And I'm going to describe its construction in this post.  As an example I'm using the octahedron here,  but the construction works in exactly the same way whichever solid you choose.  My generators I'm calling $a$, $b$, and $c$, where $a$ is a clockwise rotation of a face,  $b$ is a clockwise rotation around an adjoining vertex,  and $c$ is a reflec

Cayley graphs for rotational symmetries of Platonic solids

Image
In the previous post I used a short python program to draw a Cayley graph for the rotational symmetries of the cube.  The result was a rhombicuboctahedron, a kind of cross between a cube and an octahedron. Now,  these two platonic solids are "duals" of each other, which is to say that if you start with one and draw a node for each face,  and an edge for each pair of faces that meet, you end up with the other! Is there a pattern here? Can we choose generators for the rotational symmetry groups of the other platonic solids so that the resulting Cayley graphs look like crosses between the original solids and their duals? First let's see if we can find a generic representation for the rotational symmetry group.  Let's assume our solid has $n$ sided faces and the vertices are all of degree $m$. If $a$ is a clockwise rotation about one face and $b$ is a clockwise rotation about an adjoining vertex then $ab$ flips an edge about its midpoint, which implies $(ab)^2=1$. This su

Creating Cayley Graphs from Group Presentations

Image
Definitions: A Cayley graph is a directed graph showing how to get from any element of a group to any other using only a finite number of "generator" elements.  For example, in the group $\mathbb{Z}_2\times\mathbb{Z}_2$ we could use the generators $a = (1,0)$ and $b = (0,1)$ and we'd end up with a graph that looks like a square with arrows going round the edges. A Group presentation defines a group by specifying generators and relations between them.  For example the presentation $\langle a,b \vert a^2=1,b^2=1,aba^{-1}b^{-1}=1\rangle$ specifies a group.  In fact the group it specifies is isomorphic to  $\mathbb{Z}_2\times\mathbb{Z}_2$ and we can prove this using the facts that $a$ and $b$ commute and both have order 2.  In this case it's easy to see what group we have but in general it's a bit more difficult.  A useful first step would be to be able to draw the Cayley graph automatically. Question: Is it possible to automatically generate a Cayley graph from a g

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 =