Filter Tags:

May 5, 2021•4 minute read

This post documents the implementation of the error function $\mathrm{erf}(z)$ used in my complex function plotter. For small $z$, I use the asympotic series by Abramowitz & Stegun. For large $z$, I use a custom expansion around the 45° line.

March 20, 2021•2 minute read

Today is the day I understood Yoneda’s lemma. Of course I’ve proven it several times before; in a sense the proof is trivial, since there’s only one thing you can do at each stage. But I never felt that I really understood what the lemma was saying, or why it should be true, until something clicked today.

November 19, 2020•4 minute read

I recently found a paper titled ‘A Cone Eversion,’ by S. Tabachnikov. I found it a bit difficult to see what was happening in 3D, so I made a visualization. Enjoy!

October 28, 2020•2 minute read

Here’s a nice solution of Putnam 1981 B5 that I haven’t seen anywhere else (so far). The main idea is to sum `bitwise,' rather than `termwise.'

Let $S_k$ denote the set of positive integers with the $k$^{th} bit set, counting from the right starting at $k=0$. Then we have

$\sum_{n=1}^\infty \frac{B(n)}{n^2 + n} = \sum_{k=0}^\infty \sum_{n \in S_k} \frac{1}{n^2 + n}.$

A bit of thinking shows that $n \in S_k$ if and only if $\lfloor 2^{-k} n\rfloor = 2m+1$ is odd. Thus the sum becomes

September 7, 2020•2 minute read

*Update 2020-09-08: This solution has been added to Kiran Kedlaya’s solution page.*

I've found an elegant geometry-only proof of Putnam 2003 B5, which, to the best of my knowledge, hasn't yet been discovered.

We begin with a diagram of the problem:

August 20, 2020•3 minute read

Inspired by Matt Parker’s recent video, I decided to search for primes $p$ with $\tan{p} > p$, the first of which is the 46-digit

$p = 1169809367327212570704813632106852886389036911.$

$p = 116980936732 \dots 886389036911.$

How do you go about finding more?

Well, we want $\tan{p}$ to be big — *very* big. From high-school trigonometry, we know that this occurs when $p$ is just a tiny bit less than a half-integer multiple of $\pi$. In other words, we want

August 1, 2020•9 minute read

How do you average (or sum) a lot of numbers, quickly?

More precisely, how do you do this on a webpage, preferably in real-time, when your values are stored as pixels in a large image? In general-purpose applications, we have access to the massive parallelization capabilities of GPUs with CUDA or OpenCL — but on the web, we’re stuck with WebGL and fragment shaders.

One possibility is to write a fragment shader that repeatedly downscales the image by a factor of 2, where each output pixel is the average of the four pixels in its preimage. Assuming each render takes constant time due to GPU parallelization,^{[1]} this technique can average an $n \times n$ texture in $\log_2{n}$ time.

July 29, 2020•2 minute read

It’s well-known that the period of a simple harmonic oscillator (SHO) is independent of its oscillation amplitude. But is this the only oscillator for which this holds?

No. A simple counterexample is the SHO + ‘brick wall’ potential: