Upgrading to Mathjax 4
After realizing that the 2024 polyfill.io supply chain attack affected this website, I upgraded from Mathjax 3 to Mathjax 4. Also, Mathjax is now included without the previously recommended reference to polyfill.io.
Recent content in Home Page - Philipp K. Janert on Philipp K. Janert, Ph.D.
After realizing that the 2024 polyfill.io supply chain attack affected this website, I upgraded from Mathjax 3 to Mathjax 4. Also, Mathjax is now included without the previously recommended reference to polyfill.io.
For a brief time, starting after 01 June 2026 (when there was no apparent problem) and 18 June 2026 (when the problem first came to my attention), visitors to this site were faced with a spurious “Sign-In” pop-up, identifying itself as “polyfill.io”. This was a (late) consequence of the 2024 polyfill.io supply chain attack . If, by chance, you entered any credentials, you…
The Schrödinger equation in a wedge potential is one of the “standard” problems in Quantum Mechanics — standard, but not routine, as its solution involves the Airy equation, which is likely to be unfamiliar, at least until this precise moment. Because of this, it seemed interesting to look into this problem, and to find both its exact solution (involving the Airy function), but also to…
Gmail has its own ideas how to do things. Here are two small tricks that make it easier to use email with a local email client set-up.
I occasionally fantasize about an “ideal math curriculum” for Physics graduate students, based on my experience, in school and out. Which topics make sense, which don’t, what should count as reasonably expected knowledge, what is actually useful? There are also some textbooks, several of which having been published after I left school, that I would like to use (actually: like to…
Besides the Normal Distribution Function , I occasionally need the Airy Function Ai(x): it arises in perturbation theory and some other contexts. This function is most definitely not part of most standard numerics libraries! While high-quality implementations of it are part of most “serious” numerics libraries (such as SciPy or GSL ), these libraries are not always available or…
I recently got interested in singular perturbation theory , and to get help with the algebra, I turned to SymPy . I had tried to use Mathematica in graduate school in the early 90s, but the experience had been sufficiently frustrating that I had steered clear of computer algebra systems since. SymPy presents itself as a “friendly”, less intimidating alternative, with a more familiar…
Formal perturbation theory, and in particular singular perturbation theory, are standard topics in applied mathematics, but seem to be largely unknown outside that specific community. Which is a shame, because they are both useful, and intellectually fascinating. Perturbation expansions, in particular for higher orders, have a reputation for being “cumbersome”, as the say: the algebra…
It turns out, Caltech has made the Feynman Lectures available online on their website.
Occasionally, I like to drink hot chocolate — that is, real hot chocolate, from pure cocoa powder and whole milk; not some (sugared, flavored) drink mix. So, I was somewhat devastated when I learned that the venerable, time-honored Droste (those of the Droste Effect ) seems to have gone tragically out of business. Some replacement was required: at least as good as the original, and satisfying my…
I always thought that the “types” that are created using Go’s type keyword were, in some vague sense, new, unique, original; but in any case separate and distinct types . It turns out, this is a misunderstanding.
What does it take to stand up a minimal REST service in Go, using only facilities provided by the standard library? This is a useful fingering exercise, and also provides an opportunity to dive a little deeper into the net/http package. The net/http package can be a bit confusing at first, but once the appropriate idioms have been identified, the resulting code is actually quite compact and…
Der alte Dubslav von Stechlin wird gerne als Selbstportrait Fontane’s betrachtet. Liegt ja auch nahe: beides ältere Manner, Sympathieträger, und beides ausgesprochen “fontanesche Figuren”. Was denn sonst?
How does one actually read a plain text file in Go? Some searching through the standard library revealed the bufio.Scanner utility, which seems to be the most convenient way to accomplish this task.
I am currently working (again) on a larger writing project in Latex. Doing so made me revisit the Latex ecosystem, and I discovered several useful packages that I had not known before.
Erich Kästners Mutterkomplex ist bekannt, hinreichend dokumentiert, und sowieso nicht zu übersehen. Daher ist es interessant, dass es in seinen Kinder- und Jugendbüchern noch zumindest ein anderes durchgehendes Thema gibt, das aber nicht in der gleichen Weise erkannt zu werden scheint: in allen von Kästners Kinderbüchern treten Kinder auf, die von ihren Eltern verlassen worden sind.
The Token Bucket (or Leaking Bucket ) algorithm is a mechanism to rate-limit the average traffic in a stream, while allowing for a certain amount of burstiness as well.
The functional equation of the logarithm is well-known: \[ \log(xy) = \log(x) + \log(y) \] But why is this so?
When I discovered the first edition of Carl D. Meyer’s book on “Matrix Analysis and Applied Linear Algebra”, I considered it the best book on Linear Algebra I was aware of — and surely the best available book for an application-minded reader. In short: the book I really wished had been available when I was a graduate student and encountering this material for the first time. So…
The proof that $\sqrt{2}$ is irrational is part of the standard high-school curriculum. The same cannot be said for the proof that $e$, the base of the natural logarithm, is irrational as well. Yet the proof is short, simple, elegant.
Let a be a Go slice. Under what conditions is the following statement true: len(a) == 0 ?
Bernhard von Lepel ist für uns hauptsächlich interessant durch seine Freundschaft mit Theodor Fontane, und das meiste, das wir über ihn wissen, wissen wir durch Fontane. Fontane hat dem Freund ein langes Kapitel in seinen Jugenderinnerungen (Kapitel 8 von “Der Tunnel über der Spree” in “Von 20 bis 30”) gewidmet, und ihn auch sonst gelegentlich beschrieben — seltsamerweise…
Absence of Evidence is not Evidence of Absence.
Here is the situation: an application maintains an in-memory cache. The cache is accessed by two threads (goroutines) concurrently. The first one constantly tries to read from the cache: very busy. The other goroutine updates the cache, relatively rarely (maybe a few times an hour). What are some synchronization/locking methods and how do they compare?
The so-called “birthday paradox” concerns the fact that even in surprisingly small groups the probability for at least two people to share their birthdate is surprisingly high. The combinatorics of the Birthday Paradox are not hard; in fact, it is a standard example in introductory textbooks. Yet, the typical exact treatment provides no intuitive sense for the way the probability…
Having done extensive programming in C, I am not particularly spoiled when it comes to idiosyncrasies of a language’s “string” type. Yet, Go’s string types keeps tripping me up — why does it all still have to be that complicated?
Go request handlers typically include a “context” value as their first argument: func handler ( ctx context.Context, ... ) { ... } In my experience, this convention is typically fastidiously followed, but then nothing is ever done with that ctx argument. What is it really for? Unfortunately, the description in the official Go package documentation is a bit cryptic, and the type…
Every once in a while, I need to evaluate the normal distribution function $\Phi(x)$: $$ \Phi(x) = \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^x \! e^{-\frac{1}{2}t^2} \, dt $$ Unfortunately, it is not always available in the standard math libraries, and hence I have to implement a “good-enough” version myself. Here are some options.
I have never seen a software project in which the limiting factor was the speed with which programmers could type.
The default highlighting of the Emacs “region” (the part of a buffer between “point” and “mark” — selected text, if any, in other words) is, out of the box, barely visible, at least against a light background. An attempt to customize it runs into an interesting problem when used in a text- or terminal-based environment, rather than a GUI.
I wanted to explore some of the new features in Emacs 29 (in particular Eglot). The version of Emacs that ships with my version of Linux Mint is Emacs 27, so I decided to build Emacs 29 from scratch. This turned out to be absolutely painless; but installing the new version seamlessly into the existing environment did cause some hang-ups.
As it turns out, Emacs actually allows for different cursor shapes. We can use this feature to change the cursor based on the current minor mode.
Imagine a parking lot, consisting of a long, linear strip of slots. Cars enter at one end and leave by the other. Let’s also stipulate that each arriving car takes the first available slot that it encounters, that is, it will park in the first empty slot that is nearest to the parking lot entrance. Cars arrive randomly, with a given, average interarrival time $\tau_A$. Furthermore, cars…
A little while ago, I read (and quite enjoyed ) “Learning eBPF” by Liz Rice. “Linux Observability with BPF” David Calavera and Lorenzo Fontana is another, slightly earlier, book on the BPF framework, also published by O’Reilly.
A while back, I looked at the Diamond-Square Algorithm for terrain generation. That is a purely procedural algorithm that only attempts to generate realistic looking landscapes, without trying to model any physical or geological processes. By contrast, we will now look at an algorithm to generate realistic river networks, which is based on a (simplified) model of geological erosion.
The extended Berkeley Packet Filter , or eBPF for short, is a plugin architecture for the Linux kernel. Using eBPF, it is possible to load (short) programs into the kernel at runtime, and have them be executed by the kernel. As the name suggests, the technology started out as a method to build custom filters for network packets, but it has since been extended and become much more general.
Imagine a bunch of wood chips randomly distributed on a surface. Now add an ant, randomly walking around amongst the chips. Whenever it bumps into a chip, the ant picks up the chip; if it bumps into another chip, it drops the one it is carrying and keeps walking. How will such a system evolve over time?
A tool to display directory entries, sorted by size, together with their cumulative contribution to the total.
After seeing positive references to it on Linux Weekly News and elsewhere, I bought a copy of “Mastering Emacs” by Mickey Petersen.
On 08 April 2024, I drove up to Erie, PA, to see the total eclipse of the sun.
Go is weird. For all its intended (and frequently achieved) simplicity and straightforwardness, I keep being surprised by its rough edges and seemingly arbitrary corner cases. Here is one.
For every function, data type, or other such code artifact, there are two bits of code: the part that defines and implements it, and the one that uses it. As I have been thinking ( here and here ) about the proper use and understanding of Go’s interface construct, the question came up, who is actually responsible for writing the interface: the person who defines the data type, or the person…
I originally prepared this video as a guide for a relative of mine, but then was surprised how well it came out.
In response to a previous post , very insightfully, Steve Singer , pointed out that it is helpful to distinguish between three concepts, when talking about “interfaces” in general: Data types Capabilities Facades
I was recently reminded of the minimal set of project management artifacts and activities that are, in one way or another, simply indispensable . None of this is news: all of this has been well established for at least 25 years (a quarter-century!), so I was surprised that apparently it is still not common knowledge or practice — at least not as common as one would wish for.
The interface construct in the Go language is one of its most immediately visible features. Interfaces in Go are ubiquitous, but I am afraid that the best way to use them has not yet fully been explored. Moreover, in practice, Go interfaces seem to be used in ways that were not intended, and are not necessarily entirely beneficial, such as an implementation shortcut to the classic Handle/Body…
Let $G$ be a finite group with $n$ elements, and $H$ a subgroup of $G$ with $m$ elements. Then $m$ is a divisor of $n$: for a finite group, the order of any subgroup divides the order of the group.
What methods are there to connect an external (USB) drive or memory stick to a Linux box most conveniently?
In my previous post on one-dimensional heat flow , I encountered sums of the form: $$ \sum_{n=0}^\infty \frac{\pm 1}{2n+1} \exp \left( - (2n+1)^2 x \right) $$ A plot (involving the first 1000 terms) is shown below, and looks reasonable enough. Is this curve, which forms the limit of the series, a known function?
Imagine a rod that is initially at temperature $T_1$ and then brought into an environment with a lower temperature $T_0 < T_1$. How quickly does the body cool down? When will it have reached the environment’s temperature? What is the temperature profile throughout the rod, as a function of time? This is essentially a worked homework set: a complete, step-by-step solution of the diffusion (or…