Using Cartopy to draw maps and plot points

Let's do something simple but useful for geographical data science: drawing a map in Python. I will assume you are using the Anaconda distribution.

Unfortunately, there are many mapping libraries for different programming ecosystems and it's a little hard to find out which you should use. For a long time in Python, Basemap was the standard, but that project will soon be no longer maintained in favour of a newer library, Cartopy. That is what we will be using today, along with matplotlib. To install these in Anaconda, use:

Once you install these, here is minimal Python code to draw a map:
…read the rest of this post!

Linear models: reversing the predictors and the predicted

Consider $n$ observed data points $(x_1,y_1),\dots, (x_n, y_n)$. We think they might satisfy a linear model $y = ax + b$. Finding the coefficients $a$ and $b$ is called linear regression, and the most typical way to find them is the method of least squares: that is, we find $a$ and $b$ that minimize the sum
$$S = \sum_{i=1}^n (y_i-ax_i-b)^2.$$ This optimization problem can be solved exactly by solving the set of linear equations
$$\begin{align*}\frac{\partial S}{\partial a} = 0,& &
\frac{\partial S}{\partial b} = 0.\end{align*}$$ Doing this, we find that
$$a = \frac{\sum x_iy_i-\tfrac{1}{n}\sum x_i\sum y_i}{\sum x_i^2-\tfrac{1}{n}(\sum x_i)^2}.$$ Then we can use this to find that
$$b = \frac{1}{n}\left(\sum y_i-a\sum x_i\right).$$
…read the rest of this post!

Relax, PhDs: applying to 100+ jobs is normal

Applying for jobs after a PhD and my postdoc was one the weirdest things I ever did. I haven't written too much about it before, but because it is so bewildering I thought I'd give out some stats on how my application process went.

The most obvious statistic is the number of jobs to which I applied. In my last round of applications, after my postdoc in Australia, I applied for a total of 118 jobs. I recorded them all in a spreadsheet, although there might be 1-2 I forgot to write down since it was a hectic time. Why so many? Are all of them ideal? Obviously not. However, all of them would be something reasonable at least in the short term. (I think many employers probably know that too.) However, I still think it makes sense to apply to as many jobs as possible just because any increase in the probability of getting a job is a good one.

I did try and assign probabilities to my getting each job, and assuming the responses were independent, I got LibreOffice Calc to do a little probability calculation of my getting at least one offer. Haha. I also rated all the jobs I applied for into three categories: Excellent (5), Good (74), and Poor (39). I applied for 39 academic jobs and 79 jobs outside of academia.
…read the rest of this post!

A short survey of von Neumann regular rings

I've talked a lot about von Neumann regular rings on this blog, so I thought I'd write an informal short survey on them, collecting some facts we've already seen and many new ones. It should give you an idea of what von Neumann regular rings are. Most of the facts that I did not explicitly cite here are found in the book

Goodearl, K. R. von Neumann regular rings. Second edition. Robert E. Krieger Publishing Co., Inc., Malabar, FL, 1991. xviii+412 pp. ISBN: 0-89464-632-X

The definition

A von Neumann regular ring is an associative ring $A$ such that for each $x\in A$ there exists a $y\in A$ such that $xyx = x$. A popular alternative and equivalent definition is that a ring $A$ is von Neumann regular if and only if every left $A$-module is flat. This is in fact equivalent to every right $A$-module being flat. So we can just drop left and right here.
…read the rest of this post!

Roger Ming's theorem on von Neumann regular rings

We say that an associative ring $A$ is von Neumann regular if for every $a\in A$ there exists a $x\in A$ such that $axa = a$. That is a rather strange condition, isn't it? But, you can think of $x$ as a pseudoinverse to $a$. This weakening of inverses has a homological counterpart: if every nonzero element of $A$ had an inverse, every $A$-module would be free. This weakening of the inverse property weakens the free condition on modules: a ring $A$ is von Neumann regular if and only if every left (and right!) $A$-module is flat. Every free module is flat, just like if $A$ were a ring whose nonzero elements had inverses, then every element $a$ would have a $x$ such that $axa = a$.

There is another interesting way to look at von Neumann regular rings: through annihilators, a perspective that was noted in Ming's paper

Ming, Roger Yur Chi. On (von Neumann) regular rings. Proc. Edinburgh Math. Soc. (2) 19 (1974/75), 89—91

This perspective is based on the following observation: suppose $A$ is von Neumann regular. If $a\in A$, then by definition there exists a $x\in A$ such that $axa = a$. Rearranging gives $a(xa – 1) = 0$. On the other hand, if $t(xa – 1) = 0$ then $txa = t$ and so $t$ is in the left ideal $Aa$.
…read the rest of this post!

University of California: Goodbye Elsevier

On July 10, 2019, the University of California gave up its access to Elsevier journals. According to Elsevier,

The contract ended in December 2018. Since then, while working to find a solution, we have continued to provide access without payment to University of California campuses. Unfortunately, we've been unable to come to an agreement.

The University of California with its ten campuses is one of the latest universities to cancel their Elsevier subscriptions. Others that have cancelled part of all of their subscription include Louisiana State University, Université de Strasbourg, and the Max Planck Society.
…read the rest of this post!

Some thoughts on proof assistants

A proof assistant is a computer program that takes as input a proof in a formal language and outputs true if and only if the proof is a valid proof in a formal system. An example would be first-order logic with its inference rules.

Proof assistants are supposed to tell you whether your proof is correct. Every once in a while, I test one out for fun. Recently I noticed Lean, a proof assistant or theorem prover from Microsoft that I'd like to try. In the context of proof assistants, I think the ideal for most mathematicians would be to actually have an intuitive system where you could easily write proofs for the system and have your proof verified in seconds. We are definitely far from that goal. But proof assistants nevertheless pose some interesting questions: what is wrong with verifying proofs by hand, and what do proof assistants imply for the future of mathematics?
…read the rest of this post!

Sums of powers of digits

Take a number written in decimal, like $25$. Take the sum of squares of its digits: $2^2 + 5^2 = 29$. Can you ever get the number you started with?

In fact, no positive natural number greater than one is the sum of squares of its decimal digits. However, 75 is pretty close: $7^2 + 5^2 = 74$. Numbers greater than 1000 can't be a sum of squares of their digits because $9^2 + 9^2 + 9^2 = 243$. By checking all possibilities, you can verify that no natural number greater than one is the sum of squares of its decimal digits.

The situation is different for cubes. First, take a look at this graph of the sum of cubes of digits minus the original number:
You can't actually tell here, but there is a number that is the sum of cubes of its decimal digits. It's $1^3 + 5^3 + 3^3 = 153$. For fourth powers there is one too: $9^4 + 4^4 + 7^4 + 4^4 = 9474$. The number 4150 works for fifth powers, and 548834 works for sixth powers. For $k > 2$, is there a number that is the sum of its $k$th powers? If not, are there infinitely many $k$?

Automorphic representations: a short list of books

This is a short list of books to get you started on learning automorphic representations. Before I talk about them, I will first define automorphic representation, which will take a few paragraphs.

To start, we need an affine algebraic $F$-group scheme $G$ where $F$ is a number field or function field. We let $\A_F$ be the adeles of $F$. The idelic norm is defined as
\[|-| = \prod_v |-|_v:F^\times\backslash\A_F^\times\to \R.\] That is, the idelic norm is the product of all the norms where the product runs over all the places of $F$. We define
\[ G(\A_F)^1 = \cap_{\chi\in X^*(G)}\ker(|-|\circ\chi). \] That is $G(\A_F)^1$ is a subgroup of $G(\A_F)$ consisting of all elements $g$ such that $|\chi(g) = 1|$ for all characters $\chi\in X^*(G)$. The reason for introducing this subgroup rather than working with the full adelic group $G(\A_F)^1$ is representation-theoretic: the group $G(\A_F)^1$ is unimodular and under the unique-up-to-scale Haar measure, the quotient $G(F)\backslash G(\A_F)^1$ has finite volume, and therefore we can do a lot of representation theory compared to working with $G(\A_F)$.
…read the rest of this post!

Odd perfect numbers: lower bound

The first few even perfect numbersA perfect number is a positive integer $n$ such that $n$ is the sum of its proper divisors. For example $6 = 1 + 2 + 3$. The symbol $\sigma(n)$ is usally used for the sum of all the divisors of a positive integer $n$, so that a number is perfect if and only if $\sigma(n) = 2n$. All known perfect numbers are even, and they correspond to Mersenne primes. These are primes of the form $2^k – 1$. For example, if $k=5$ then $2^5 – 1 = 31$, a prime number. The correspondence between Mersenne primes and even perfect numbers is given by:
…read the rest of this post!