Hard Tweets Explained: NäN

In the early days of computers, pretty much the only thing everyone could agree on was how to represent small positive integers. Other than that, nobody could agree on anything. They couldn’t agree on how many bits were in a byte. Or how many bytes you should work on together (called a “word”). Or how the bytes in a word should be ordered (biggest to smallest, or smallest to biggest). They couldn’t agree on how to represent negative numbers (sign-magnitude or two’s-compliment). They couldn’t agree on how to map letters to numbers (EBCDIC or ASCII). And they really, really, really couldn’t agree on how to represent real numbers (the kind with decimal points in them).

Over time, all these arguments got settled. Except the word ordering one. They still can’t agree on that. And the final decision on how to represent numbers (both integers and real numbers) was worked out in a committee that produced the IEEE 754 standard. That standard even covers weird things like what’s the value of 1➗0 (+infinity), -1➗0 (-infinity), and what to do with equations that make no sense. For example, if you add +infinity to +infinity you get another +infinity. But if you add +infinity to -infinity, what do you get? It’s not zero. They dump all those strange cases into a bucket called “not a number.”

Think about that: In the standard for how to represent numbers, there’s also a standard way to represent things that aren’t.

“Not a Number,” abbreviated “NaN” is pretty easy to get. 0➗0 for example. Or you can get it by treating something that isn’t a number at all as a number, if you are using one of the modern languages that lets you make mistakes like that.

IEEE 754 didn’t only specify how to store a NaN in computer memory, but it also gave rules for how to handle it in equations. And one of the rules is that it refuses to be ordered. 0<NaN is false. But 0>NaN is also false. A weird result of that rule is that NaN cannot equal itself.

Suppose you are working with a computer language that uses === to mean “is equal to” (yes, such languages exist). In that language if you have a variable X and you test X === X, you’d think that had to be true. But it’s not when X is holding a NaN.

And that brings us to our tweet.

Nän (also spelled “naan”) is a kind of bread they serve in Indian restaurants. Funny story. I was once on a bus at work going from one building to another, and a new Indian restaurant had just gone in. And the bus driver said, “Hey, is that place any good?”

And I said, “Yeah.”

And the bus driver said, “So, what do they serve there? Like maize and buffalo and stuff?”

The bus driver was not joking. Sigh.

Anyway, I digress. So nän is a kind of bread, and NaN is a numberish thing that isn’t equal to itself. And unless you are that bus driver, I’m guessing you can put the rest of those pieces together.

And if you are that bus driver, I think you were one hell of a great bus driver, and I really appreciated you, and some day I’d like to take you to that restaurant for some nän.

 

Advertisements

Hard Tweets Explained: Eventual Consistency

I often read complaints that twitter is buggy, or broken, or malfunctioning in some way. And although I’ve never seen any of the twitter code, I have worked on large scale distributed systems my whole career, and I have really good intuition when it comes to diagnosing bugs. The vast majority of twitter problems I see are undoubtedly caused by the choice of the twitter team to use a database with “eventual consistency” instead of a traditional ACID database. And now I’m going to explain what that gobbledegook sentence means.

computer

She is a Database Administrator or DBA. You can tell because she is wearing socks with sandals. DBA’s help computers act computery by optimizing ACID databases.

Let’s start with ACID. That is an acronym of other jargon, so don’t worry about what it stands for. An ACID database is the kind of database you imagine computers would use. If you put some information in there, and then you go look where you just put it, the information is there. And if you leave and come back, it’s still there. And if something went wrong you would get an error, so you can try again later or tell the user to try again later, or whatever. You know, computers acting all computery.

Your bank uses an ACID database. When they take money out of your account to put into another account, they absolutely don’t want it to suddenly show up still in your account.

The trouble with ACID databases is that you can only make them so big, and then they get too slow to use. Your bank will only ever have so many accounts, and it’s easy to segregate accounts if they need to into different databases. But imagine that your bank had 271 million users doing 5,787 transactions a second and there was no way to separate them into reasonable groups. That ACID database wouldn’t work. You can do big, or you can do fast, but you can’t do both and still have what they call “transactional integrity” where things act, you know, computery.

Twitter has 271 million active users doing 5,787 tweets a second. And, in fact, they are doing a lot more than 5,787 transactions a second because they are also starring and following and deleting and listing and searching and on and on… So to make a system like twitter (or facebook or any other internet-scale service) you have to give up ACID. You have no choice. Transactional integrity simply is not possible at that kind of scale.

anna-kournikova

This is that same DBA, but BASE databases put her out of a job, so she took up tennis and bikini modeling. She still wears socks with sandals, which is why they cropped this picture at the knees.

The alternative to ACID is BASE, a contrived acronym of jargon that is also not worth decoding. The E in BASE stands for “Eventually Consistent.” It means that when you send data to the database, it’ll eventually be there when you go look for it. But if you go looking right away, it probably won’t be there yet. And if something goes wrong and it never gets there, you’ll never get an error message. And “Eventually Consistent” doesn’t mean “Eventually Right.” It just means that all the different copies of the database will eventually have the same thing in them. Not necessarily the right thing. Just the same thing. (In theory, they are supposed to eventually all have the last thing you wrote to that spot, but in practice shit happens and the “last written” data is just lost.)

So let’s look at some of the weird shit that happens when you use twitter:

I tweeted from my phone, but I don’t see it on the tablet. But it’s on my phone. Wait, there it is on the tablet. That was weird.

Classic eventual consistency bug. The tablet was connected to a database copy that didn’t have the tweet yet. In fact, the phone probably was, too. The app almost certainly keeps a copy of the tweet, and shows it to you even if twitter’s database isn’t showing it yet. It is imperative when you build an app on an eventually consistent database that you lie to the user about what’s in the database, because otherwise the user will freak out.

The favorites count doesn’t match the list of people who starred my tweet.

This can happen because one of the people who starred it is a private account, so you can’t see them, but their star still counts. But more often it happens because the number of stars on a tweet is just an estimate. Although you can look at the list of people who starred it and count them, the server can’t. Well it could, but it is much faster to just keep track of the stars by adding/subtracting from a counter whenever one is added or removed. The trouble with that is that if a bunch of people are starring/unstarring at the same time all over the world, you are pretty much guaranteed to end up with a wrong count in there. Recall that eventually consistent doesn’t mean eventually right. This is one of those cases. Eventually all the databases will agree on the number of stars, but they almost never agree on the actual right number.

My follower count is bouncing all over the place.

This is a lot like the star-counting problem. When twitter suspends people or they unfollow the count goes down, and when suspended accounts are reactivated or people follow you, the count goes up. But unlike stars, people really want to know their actual follower count, so periodically twitter undoubtedly actually does go through and count them and write an actual number in there. Until then, it’s just an estimate, and if there is any activity at all going on it’s an estimate that will only eventually be consistent. Hence, each time your phone asks for an update, it might be getting the answer from a different database, and that database might not be consistent with the other databases yet. Hence the bouncing.

My deleted tweet keeps coming back.

It’s clear from the behavior of twitter that some things are given a higher priority at propagation from database to database than other things. So “Eventually” is really fast for some stuff, but takes longer for other stuff. New tweets are very high priority. Deleted tweets less so. Account suspension/deactivation is very low priority. (Refreshing a suspended account is a downright bizarre thing to watch.) I’ve never seen a deleted tweet end up not deleted. But I have seen them stick around for as long as an hour. Again, this is something your phone app will hide from you. It knows you deleted the tweet, so it’ll probably hide it when it shows back up.

Flint North

Twitter jail is actually located in Flint Michigan, on the site of an old GM factory.

So, back to my tweet. If your star doesn’t stick, it could be an eventual consistency bug. The star is there in some versions of the database but not in others. However, it also could be that you are “twitter jail” or as twitter puts it “you are rate limited.” Rate limited means that the twitter servers have decided that you are doing too much stuff, and so you need to cool it for a while. This happened to me on Monday, but I hadn’t been starring all that much. So let’s guess why they thought I should be rate-limited.

To know how many things you have done in the last hour, twitter needs to keep a counter. But we’ve already established that counters are problematic. Like star counts and follower counts, these transaction counts are only an estimate. So my bet is that sometimes that estimate gets wildly out of whack. And even though eventual consistency would fix it, the bad user trigger doesn’t wait for this and boom, you’re in jail.

Anyway, that’s my guess, and I’m almost always right about this stuff.

Hard Tweets Explained: One Shift Two Shift Red Shift Blue Shift

I’m not sure if this is really a hard tweet. My editor, who never gets any of my math or physics jokes, actually got this one. And it’s doing a little better in the stars than my usual hard tweets. But I think it’s worthy of explanation anyway, because it’s such a cool topic.

You are all familiar with Doppler Shift. That’s when the ambulance coming toward you sounds like, “nee-ner, nee-ner, nee-ner” and after it runs you over, it sounds like “noo-ner, noo-ner, noo-ner.” That is, higher pitch coming toward you, and lower pitch going away from you. The reason this happens is because sound travels in waves. Think of those waves like a spring. When the sound source is coming toward you the spring gets squished. And when the sound source is going away, the spring gets stretched out.

Squishing waves brings them closer together. And that means that the number hitting over a period of time is going to be higher. You will be hit with waves more frequently. So we say the wave has a higher frequency. Cool, right? Higher frequency gives higher pitch. So that’s why the sound is higher when it comes at you.

The opposite happens when it moves away. The waves get stretched out, so you are hit at a lower frequency, and hence lower pitch.

But you knew all that, right? Well, the same thing happens with light! If you think about how fast light moves (really fucking fast) relative to the light source (not really all that fast, here on earth), the amount of that Doppler shift in the light isn’t going to be much at all. But if the object is moving close to the speed of light, it can make a big difference.

When you increase the frequency of light, it moves toward the blue range. So bluer is the light equivalent of higher pitch. When you reduce the frequency of light, it moves toward the red range, so redder is the light equivalent of lower pitch.

So if an ambulance was coming toward you near the speed of light, it would look bluish. And then after it passed you, it would look reddish.

Of course, you wouldn’t get to see any of this because it would happen too fast, and ambulances traveling near the speed of light leave a horrific wake of devastation in their path. So you’ll just have to trust me on this.

So, knowing all this, we can return to our tweet. Two otherwise identical cars, blue in front, and red behind. As they approach, it looks like a blue car, after it passes, it looks like a red car. It appears as though it was just a gray car that passed you at nearly the speed of light.

Homework: Step out of the way the next time an ambulance comes toward you at a speed significantly less than the speed of light (no point worrying about those near-speed-of-light ones).

Hard Tweets Explained: Anachronism

This is one of those hard tweets that I’m surprised is a hard tweet. Apparently, people (not you, of course.  Other people) don’t know the word anachronism. It’s an awesome word. I just love it to death. It’s from the Greeks, who had a way with words. We shall tear it apart and analyze it the way my father taught me.

My father had a little game: if you came across a word you didn’t know while reading, and you looked it up, you could ask him if he knew it. If he did, you got nothing. If he didn’t, he’d drive you to the store and buy you a candy bar. Nobody ever got a candy bar. Because he knew how to break words apart and figure out what they meant. And being kids, we would always bring him the big, looooooong words to test him with, which are the kinds of words that are best suited to this dissect and analyze approach.

So our word is anachronism. This has three parts: ana/ chrono /(n)ism. ana means backward. It really doesn’t show up all that much in words people know. Analysis is a cool one. lysis comes from a word that means loosen, so analysis is to un-loosen something. chrono you know. It’s for time. Like chronology, or chronograph, or chronicle. ism is a bit of magic that means “make this idea into a noun.” So ana-chrono-(n)ism means backward-in-time-nounishly.

So anachronisms are things that don’t fit the now, but used to fit the then. Corsets, and horse-drawn carriages, and Kodachrome film, and the cover of Newsweek. Stuff that used to be current, and now aren’t.

Of course, love is eternal. If you’ve read my blog, you know that I’m a big believer in love. So that was just a little joke.

Homework: Now that you understand it, go star the damn tweet already.

Hard Tweets Explained: Jokes for Kids

When my oldest was just old enough to talk intelligibly, I figured out that it was ridiculously funny to teach her jokes that were challenging, even to adults. Jokes that required contextual inference that no child could perform. She didn’t understand why the jokes were funny, but she did understand that when she told them, the adults would crack up and tell her she was wonderful. I don’t know if this early experience helped turn her into the outgoing, confident young woman she has become, or if that was always in her nature. But I continued the practice with my other kids, and now all of them can tell a joke.

So when you read these, you have to imagine them spoken in the voice of a 5-year-old.

This was the first one I taught her. Like most pun jokes, it doesn’t make sense when you read it — you need to say it out loud. Get it yet? Pete. Sounds like Peat. Scotland is famous for having Peat bogs. A 2000 year old Scotsman would be decomposed at the bottom of one of those bogs. So you would call him Peat. Or Pete. Are you keeping up? Here’s another one:

This one I had to teach my youngest because it’s riffing on a bogus science story that was going around when she was little. Back in 2011 scientists in Switzerland and Italy convinced themselves (and pretty much nobody else) that they had witnessed neutrinos going faster than the speed of light. Of course, nothing goes faster than the speed of light. So this finding was obviously wrong. And eventually everyone figured out what their mistake was.

"I'm late! I'm late! For a very important date!"

“I’m late! I’m late! For a very important date!”

The conceit of the joke is that if something went faster than the speed of light, it would cause time-travel to happen. We all know this from the first Superman movie, when he orbited the Earth faster than the speed of light so he could go back in time, and not be late for his bar mitzvah or something. It’s science.

Speaking of science:

A tasty, refreshing beverage!

A tasty, refreshing beverage!

So this is another one of those jokes where you have to read it out loud. The first chemist orders water, but uses its chemical formula H₂O. I’m guessing you understood that much. The second chemist sounds like he is saying H₂O₂, which you may recognize (yeah, right), as Hydrogen Peroxide. Hydrogen Peroxide is a ridiculously strong oxidizer. If you get a drop of it on your skin, the cells die immediately and turn white. Drinking H₂O₂ would certainly kill you. And remember, there is nothing funnier than a 5-year-old making jokes about gruesome death. Nothing.

OK, so enough of the easy ones. Let’s get to the really challenging jokes I taught them:

Is this really a potato? Or is it a character in a Dostoyevsky novel experiencing a psychotic break?

Is this really a potato? Or is it a character in a Dostoyevsky novel experiencing a psychotic break?

The reason this joke is funny is because the second potato is surprised that the first potato is talking. Yet the second potato is also a potato. And it says something. Which means it is also talking. So why would it be surprised? Perhaps that second potato does not realize it is a potato. It thinks it is something else, like a human, which can talk.

So, at a deeper level, this joke is exploring the Self Concept. How does that second potato understand itself? Is it having an existential crisis? And since when can potatoes think and express themselves anyway? Perhaps neither is a potato. Perhaps both parties are actually human, but the second is in a delusional state. Perhaps brought on by a psychotic break, possibly through torture and isolation. Maybe in a Siberian prison.

Who knows? Anyway, the joke is rich with irony. And potatoes are rich with iron (9% of the US recommended daily allowance! Just eat 11 potatoes a day and you can completely skip the steak!).

Keeping on the topic of food:

When I google "catsup" most of the pictures were of this Mel Ramos piece. I'm not complaining, but I think that's a little weird.

When I google “catsup” most of the pictures were of this Mel Ramos piece. I’m not complaining, but I think that’s a little weird.

This is yet another pun that you have to read aloud. I’ll wait. … … … OK, done? So the trick at the end of this joke is that “Catch-Up” sounds like Ketchup (or Catsup, which I personally think is a much cooler way to spell that word because it looks like cat soup, which is really gross). Anyway, that’s the overt joke. But the thing that makes this joke funny when a child tells it, is the underlying message of infanticide. That a mother is so sick and tired of her progeny falling behind that she kills them. Again, I refer you back to the lesson of the Hydrogen Peroxide joke: Kids telling jokes about death are fucking hilarious.

And that brings us to our final joke, which is actually a riddle:

Picture the scene. An adult hears the riddle. They think of brown sticky things. They filter out the ones that they think are not appropriate for 5-year-olds. They come up with some lame guesses. They give up. The 5-year-old delivers the punch line. You see, sticks are ordinarily brown. And they are sticks, which makes them stick-like, or as we might say, stick-y. So the adult realizes that they, themselves, were the brunt of the joke. And they are ashamed and embarrassed. So they laugh heartily to deflect the pain. They bury the pain and the shame deep, where nobody can find it. Because they are adults. And that’s what adults do.

Hard Tweets Explained: Rectifier

I’m not much of a lunch person. I bring soup pretty much every day. My wife really likes to make soup, and I like to eat soup, so that works out well. But every Thursday, a group of us head out to Thai or Indian. Both restaurants are less than a five minute walk. And the service is quick.

As it happens, a few of the usual crowd were out or tied up with client meetings, so it was going to be just three of us last Thursday. And the other two had decided to go for sushi for a change. At first, I was excited. I texted my wife “Sushi today!” But then I figured out that the place they were going was really far away, and I didn’t want to leave the office that long. So I bailed out and ate a bagel I found in the kitchen instead.

So Friday came along, and my wife texted me after work: “stopping for sushi.” She is on a gluten free diet, and while she loves sushi, that diet limits her options (regular soy sauce has gluten, and it contaminates everything). So I have to conclude she was stopping for my benefit, which is just so incredibly sweet. I’m a very lucky man.

The scary part is you can't even see what's behind what you can see.

The scary part is you can’t even see what’s behind what you can see.

So as I’m anticipating the arrival of my dream girl with the raw fish, I went to the bar to evaluate my cocktail options. The most obvious choice, sake, is not something I stock. It occurred to me that I should rectify that situation. I really like sake. That gave rise to the tweet, which I’ll probably get around to explaining eventually.

But sake wasn’t an option so my focus shifted to plums. Plum wine is another Japanese restaurant staple, and while I don’t stock that either, I do have plum liqueur. So I made my usual Ketel One vodka martini, heavy on the vermouth, and added a splash of plum liqueur. It was a little sweet, so I added a bit of sparkling water to lighten it up.

The sushi was great. And I mean that in both senses of the word great: both delicious and excessive in quantity.

It turns out the place had a pretty good gluten free selection, so there were plenty of rolls for my wife (she’s not a raw-fish-eater). For me, in addition to the usual fish suspects suspects, she got otoro. I was unfamiliar with this; although it’s a staple in Japan, it is fairly rare here in the USA. Otoro (or O-toro, or ootoro, or just toro) is a particular cut of the blue fin tuna which is quite different from the regular dark red “sushi tuna” you have probably had. It’s pink. It looks like spam. To my occidental palate, it takes exactly like the regular tuna sushi. It has no texture at all. It simply disappears when you put it in your mouth. It’s ridiculously expensive. Bottom line: don’t bother.

Diamonds of Diodes are a girl's best friend, because they keep her phone at 100%

Diamonds of Diodes are a girl’s actual best friend, because they keep her phone at 100%

So back to the tweet. I thought, “I need to rectify that.” A rectifier is an electronic gadget that turns AC power into DC power. It’s an important part of the “wall wart” you plug in to charge your phone. There are a bunch of ways to build a rectifier, but my favorite (being a person who has favorites of such things) is to put four diodes into a diamond configuration. You put the AC into the top and bottom, and pull the DC out of the left and right. You may recall that AC current goes plus/minus/plus/minus. I explained this a while ago, so I won’t cover that again. (You can use inductive reasoning to figure out what that coil is on the left side of that circuit diagram.)

A diode is a little silicon doodad that only lets power go through it one way. So when there is + coming in on the top and – on the bottom, the plus goes out the right and the – goes out the left. And when it switches so + is on the bottom and – on the top, then the + still goes out the right and the – still goes out the left. (Technically, the + is going in, not out, since these are electrons moving around.)

Anyway, you aren’t going to build one of these, so I’m sure you don’t care how it works, but it does work, and it’s one way to build a rectifier.

Homework: plumb the depths of your basement in search of diodes so you can rectify your next sushi craving (but skip the Otoro).

Hard Tweets Explained: So What

I’m pretty sure this was a subtweet, directed at someone who was going to try something new that I didn’t think would stick. And clearly this person I was talking to had to know about jazz to have a chance of getting this tweet, so I’m pretty sure I know who that person was. But that’s not important now.

The tweet is in reference to a song from Miles’ album Kind of Blue called “So What.” This was a pretty important song in the development of jazz, because it established the thing called “modal jazz.” Let me explain that.

You may recall that a very common chord progression is the 2-5-1. That starts on a 2: meaning that you play a major scale but start and end on the second note. For example, the 2 of a C-major scale would be DEFGABCD. As I explained in that other post, this is called a minor-dominant-7 because you have to flat the third note of a D scale (making it minor) and the seventh note (making it dominant-7). But it has another name, and that is the “Dorian Mode.” Dorian meaning second. Because it’s the two. Are you writing this down?

The song “So What” has the chord progression: 2. That’s it. Just 2. 2 2 2 2 2 2.

That was the innovative part. They decided that instead of moving around 2-5-1 or 1-4-5 or whatever, they’d just hang around on 2. It wasn’t truly innovative, since it had been done before. But Miles’ band took it to an extreme.

Playing just one chord for a whole song is a little dull. So after a while, they moved up a half step. This is not a change in the chord progression. It’s a key change. So this new part is still just 2 2 2 2 2…

And then after that, they go back to the original key. And more 2.

Playing a whole song in a single mode (in this case Dorian) is what we call Modal Jazz. And this is the canonical example of that.

So, without further ado, here’s Miles. You can easily hear the key change during the melody (we call that “the head”) when the horns are playing.

Hard Tweets Explained: Induction

Growing up in the 1970s, fondue was a thing. Not a frequent thing. But a thing. For example, I’m quite sure that we had it on New Year’s Eve at least once. (Although my memory says we had it every New Year’s Eve, I’ve learned from my kids that anything we do once is remembered as something we do every, so I don’t trust my memory on this one.) I’ve always loved the smell of wine boiling, and I’m a huge fan of cheese, so putting those two things together really triggers the sense memory for me.

All your cheese are belong to us

All your cheese are belong to us

So when my wife suggested that we should take the kids to The Melting Pot, which is a fondue restaurant chain, I thought, “that sounds like a great idea!” I live in the middle of nowhere and this was more than an hour drive, but the way things worked out, I was going to be driving the kids and meeting her there. And I kind of like driving with the kids, because we can be silly and we can crank the music really loud. So the travel wasn’t so bad. But I don’t think we’ll be going back.

There is a term in electrical engineering called an impedance mismatch. Suppose you have modern 8 ohm speakers, but your stereo amplifier was designed to drive old-fashioned 4 ohm speakers. Ohms (Ω) are a measure of resistance. And another name for resistance is impedance. So your 8Ω speakers and your stereo designed for 4Ω speakers have an impedance mismatch. Connecting them results in bad things happening, like your speakers getting overdriven to the point of destruction, or your amp turning into a bonfire. There is nothing wrong with the speakers, and there is nothing wrong with the amp—they just don’t go well together.

There is an impedance mismatch between youngish kids and fondue restaurants. Fondue restaurants are expensive. Kids don’t enjoy them enough to justify that expense. Fondue restaurants are slow. Really slow. No—slower than that. Kids are impatient. Fondue restaurants serve huge portions. My kids barely eat. Fondue restaurants have a panoply of wonderful rich smells. My kids are downright obnoxious when it comes to wonderful rich smells.

So as we are waiting in our booth, and waiting, and waiting, I decided to teach the kids about induction. Unlike the fondue pots of my youth that were heated by flaming cans of Sterno, these pots on our table were heated by an induction cooktop. I understand these are quite common in other parts of the world, but my kids had never seen one, and they are pretty magical. I could see them wince when I smacked my hand down onto the surface right next to the pot of boiling water. And then they each had to try it. Tentatively at first. Then with gusto.

WARNING: Descriptions of electrical engineering topics may induce drowsiness

WARNING: Descriptions of electrical engineering topics may induce drowsiness

The way an induction cooktop works is really neat. Below the surface there is a coil of wire. In that coil there is an alternating current. When electricity runs through a coil, it makes a magnetic field. So you can think of an electric coil as being just like a straight magnet. If you reverse the flow of electricity, the direction of the magnetic field reverses. So if + is going in on the left and – on the right, you might have north going up; and then if you put – on the left and + on the right, you would have south going up. Alternating current means the + and – are flipping constantly. Typically 60 times a second here in the USA. So that magnetic field is going north-south-north-south really fast.

Now put a ferrous metal (the kind of metal a magnet would stick to) near that alternating magnetic field. The atoms in ferrous metals like to line up with magnetic fields. So when you put them next to an alternating magnetic field, all the atoms in that metal are going to start flipping back and forth really fast. Another word for “atoms moving fast” is “heat.” So whatever is made of that metal is going to start getting really hot. And if that whatever happens to be a pot full of cheese and wine, you get fondue!

The magnetic field is inducing motion in those atoms. So the process is called induction. As so often happens with technology, it was discovered pretty much simultaneously by two different people, back in 1831: Joseph Henry in the USA, and Michael Faraday in Britain. Your rechargeable electric toothbrush uses induction. There is a coil in the stand, and there is a coil in the toothbrush. A current in the stand coil induces a current in the toothbrush coil, which then charges the battery.

Remember when MP3 players were new, and you had to stick this contraption into the cassette player in your car so you could get music from the MP3 player’s headphone jack into your car stereo? That was induction, too.

And those giant metal things on the poles outside your house that step current down from power line level to house levels? Induction.

This picture links to the site I stole it from

The circuit that matches fondue restaurants with young kids is a bit more complex

And now I’m going to blow your mind: an inductor is also a great way to solve an impedance mismatch between two circuits! See what I did there? Fine. Be that way.

With that, I think we’ve got enough background to explain the tweet. A good friend told me that she was going to be tied up with an Honor Society induction ceremony. And having just had this fondue experience, I immediately thought of a bunch of kids in caps and gowns standing around a big coil of wire. I’m weird that way. And that got us to the tweet.

When the illuminati (or whoever it is who decides what words we use for units of measurement) were deciding what to call the units of measure for inductance, they had Henry and Faraday to choose from, since they both discovered the effect at about the same time. They went with henry (in lowercase, because the illuminati are a bunch of elitist jerks or something). Faraday’s consolation prize was to be the units for capacitance (the farad).

Go read the tweet again. Henry. Check. Recoiled (like the coil in an inductor). Check. Induction. Check. Faraday. Check.

Homework: Go to a fondue restaurant chain and put your phone onto the cooktop surface and find out how much of your phone is ferrous metal.

Hard Tweets Explained: Correlation Coefficient

I honestly didn’t think this was a hard tweet, but someone asked me to explain it, so here we go!

I assume the text content of the tweet is not the tricky part. Music impacts mood, and mood impacts driving. Whether I meander along at just the speed limit, or go faster than that is driven primarily by what music is playing. But you got that part already.

The joke here lies in the (r=0.867, σ=2.6). If you’ve ever read a research paper, you might have seen a notation like that. r is the letter we use for something called “correlation coefficient” and σ (that’s a Greek lowercase s, or “sigma”) is what statisticians use for standard deviation.

There is a message here, but I can't quite put my finger on it

There is a message here, but I can’t quite put my finger on it

Imagine that you have a bunch of data points on a graph, and they seem to be falling along a line. For example, suppose on one axis we plot time spent on twitter, and on the other axis we plot the number of times your spouse sighs audibly or rolls their eyes. And suppose that we have a lot of samples, and we plot them on a graph. And we notice that people who spend only a little time on twitter get few sighs and eye rolls, but people who spend a lot of time on twitter get a lot of sighs and eye rolls.

So these dots on the graph kind of form a line. But data samples are noisy, so we want to know how well these two things correlate. That’s what the correlation coefficient tells us. I’ll spare you the method of computation, but it boils line-ish-ness down to a single number. 1 means all the points are exactly on a line (perfect correlation), and 0 means they aren’t on a line at all (no correlation). The coefficient can also go negative which means that as one thing increase the other decreases. -1 means perfectly correlated, just in the opposite direction.

Correlation coefficients are useful for letting you know whether one thing can be used to predict something else. For example, my father once did a study where he compared the SAT scores of black student athletes against how well those kids did in college. The correlation coefficient was negative: the worse you did on the SAT, the better you would do in college. The College Board was not a fan of my father’s work.

In real scientific studies, correlation coefficients are typically pretty small. Correlations as low as r=0.2 might be considered significant, depending on the number of samples.

Correlation doesn’t tell you about causation. It just tells you if two things are moving in lock step. Either might be causing the other, or some other thing might be causing both, or it could just be a complete coincidence.

So that’s r in the tweet. I’m saying that the music and drive time are highly correlated. Putting σ in there was just to make sure the people who read research papers would understand what I meant by r. It really makes no sense at all in this context.

Homework: Use your newfound knowledge of statistics to mock people on Facebook. Here’s an example:

Hard Tweets Explained: Contraposition

Contraposition is a logic term that I’m guessing most people don’t know. Here is a simple example.

Me: Did you brush your teeth?

7: Yes!

Me: (checks toothbrush, it is dry)

7: Oh! You mean today?

We start with a conditional implication that if she brushed her teeth, then the toothbrush would be wet.

Brushed —implies—> Wet

We don’t know whether she brushed her teeth, but we do know that the toothbrush is not wet. The logical principle of contraposition (also called modus ponens) says that if you are certain that P->Q, then you can be certain that (not Q)->(not P). If brushed implies wet, then not-wet implies not-brushed.

Note that wet does not imply brushed. Now that 7 is 8, I suspect that she may choose to wet her toothbrush instead of brushing her teeth. So you can’t just flip an implication around. That’s called confirmation of the consequent fallacy. (I’m not kidding, that’s really what that’s called.) But if you flip it around and also invert the two statements, then that is guaranteed to still be true.

OK, so now that we all understand contraposition, let’s go back to the tweet.

It says that nudity implies getting some. But that I found that through contraposition.

Observation: not getting some implies not nude.

Contraposition: nude implies getting some.

Hence the joke: I’m talking about getting some, but I know this through years of research on not getting some. This is funny because men tweeting that they are not having sex is funny. I’m actually not sure why that is. However, there are plenty of examples of men joking about how much sex they are having, and they are not at all funny. And I think we can get there through contraposition. Maybe.

Homework: Try getting some in a contraposition for a change. Just be careful not to pull a muscle.