Running a bash process on startup in ubuntu

Ubuntu has a place called “Startup Applications Preferences” which is one way to organise something that runs upon startup. It is found by typing its name in the searchy thingy I don’t know the name of, and is a bit GUIish.

Because I use a Kinesis Advantage keyboard, I wanted to automatically swap the roles of the Tab and Delete keys upon startup. Here I record how to do this.

In the aforementioned “Startup Applications Preferences”, I create a new process, with the command section filled in with

bash .xmodstartup

It remains to create a file called .xmodstartup in my home directory, which I populate with the following xmodmap commands

xmodmap -e 'keycode 119 = Tab ISO_Left_Tab'
xmodmap -e 'keycode 23 = Delete NoSymbol'

And voila, upon startup, the Tab and Delete keys are switched.

If I ever want to undo this, and return to the default keyboard layout, this can be accomplished with running the following in a terminal

setxkbmap -layout us

This blog post exists to help my future self solve the same problem when I forget, and hopefully may help others who stumble upon it while searching the web to try and solve the same problem as me.

Now, next thing to do is to understand how to make the Windows/Super key behave exactly as I want it.

Molecube (nine colour cube)

The molecube (also known as the nine colour cube, e.g. as on Jaap’s website) is a Rubiks cube variant. Here is a picture in its scrambled state (so no spoilers are given).

To solve the puzzle you must reach a state where there there are no two pieces of the same colour on any of the six faces. In terms of turning, it is exactly like a normal Rubiks cube.

It is not too difficult to come up with a valid solution, and even possible to come up with all solutions by hand (though I leave this as an exercise to the reader). I also leave as an exercise to the reader how to construct a mathematically equivalent puzzle with SET cards.

Since the puzzle turns exactly like the cube, if you can solve the cube, and can find a valid configuration (easy), this puzzle is unlikely to present a challenge.

I bought this puzzle while transiting at Changi airport. Changi has a program where you can receive a 20SGD shopping voucher when transiting on Singapore Airlines. The rules of this program are constantly being tweaked and it always has an expiry date, but the promotion has continually existed in some form for at least the past five years.

Singularities of Schubert varieties within a right cell

Martina Lanini and I recently posted our preprint Singularities of Schubert varieties within a right cell to the arXiv. In it, we show that every singularity which appears in a type A Schubert variety appears between two permutations lying in the same right cell. This shows that any behaviour controlled by the singularities of Schubert varieties manifests itself within a Specht module. Some exmples are discussed.

The work was conducted during our recent visit to the thematic trimester program on representation theory at the Institut Henri Poincaré in Paris. I spent an enjoyable first month there before returning to Australia. Originally I was scheduled to be on a plane right now to return to Paris for the end of the program, but alas this is no longer possible. Oh well.

Hierve El Agua and Mitla (day trip from Oaxaca)

I was recently at Banff in Mexico (a.k.a. Oaxaca) and had the opportunity to enjoy the following day trip. All information current as of December 2019.

What: Hierve El Agua is a pretty site in the mountains/hills not too far from Oaxaca (the city). There are natural springs coming out of the rocks that have been dammed at places to create artificial pools, and the water creates stalactite-like formations on the rocks. Entrance is 25 pesos.

Mitla is a town on the way to Hierve el Agua. Located in the town is a Zapotec archaeological site, second only to (but much smaller than) Monte Alban. Entrance is 75 pesos.

How: While you can do this as an organised tour or even extravagantly hire a taxi for the day, I will describe the bus route.

From Oaxaca, take the 2nd class bus to Mitla. These are reasonably frequent, are green and have the word Mitla on the front so are easy to spot. It can be caught anywhere along the route by hailing down the bus (there are stops, but it seems you can get on the bus wherever you want). I don’t know the full route of the bus, but it turns right onto highway 190 at the Parque de Beisbol by doing a right-left-right manouver around the stadium anticlockwise. Cost 20 pesos.

Waiting at Mitla’s 2nd class bus station are the collectivos to Hierve El Agua. They are impossible to miss. They wait until they are full, and then leave, so your travel time may vary. Officially the cost was 50 pesos. I paid 60 pesos on the way there (the extra 10 pesos was to take the toll road) and 72 pesos on the way back, which was the amount needed per person to leave early with only 7 passengers. I never had to wait long to leave but others in my returning vehicle were waiting for an hour, which helped encourage them to cough up extra money to leave early.

To Do: At Hierve El Agua there is a short hike (maybe ~1 hr?). It is a loop where you go down to the valley which gives you a better look at some of the rock formations. This hike is much easier done in an anticlockwise direction as the trail is easier to find that way. The best bits are all at the start of the hike when done that way. There are also free change rooms for changing to swim in the artificial pools.

Pictures: None. Let this be a warning to me to back up pictures from my phone in a timely manner.

Puzzled Pint

I wonder perhaps if Puzzled Pint is not as well-known as it should be.

It is a monthly event, run in pubs around the world where you and your team solve a set of puzzles while, naturally, drinking a pint.

In terms of difficulty, I’d say it’s on the easier end of the puzzling spectrum, much easier than the MIT mystery hunt or other puzzle hunts I’ve seen, instead more akin to the difficulty of a typical escape room, or perhaps a bit easier. But there’s no need to take my word for it, the archive of past puzzles is available online for you to peruse.

I am fortunate that two lovely ladies have taken it upon themselves to host an edition in Melbourne over the past year.

Happy puzzling,


We’re hiring

The University of Melbourne maths department is hiring. All our ads can be found on mathjobs.

In pure maths, we have a continuing position in analysis. Applications should be submitted by the earlier deadline of 25 October to ensure full consideration.

There are also other positions available in applied and statistics, as well as a temporary position open to all areas.

Sydney Mathematical Research Institute International Visitor Program

There is a new (established in the last couple of years) mathematical institute based at the University of Sydney. I want to call attention to a visitor program they run, for mathematical visits to Australia.

They fund research visits of at least one month’s duration. At least two weeks must be spent at the University of Sydney, but the rest can be taken anywhere in Australia.

Funding rounds for these research visits happen periodically. Currently there is one open for visits within the period April-December 2020, with applications closing on 28 July.

Anyone interested should check out the research intstitute’s webpage.

Megaminx IV

Long term readers of this blog will know of my frustration with low-quality megaminxes in years gone by, and even that I chose not to purchase one at the HKnow store in Causeway Bay in Hong Kong when it still existed. But I can now say that I am a proud owner of a QiHeng S Megaminx (stickerless, non-magnetic).

At some point in the past year, I discovered that the physical incarnation of was in a Melbourne suburb, in Blackburn North to be precise. So naturally I had to pay it a visit. Fortunately it is located very near to the Koonung Creek Trail, which makes for a pleasant ride to the shop.

As to be expected from the name, this shop specialises in all things speedcubing, at the expense of stocking more exotic puzzles for the serious collector. I finally decided I wanted a working megaminx, and with the rise of speedcubing, surmised (correctly as it turns out), that I would be able to get a reliable one at a speedcube shop. I chose a non-magnetised one since I won’t be trying to speedsolve it, but also walked away with a 3x3x3.

I was by far the oldest customer. How come so many kids are into cubing these days?

In the past, I have claimed that the megaminx is easy. Here is my simple solution.

1. Solve all but one layer and an adjacent corner-edge pair. This is intuitive and much more efficient if when solving a corner piece, you first pair it with an adjacent edge piece and insert them together.

2. Solve the remaining 6 edges. Intuitive. Easier than on the 3x3x3 since turning one face is a 5-cycle of edges, which is an even permutation.

3. Solve the remaining 6 corners using corner 3-cycles.

An efficient 4x4x4 parity algorithm, intuitively.

The 4x4x4 cube is more complicated to solve than the 3x3x3 due to having a parity problem. If you have never solved a 4x4x4 before, I encourage you to go away and try solving it yourself, then come back to this article later.

The parity I refer to is as follows (speedcubers call this OLL parity): After solving the centres of the cube, look at the 24 edge pieces. If they form an odd permutation, then I say we have a parity problem we need to fix. The reason this is non-trivial is that most/all of the easy to create algorithms that preserve the centres of the cube perform an even permutation of these 24 edges. Odd permutations are possible (in conjunction with performing simultaneously an odd permutation of the indistinguishable centre squares).

I will aim for the following: An odd permutation of the 24 edge pieces, with three of the four layers solved, and all the edge pairs on the last layer preserved. This is for compatibility with common approaches to solving the 4x4x4 – usually only after solving three layers and pairing the edges is it fast to recognise the existence of a parity problem.

Since we have to perform an odd permutation, let’s do that first and perform the move l. (I won’t define the notation but will link to so you can see the moves visually).

Our goal now is to solve as much of the cube from this state as possible using even permutations. Instead of thinking of needing to perform a quarter turn of half a cube, it will be more productive to think of us as needing to perform a 4-cycle of 1x2x3 blocks to completely solve the cube.

Now a 4-cycle of these blocks is not happening, but a 3-cycle of these blocks is easy to construct. It is well-known and easy to construct 3-cycles as simple commutators (here’s an example). We can also create block 3-cycles from similar simple processes. For example, here is a 3-cycle of 1x2x3 blocks:

[r’ 3Dw2 r, U2].

This doesn’t quite permute the three 1x2x3 blocks we’d want (we want to permute three all on the left side of the cube). We can get around that by conjugating by F r. So now we’re at

l [F2 r: [r’ 3Dw2 r, U2]].

Let’s look at where we are. Our biggest problems are that we have to solve the two centres on the F and D faces, and re-pair the UF and DF edges.

We will look at the centres first. The usual way to solve centres in this type of position is the simple 4-mover r U2 r’ U2. But look, that move also swaps the edge pairing of exactly two edges! So we look to see if some version of this algorithm in the right direction and right orientation can solve our two problems, and it turns our that we can with [D2, l]. So altogether we now have

l [F2 r: [r’ 3Dw2 r, U2]] [D2, l]

which solves our problem, giving us a parity fix algorithm.

When the cancelling moves are cancelled, it is 15 moves long.

l F2 3Dw2 r U2 r’ 3Dw2 r U2 r’ F2 D2 l D2 l’.

I will not discuss questions of optimising this algorithm for speed.

If one does look online for speed algorithms, then one will quickly come across something like the following (also 15 moves long)

r2 B2 U2 l U2 r’ U2 r U2 F2 r F2 l’ B2 r2.

Now that we’ve done our analysis, we can see the same structure in that algorithm, just in a different order. We see setup moves, the block 3-cycle, the 4-move centres solving and a single turn inserted to ensure odd parity.

Latex in WordPress

To activate Latex support in this blog, I have now activated the QuickLatex plugin. This has solved the problems with vertical alignment of mathematics that previously plagued this blog (only in new posts using QuickLatex, the back catalogue has not been converted).

The plugin webpage linked above shows its usage (for both posts and comments), allowing Latex to be typed natively once the word “latexpage” in square parentheses appears (so no inserting of the word “latex” after a dollar symbol anymore).