positing variable precision

A semicircular arrangement of numbers
and bit patterns.

From this year's "summer of math exposition" collection , an explainer on the posit, a variable-precision representation of floating-point numbers.

The posit uses fewer bits to encode small exponents, so numbers whose magnitude is roughly unity can get a few extra bits of precision in the mantissa.

The intuition that most floating-point values have magnitude roughly unity is certainly consistent with my experience, and also consistent with guidance that I have received from various computing mentors. But it would be interesting to build a virtual CPU and monitor which values enter the FPU during normal operation, to check.

all linguists are liars

Book cover: "Don't believe a word," by David Shariatmadari

This book looks like a lot of fun. An excerpt (emphasis added):

"Etymology for its own sake is of little importance, even if it has curiosity value … the chief difficulty is that there can be no 'true' or 'original' meaning since human language stretches back too far." We have to agree with the latter — but the former seems absurd.

It's worth asking at this point why etymology is so seductive. For most people it represents their first (and frequently only) encounter with linguistics. As we know, words are at once completely prosaic — we use them every day, mostly without thinking — and rather mysterious. As a result it's natural to ask where they come from. We weave stories around their origin, both patently false ("lol" and "golf") and more plausible ("decimate" and "educate"). That curiosity shouldn't be dismissed: it's a knocking at the door of linguistics. If they shut it in people's faces, the guardians of knowledge about language risk closing off a route to both enlightenment and wonder. As a result, people seek their wonder elsewhere — in false accounts of how language works.

In any case, it isn't right to see etymology as some poor relation to "proper" linguistics. An attempt to explain why the meanings of words change is an attempt to explain how the mind works, how language works, and how society works. Perhaps this is why it has been deemed out of bounds.

Hat tip.

the fastest bird in the west


        An air-to-air overhead front view of an SR-71A strategic
        reconnaissance aircraft. The SR-71, unofficially known as the
        Blackbird, is a long-range, advanced, strategic reconnaissance
        aircraft developed from the Lockheed A-12 Oxcart and YF-12A
        aircraft. The United States Air Force retired its fleet of SR-71s
        on Jan. 26, 1990, but returned them in 1995 until
        January 1997. Throughout its nearly 24-year career, the SR-71
        remained the world's fastest and highest-flying operational
        aircraft. Location: Beale Air Force Base, California,
        USA. Evaporating fuel can be seen streaking down the fuselage and
        top of the wings from the aerial refueling port aft of the
        cockpit.

Here's a delightful little story about the SR-71 Blackbird, attributed to Major Brian Shul, USAF (Retired), that I'm going to duplicate here so that it's less likely disappear from the internet.

You can listen to Shul tell the story in a Youtube video, if that floats your boat (or flies your plane, I suppose). Doing both is amusing because the reported speed seems to have gotten larger as Shul has retold it. All good stories grow in retelling.

There were a lot of things we couldn't do in an SR-71, but we were the fastest guys on the block and loved reminding our fellow aviators of this fact. People often asked us if, because of this fact, it was fun to fly the jet. Fun would not be the first word I would use to describe flying this plane. Intense, maybe. Even cerebral. But there was one day in our Sled experience when we would have to say that it was pure fun to be the fastest guys out there, at least for a moment.

Read more…

it's only fitting

Here's a quick-n-dirty Gaussian curve fitter, which I seem to reinvent about twice a year. There are a number of canned solutions that I can never remember how to use, but I also frequently find myself wanting to fit weird functions.

Below in a minimum working example. But the short-short version is

def func(x, *params): ...
x,y = read_some_data()
guess_params = [...]

from scipy import optimize
better_params, covariance = optimize.curve_fit(
    func, x, y, p0=guess_params)

Read more…

fractal time and time again

In the Mandelbrot set — that is, the complex numbers $c$ for which the recurrence

$$\begin{aligned} z_{n+1} = z_n^2 + c \end{aligned}$$

remains finite — there are different regions of recurrence. Here's the classic picture. Let's play a bit.

The Mandelbrot set fractal

Read more…

there were microtonal bells

I am interested in hearing from perfect-pitchers and ethnomusicologists about this delightful physics-of-music video.

I'm particularly interested in an aside observation that the "least dissonant" major third based on this overtone analysis is a little flat relative to the equal-temperament major third. In choral singing, the conductor is always complaining that the major third needs to tune a bit higher.

division and conquest

Suppose I have some random process described by a binomial distribution, with "success" probability $p$. For $n$ trials, the expected number of "successes" obeys

$$\begin{aligned} P(k) &= {n\choose k} p^k (1-p)^{n-k} \end{aligned}$$

Now suppose I do a bunch of different sets of trials, such as practice exams of varying lengths. I want to model each practice exam as being drawn from a distribution of the appropriate size with the same probability. What's the right way to combine them?

Read more…

revenge of the kludge

I'm playing with termux-api, which exposes a bunch of Android API things to the termux command-line environment. I'm kind of afraid that I'm going to hack together an app using the command line. Excellent and hilarious and a terrible idea. The kind of procrastination that looks like work.

Read more…

your princess is in another window

I've been playing with tmux for making it possible to do more things from one terminal window. Today I realized that you can type tmux commands in one shell, and affect the contents of other windows. You can send keypresses. I knew from the interactive help (C-b ?) that you can send a pane within a window to a new window, but you can also capture panes from one window in another. The command language is the same that you can type at the C-b : command prompt; you can put them in a file and process (from anywhere) with tmux source.

But the cuteness for now is that I can do

make continuous 2>&1 | tmux splitw -dI &
make serve 2>&1 | tmux splitw -dI &

and have two long-running processes putting their outputs into one window, while I can control them from another.

Update: I learned a nicer way.

Read more…

apps from the shell

The incantation that I was looking for to start an Android app from within the shell is

am start --user 0 -n net.gsantner.markor/net.gsantner.markor.activity.MainActivity

The problem is identifying the name at the back.

Read more…