Please Do QR Codes Properly

QR codes do not expire. QR codes do not have a limit on total scans. QR codes do not allow their creators to track you when you use them, or monetize that process.

Read More

The Machine is Sick

When I have computer problems, as I often do, my usual response is somewhere on the spectrum from frustration to anger. This usually works pretty well as a motivator. A few months ago, I called a friend and told him that I was chasing down a subtle bug and it was difficult to keep up my motivation. “Michael,” he immediately told me, “You have to name it.” So I did. I picked a name more or less at random, and immediately I was emotionally ready to go again. Fred was not going to keep me down. I was going to get him if it were the last thing I did. I had a correct code by the end of the next day.

Read More

Jupyter and CUDA on NSF Jetstream

NSF ACCESS is a fantastic high-performance computing program. If you’re affiliated with a university or other institution, you can upload a CV, write a paragraph describing your project, and get approved for several thousand CPU-hours within just a few days. If you don’t have existing grants it’s totally free. It even works if you’re a grad student, although then you’ll need your advisor to provide a form letter saying that you’re legit. But they even have suggested language for that.

Read More

Introducing ConGrad: Backend-Agnostic Conjugate Gradients in Python

When working at scale, it is often slow or impossible to form full-sized matrices. Instead, we make use of black-box functions to calculate matrix-vector products \(Ab\). There is thus a need for solvers which accept these functions instead of requiring matrix representations of our linear maps – and, in particular, for conjugate gradient solvers for the symmetric positive definite case.

Read More

In Which the Riesz Representation Theorem is Very Mysterious

Define \[\langle p, q \rangle = \int_{-1}^1 p(x)q(x)\,dx\] to be an inner product on \( \mathscr{P}_n(\mathbb{R}) \), the space of polynomials of degree at most \(n\) with real coefficients. Note that \(\varphi(p)=p(0)\) is a linear functional on \( \mathscr{P}_n(\mathbb{R}) \). Therefore, by the Riesz representation theorem, there must exist a unique polynomial \(q_n(x)\) such that \[\int_{-1}^1 p(x)q(x)\,dx = p(0)\] for all \(p\) with degree at most \(n\).

Read More

Generating Permutation-Respecting Partitions

One of the fun things about being specifically an applied mathematician is knowing when my colleagues are dealing with a combinatorial explosion. Recently, a friend of mine asked me if there were an easy way to determine how many of the partitions of a set of sixteen fixed elements obeyed a certain set of conditions. Doing this with brute force was a non-starter: there were over \(10^{10}\) of them, and if we were able to check sixteen thousand partitions per second the calculation would still have taken more than a week.

Read More

Sales Tax and Geometric Series

It is known that, for \(\vert r \vert<1\), \(\sum_{n=0}^\infty ar^n=\frac{a}{1-r}\). The usual proof goes something as follows: let \(S=\sum_{n=0}^\infty ar^n\). Then \(rS=\sum_{n=0}^\infty ar^{n+1}=\sum_{n=1}^\infty ar^n\). Subtracting, \(S-rS=\sum_{n=0}^\infty ar^n-\sum_{n=1}^\infty ar^n=a\), so \(S=\frac{a}{1-r}\) as required. It’s very elegant, but it seems a little bit magical.

Read More

A Linear Independence Problem from Mrs. Perrett

Back in high school, I had a math teacher called Shirley J. Perrett. (She would introduce herself as “Mrs. \(Pe^2r^2t^2\), but not in that order.”) She had a textbook called A2 Core Maths for Edexcel, by Emanuel, Wood, and Crawshaw. And that textbook had a problem in chapter 15 that none of the students Mrs. Perrett had ever taught had solved without hints.

Read More