# What's inside the Klein Bottle?

## Random wanderings in the abstract world of mathematics and beyond

Recently I was talking to a new software engineer who is trying to learn Rust.
They felt like they had a good grasp of the basics and wanted to write a small application to test their skills.
My suggestion was that they code up a matrix struct (and later, a trait) that encapsulates the behaviour expected of a general matrix.
This seemed like quite a fun task, so I had a go too.

Lately I’ve been writing a lot of library code for working with streams of data to expand the esig package for Python. This is a Python C++ extension that acts as a bridge between the low-level C++ library libalgebra where computations happen and the Python world where people tend to work with data. The gap between static (compiled) types of libalgebra and C++ templates and the dynamic (runtime) types of Python is about as large as it can be, and ultimately this relies on a giant switch statement and some careful encapsulation.

On of my main responsibilities in my job as a research software engineer is maintaining and developing a C++ library for computing in abstract algebraic objects called libalgebra (link). This is a mature and fairly complete library in terms of its capabilities, and it has excellent support for the tensor algebra and Lie algebras. However, it was mostly written a long time ago, and it doesn’t take advantage of more recent features of C++ (even those in C++11).

Last year I stopped using Wordpress and move to using a static site generator (Lektor) to manage my website. I’ve been fairly happy with this choice, even though I’ve hugely neglected my blog over the past year. This is something I hope to rectify.
The biggest problem I had was that the design of the last attempt was terrible. I am not blessed with good design talent, so my attempts to make a website inevitably failed to make something that functioned properly and didn’t look terrible.

Recently I’ve been doing a lot of Sudoku puzzles, following the discovery of the Cracking the Cryptic YouTube channel. I’ve always enjoyed Sudoku and they have served to entertain me during long journeys for many years. However, I’d never encountered any of the newer variants of the original puzzle such as “chess Sudoku” or “thermo Sudoku”, where the placement of a value is restricted based on what values are within a standard chess move or the position on a “thermometer”.

I’ve been thinking recently about moving my blog from being hosted as a Wordpress site and instead deploying a custom made app using Python behind the scenes.
My first idea was to try and build a Django app, built completely from scratch, which made for some interesting experimentation. Unfortunately, I quickly realised that the limiting factor in building a new website from scratch was not my skill at writing Python code, but in making the html templates to make the page look the way I want.

LaTeX is a great tool for producing high quality documents, but it can sometimes be rather cumbersome for producing things like matrices, which hold large amounts of information in an array with many rows and columns. This is made especially frustrating when the matrix you wish to format has been computed using Python and Numpy, and is right there on the PC. I thought that writing a small Python function that formats a Numpy array into LaTeX syntax would be a nice, easy exercise in the Python course (for first year mathematics students) that I teach.

I recently attended a workshop on the grant application procedure ran by the Engineering and Sciences Research Council (EPSRC). The EPSRC is one of several UK research councils and is responsible for funding research across engineering, science, and mathematics through a number of grant and fellowship schemes. I went to the workshop with many questions, and misconceptions, about the grant review process and how funds are allocated. I’m happy to say that I learned a lot, and most of my questions were answered.

I heard an interesting thought experiment on a podcast some time ago, but I am not sure of the origins of the problem. This problem is the napkin ring problem. Despite hearing this problem some time ago I have only just found time to convince myself that it is true, surprising as it is. I thought I would share the solution since it is a lovely application of multiple integrations. The problem is as follows:

I’ve recently become somewhat interested in smooth manifolds and surfaces as a result of preparation for various interviews, amongst other reasons. The concept of a surface is very intuitive, and is a concept that a student of mathematics is likely to encounter very early in their mathematical careers, though a reasonable definition of a surface takes more effort. The result of this formalisation is a remarkably elegant theory, which eventually leads to ideas of smooth manifolds - arguably one of the best sounding mathematical objects - and generalised calculus.