Eli Rose 's postsabout code trinkets quotesmedia log
Of Mice and Means

The mean of a set of numbers $x_1, x_2 \ldots x_n$ is the unique value $\overline{x}$ which minimizes $\sum (\overline{x} - x_i)^2$, the sum of squared distances between it and the numbers. Why? The mean seems very natural — for example, it's related to intuitive ideas about fairness — but the sum of squares less so. For instance, what's so special about squaring? Why not the sum of fourth powers $\sum (\overline{x} - x_i)^4$ ? Or the sum of unsigned distances $\sum |\overline{x} - x_i|$ ?

My friend Dillon asked me this question. I felt I knew the answer, due to reading this post by Eric Neyman. But though I could do the algebra proving it, I wasn't able to convince Dillon (or myself, after a few minutes) of it on an intuitive level. It still felt like there were unanswered questions. It was unsatisfying. This post is my attempt to write an explanation that you can "feel in your bones."


Affine Spaces in Ruby on Rails

A great example of Ruby on Rails "magic" is this:

2.5.1 :001 > 1.day.ago
 => Wed, 06 May 2020 20:23:24 UTC +00:00

Processed By The Boys

Processed By The Boys by Protomartyr is a song about totalitarianism.


Magic: The Gathering Colors For All My Favorite Bands

For the uninitiated, Magic: The Gathering is a trading card game where cards belongs to one or more of five colors — white , blue , black , red , and green . Each color has its own aesthetic and style of play.


The Derivative of a Matrix and The Backpropagation Algorithm

Consider a matrix acting on a vector, $\mathbf{W}\mathbf{x}$. You can see this as function $f$ with type $\mathbb{R}^n \rightarrow \mathbb{R}^m$, where $\mathbf{W}$ is an $m \times n$ matrix, being applied to the vector $\mathbf{x}$. What is the derivative of $f$?

The framework behind taking derivatives in higher dimensions I covered in a previous post. I'll use the notation I introduced in that post here. $D(f)$ is the total derivative of a function $f$. $D(f)(\mathbf{x})$ is the total derivative of $f$ evaluated at a point $\mathbf{x}$. I'll also use the concept of a Jacobian matrix from that post.


How Do You Generalize Derivatives to Higher Dimensions?

The analogue of the derivative for functions whose inputs and outputs are vectors is called the total derivative. The total derivative of a function $f: \mathbb{R}^n \rightarrow \mathbb{R}^m$ is an object that gives you a function for each point in $\mathbb{R}^n$. In other words it is a function $\mathbb{R}^n \rightarrow \mathbb{R}^n \rightarrow \mathbb{R}^m$.

I'll write $D(f)$ for the total derivative of $f$; the function $\mathbb{R}^n \rightarrow \mathbb{R}^n \rightarrow \mathbb{R}^m$. $D(f)(\mathbf{x})$ is what you get when you put in $\mathbf{x}$ — it is a particular function $\mathbb{R}^n \rightarrow \mathbb{R}^m$.


Formalizing Mesa Optimizers

[This post is likely only to be of interest to you if you've read the paper under discussion.]

The paper Risks from Learned Optimization in Advanced Machine Learning Systems is written in natural language. It discusses the possibility of two functions — the objective function of the base optimizer, and the objective function of the mesa optimizer — being equal or unequal. As Samuel Marks pointed out during a presentation, in this informal setting, it's not clear that these functions even have the same type. Here's two formalizations where it's clearer what we mean when we discuss equality between these two functions.


Why Do Less Dense Things Rise?

Why do less dense things rise? Recently I was asked this as a puzzle. I had always taken it as a basic truth, but we should be able to explain it in terms of forces.

Let's try to explain why helium rises in air.


Times Alignment Chart

Conceived on a long hike with Lucy.


Sapphire Alone (poem)

Sapphire Alone

still knows fire. It's the stilling flame,

the burning touch, of ice. Inside her eye, events are justified and debated

as in a great and rowdy parliament, full of red-faced men, bitterly opposed,

advances met with counteradvances, so each thought is pushed back and forth forever.

Resonant, like a guitar string, all forward progress trapped in vibration.

In the hall of her mind, their voices rise, day and dusk, in fear.

Fear is inspired by every action. Even inaction.

"Ruin, ruin! A slippery slope!" they shout.

"Thoughtless! Callous! What my opponent has failed to consider..."


Where Does the 2 Come From In The Poisoned Wine Problem?

This is a brain teaser I came across recently (original source):

A king has 100 bottles of wine, exactly one of which is poisoned. He decides to figure out which it is by feeding the wines to some of his servants, and seeing which ones drop dead. He wants to find out before the poisoner has a chance to get away, and so he doesn't have enough time to do this sequentially - instead he plans to give each servant some combination of the wines tonight, and see which are still alive tomorrow morning.

a) How many servants does he need?

b) Suppose he had 100 servants - then how many wines could he test?


Sierpinski's Triangle and Fermat Numbers

I made a demo of a cool math thing.


The Competent Authorities

When I was a kid, I remember hearing about the various damages of the world. War, corruption, the mismanagement of countries, families starving below the poverty line. Like a lot of kids, I was disturbed at this news and concocted various kid schemes to make everything better. I designed a utopia in fifth grade where everything was solar-powered, so the environment wouldn't get damaged. (I really wanted blaster guns, so I also made solar-powered blaster guns. But I remembered that it was supposed to be a utopia without war. I compromised by deciding the blasters were used only for mining.)

Later I still felt uneasy. I was overwhelmed by the scale of the wrongness, like one is overwhelmed by the number of stars in the universe. It was a relief to mentally assign responsibility for these problems to people of similar scale — presidents, secretary-generals, diplomats. I imagined people infinitely wiser than myself in these positions. (In fairness, that was correct, because I was twelve.) They were the competent authorities.


Proving The Irrationality of $\sqrt{3}$ Via Modding By 4

Lucy and I found this proof last night. I'm sure it is not new, but hadn't seen it before.

We aim to prove that the square root of $3$ is irrational, i.e. that there is no rational $p$ such that $p^2 = 3$.


Undone (TV Show) Review

Undone is a series about schizophrenia. It treats this topic without holding any of its characters at arm's length. We are (nearly) always able to understand why each character's actions make complete sense to them, with the deep understanding that is almost the same as feeling.


6 Strict Improvements For Thor: Ragnarok

I saw Thor: Ragnarok recently. It's trying to be an imaginative, comedic sci-fi adventure movie with a touch of soul, and it pretty much is. However, it seemed to me and my friend that we could strictly improve the movie with some small tweaks. (That is, these tweaks would have done better something the movie was trying to do already, without affecting much else.)

[Spoilers abound]


1+1=13 By Aesop Rock

Today I'll be analyzing the song 1+1=13 by Aesop Rock.


The Coriolis Effect Applies To Balls Dropped From Towers

I know the Coriolis Effect from 9th-grade earth science as what causes hurricanes to spin; counterclockwise in the northern hemisphere, and clockwise in the southern. The idea is this: imagine teleporting a section of air from the Equator to the North Pole. An exceptionally violent wind would result, because the rotation of the earth means that air around the equator is moving at ~ 1000 miles/hour, while air around the North Pole is hardly moving at all.

Generalize. So as air moves north in the Northern Hemisphere, it will find itself to be moving eastward (the Earth rotates from west to east) faster than the other air surrounding it. Hence it will end up moving in a northeasterly direction (relative to that other air), rather than just north. For the same reasons, air that is moving south in the Northern Hemisphere will find itself being pushed to the west. Things are reversed in the Southern Hemisphere. The overall effect is to add a lateral component to north/south motion on any rotating sphere.


Explicitly Include "Gather More Information" In Your Expected Value Calculations

[Epistemic status: providing suggestions for how to think about something (or how to justify how you already think about something) based on my own experience.]

When deciding between various options under uncertainty, one attractive framework is to calculate the expected value of each option, then choose the option with the highest expected value.


Don't Say "What Is The Probability?"

(This post essentially agrees with Probability Is In The Mind. It differs in emphasis and style.)

[Epistemic status: clarifying language in the hope of helping people who were confused like me, not stating anything about what is or isn't the case in the world.]


A Car, A Torch, A Death Song by Twenty-One Pilots

Today I'll be analyzing the song A Car, A Torch, A Death by Twenty-One Pilots, from their 2009 self-titled album.


Tentative Maxim

When you imagine how the world should be, imagine also what work needs to be done to get it there. But do not yet imagine yourself doing that work. To do so at this stage would be to invite excess complication. First imagine what someone will need to do. Then, in place of "someone" put "myself".


Math Problem Liveblogging #1


This is an experiment where I narrate my thought process as I solve a math problem. My goal: writeups of the solutions to math problems usually present a polished, streamlined version of the solver's thought process that omits errors, wrong turns, and heuristics. I wondered what it would be like to represent the thought process "warts and all."


Self-Imposed Rules within Consequentialism

[Epistemic status: working out a course of action for myself, based on somewhat commonsensical observations.]

(This post essentially agrees with Ends Don't Justify Means Among Humans and Making Exceptions to General Rules. It differs in emphasis and style. If you are reading this, please read them as well.)


Inferior In Wisdom, Superior In Force (poem)

From the warm and noisy dark I watch,

from within a gentle fuss of feet and squeaking,

the resolute stars. And I watch you.


2019 (poem)

In 2019 I could descend my porch steps

and hear three short utterances

like coughs, but mixed with ideas or words

from a homeless woman sitting there.


Car Accident (poem)

I saw a biker get hit a little

by a red car scooting forwards

as it tried to park.


The Bug Collector by Haley Heynderickx

Today I'll be analyzing the song The Bug Collector by Haley Heynderickx, from her 2018 album I Need To Start A Garden.


'null' vs. 'undefined' in Javascript Wasn't Originally Total Chaos, But Now It May As Well Be

Most programming languages have a way to represent "no value" or "nothing". Python has None, Ruby has nil, Java and friends have null. Javascript has two ways to represent this concept -- undefined and null.


What Does '100% Juice' Mean?

I bought a bottle of cranberry juice which said "100% juice" on the label. But, later, I found that the label said it included apple juice. I became confused and suspicious about fruit juice labels, a state which lasted many years.

But it turns out that fruit juice labels are pretty comprehensible. I learned this from user rumtscho's lovely post on this topic at cooking.stackexchange.com. The following is just a restatement of that post.


What Is Bell's Theorem?

(I'm just writing this to help myself remember. YMMV.)


Bumper Stickers

This Cambridge, MA Jeep's window presents a difficult case in bumper sticker analysis. What is the person like who would assemble such a collection?


I Am A Great, Unstable Mass Of Blood And Foam

Today I'll be analysing the song Autoclave, by The Mountain Goats, off their 2008 album Heretic Pride. You can see the lyrics I'll be referencing and listen to the song on Genius. Additionally, here's a video of John Darnielle performing the song live in front of a huge troll statue which I thoroughly recommend.



Drawn using MS Paint 3D, with the assistance and instruction of my friend Gaby Yeshua. Check out her Instagram for other lovely MS Paint 3D works!


Boy (poem)

The boy's like a banana in a hoodie.

Tall, but he spends his time lying curved on the couch,

playing Smash with tiny twitches,

or steadily typing

orderly paragraphs.


Learning Networking from Ben Eater Videos

Sending Digital Information Over a Wire

  • One way to convey digital information across distances is through copper wire (Ethernet cable). Here we just vary the voltage in the wire between two states A and B. When we are at A, we are sending a 0, and when we are at B we are sending a 1.

  • What is voltage? Voltage is the delta between two points of an electrical field.

  • These states are called symbols.

  • Number of symbols / seconds is a unit called baud. If your symbol rate is 1 symbol per second, you are sending information at 1 baud.


Very Quick Sketch of Galois Theory

[Epistemic Status: I'm just writing this to help myself remember. YMMV.]

Question: we can write down a general formula for the roots of a quadratic, cubic, or quartic polynomial in terms of the coefficients. Why can't we do it for a quintic polynomial?


Taylor Series' Evil Twin

Apparently this is a thing. Consider the function $f(x) = \frac{1}{1-x}$. Maybe you know that you can express $f(x)$ as an infinite polynomial:

$$\frac{1}{1 - x} = 1 + x + x^2 + x^3 + x^4 + ...$$


How Easy Is It To Do A Lot Of Good?

How easy is it to do a lot of good? Imagine that opportunities to improve the world were tangible and visible. Say they look like purple jelly beans. When you pick one up, bam! Someone's life is a little better.

In world A, jelly beans are plentiful. Maybe they rain down from the sky every week. Everywhere in the country, this is true. The sidewalks are covered in jelly beans. Everyone picks up a few just going to work every day.


Richard Feynman On Girls

The Feynman Lectures on Physics are calmly beautiful and I am reading them right now instead of going to bed, but what the hell is with this paragraph in the middle of chapter 3?

One of the most impressive discoveries was the origin of the energy of the stars, that makes them continue to burn. One of the men who discovered this was out with his girlfriend the night after he realized that nuclear reactions must be going on in the stars in order to make them shine. She said “Look at how pretty the stars shine!” He said “Yes, and right now I am the only man in the world who knows why they shine.” She merely laughed at him. She was not impressed with being out with the only man who, at that moment, knew why stars shine. Well, it is sad to be alone, but that is the way it is in this world.


Normal Subgroups Hold Things Constant

Some subgroups of a group $G$ are normal, and some are not. It's not easy to get an intuition for what that means. A week or two after encountering the concept in my abstract algebra class, I knew the following:

  • Normal subgroups $N$ of $G$ are the only ones you can quotient by; i.e. you can write $G/N$ and it's a valid group.
  • They are the kernel of some homomorphism $G \rightarrow H$, where $H$ is any other group. Kernel means every element gets mapped to the identity (the subgroup is "killed").

Why Does Multiplying Two Complex Numbers Add Their Angles?

The complex number $z = a + bi$ can be drawn. Plot the imaginary part on the $y$-axis, and the real part on the $x$-axis.