The Universe of Discourse

Wed, 18 Sep 2019

Breaking pills

Suppose you have a bottle that contains !!N!! whole pills. Each day you select a pill at random from the bottle. If it is a whole pill you eat half and put the other half back in the bottle. If it is a half pill, you eat it. How many half-pills can you expect to have in the bottle the day after you break the last whole pill?

Let's write !!E(N)!! for the expected number of half-pills. It's easily seen that !!E(N) = 0, 1, \frac32!! for !!N=0,1,2!!, and it's not hard to calculate that !!E(3) = \frac{11}{6}!!.

For larger !!N!! it's easy to use Monte Carlo simulation, and find that !!E(30)!! is almost exactly !!4!!. But it's also easy to use dynamic programming and compute that $$E(30) = \frac{9304682830147}{2329089562800}$$ exactly, which is a bit less than 4, only !!3.994987!!. Similarly, the dynamic programming approach tells us that $$E(100) = \frac{14466636279520351160221518043104131447711}{2788815009188499086581352357412492142272}$$ which is about !!5.187!!.

(I hate the term “dynamic programming”. It sounds so cool, but then you find out that all it means is “I memoized the results in a table”. Ho hum.)

As you'd expect for a distribution with a small mean, you're much more likely to end with a small number of half-pills than a large number. In this graph, the red line shows the probability of ending with various numbers of half-pills for an initial bottle of 100 whole pills; the blue line for an initial bottle of 30 whole pills, and the orange line for an initial bottle of 5 whole pills. The data were generated by this program.

screenshot of the graph
described above.  In each case, the probability starts relatively
high, then drops rapidly to nearly zero.

The !!E!! function appears to increase approximately logarithmically. It first exceeds !!2!! at !!N=4!!, !!3!! at !!N=11!!, !!4!! at !!N=31!!, and !!5!! at !!N=83!!. The successive ratios of these !!N!!-values are !!2.75, 2.81,!! and !!2.68!!. So we might guess that !!E(N)!! first exceeds 6 around !!N=228!! or so, and indeed !!E(226) < 6 < E(227)!!. So based on purely empirical considerations, we might guess that $$E(N) \approx \frac{\log{\frac{15}{22}N}}{\log 2.75}.$$

(The !!\frac{15}{22}!! is a fudge factor to get the curves to line up properly.)

I don't have any theoretical justification for this, but I think it might be possible to get a bound.

I don't think modeling this as a Markov process would work well. There are too many states, and it is not ergodic.

[ Addendum 20190919: Ben Handley informs me that !!E(n)!! is simply the harmonic numbers, !!E(n) = \sum_1^n \frac1n!!. I feel a little foolish that I did not notice that the first four terms matched. The appearance of !!E(3)=\frac{11}6!! should have tipped me off. Thank you, M. Handley. ]

[Other articles in category /math] permanent link

Tue, 17 Sep 2019

The straight man comes first

Today it occurred to me that in the many comedy duos that feature a “straight man” and a “comedian”, the straight man is invariably named first. The central example, of course, is Abbott and Costello. But we also have:

  • Laurel and Hardy
  • Burns and Allen
  • Rowan and Martin
  • Martin and Lewis
  • Bert and Ernie

and this even extends to entirely fictitious pairs such as Jeeves and Wooster, Harold and Kumar, or Sam and Max, Freelance Police. Also, if you are a mathematician, Smothers and Smothers. This is why people hate mathematicians.

I did Google search for "Kermit and Fozzie" (hits outnumber "Fozzie and Kermit" by around three-to-one) and "Kermit and Miss Piggy" (hits outnumber "Miss Piggy and Kermit", although only by about 60%.)

Wikipedia says this is no accident!

In vaudeville, effective straight men were much less common than comedians. The straight man's name usually appeared first and he usually received 60% of the take.

But my co-worker Jeff Culverhouse found a counterexample: Silent Bob is certainly the straight man of Jay and Silent Bob.

Wikipedia also has a list of American Comedy Duos. Not all of them follow the straight man / comedian pattern, and I don't recognize many of those that do. More research is needed.

[ Addendum: I wanted to find a gender-neutral term for "straight man", but failed. ]

[Other articles in category /misc] permanent link

Southern Strategy

According to the New York Times of 10 March 1982:

In 1970, for example, President Nixon and Vice President Agnew did a piano duet built around their so-called ''Southern Strategy.'' No matter what song Mr. Nixon played, Mr. Agnew cut in with ''Dixie.'' The audience found it uproariously funny, as they did the spectacle of the Vice President clicking his heels, saluting and telling Mr. Nixon, ''Yes suh, Mr. President, ah agree with you completely on yoah Southern strategy.''

And yet the cruel earth refused to open and swallow everyone involved.


[Other articles in category /politics] permanent link

Mon, 16 Sep 2019

Free coffee

23 USC §131 controls the display of billboards and other signs within 660 feet of a federal interstate highway. As originally enacted in 1965, there were a few exceptions, such as directional signs, and signs advertising events taking place on the property on which they stood, or the sale or lease of that property.

Today I learned that under the Federal-Aid Highway Act of 1978, the list of exceptions was extended to include:

signs, displays, and devices advertising the distribution by nonprofit organizations of free coffee to individuals traveling on the Interstate System or the primary system.

There is no exception for free tea.

[Other articles in category /law] permanent link

Sat, 14 Sep 2019

Convergence of Taylor series

[ (Previously) ]

Wikipedia has an animation that shows the convergence of the Maclaurin series for the exponential function:

graphic, which focuses on x between -3 and +3, and y between -5 and
+20.  It displays the curve
y=exp(x) overlaid with its sequence of Maclaurin series
approximations, one after the other.

This makes it look a lot better-behaved than it is. First, because it only shows a narrow region around the center of convergence. But also, it emphasizes the right-hand quadrant, where the convergence is monotone.

If you focus on the left-hand side instead, you see the appoximations thrashing back and forth like a screen door in a hurricane:

The same,
but it focuses on x between -6 and 0, and y between -5 and 1.

This is the same as Wikipedia's animation, just focused on a slightly different region of the plane. But how different it looks!

(Individual frames are available)

[Other articles in category /math] permanent link

Fare-dodging insurance businesses

A recent article described a business that insured transit riders against being fined for fare-dodging, and asked:

Does anyone remember this? Can someone point me to a reference?

Florian Ilgenfritz wrote to tell me that they had heard of such a system in Berlin, and this let them to the German Wikipedia article on Schwarzfahrerversicherung, which is precisely what I was looking for. (“Schwarzfahrer“ is fare-dodging, literally “blackriding”, and “versicherung” is insurance.) The article mentions similar systems in Paris and Stockholm, and also one run by the student union of the University of Hanover, which had to shut down because increased fare enforcement on the Hanover metro depleted the benefits pool.

One Paris version, as described at this archived page, was amusingly called le Réseau pour l’Abolition des Transports Payants. (Its initials, RATP, are the same as those of the state-owned public transportation operator. Each RATP group was an insurance cooperative. Would-be fare-dodgers would meet at the beginning of the month and contribute to a pool, from which fines would be reimbursed.

The page says:

  • a group will have 10–30 members
  • each member will put 6–7 Euros into the kitty
  • “even a very unlucky person cannot be fined more than 4 or 5 times a year”

Each member is putting in €72–84 per year. Even if every member is maximally unlucky, this is enough to cover a fine of €16–17, and two or three times that much of not everyone is caught so frequently.

NPR reported on the Stockholm version as recently as 2015, and the Paris version in 2010. There is a German-language article from Der Spiegel from around the same time. This article claims that in one Berlin association, only 50% of the members’ €11 monthly premium had to be paid out in benefits, leaving a €33,000 profit. No word on what happened to the profit. Perhaps it was reinvested for the benefit pool, or perhaps the least scrupulous of the fund organizers embezzled it.

Most Philadelphia public transit is guarded by turnstiles, making fare-dodging more troublesome. The exception is on the regional rail system, where the passenger can board, with or without a ticket, and the conductor comes around to punch tickets, or sell higher-priced on-train tickets to people without any. This is well enough enforced that a fare dodger would be caught almost every time and have to pay the higher price, so the insurance scheme would not be practical. But I remember back in the 1990s it would sometimes be worth while to ride regional rail for a couple of stops in Center City, rather than the subway. The on-board regional rail fare was substantially higher than the subway fare, but the chance of getting off the crowded train without having to buy a ticket was good.

A recent article in the Philadelphia Inquirer describes a different fare-dodging scheme. SEPTA will sell a weekly pass, good for up to 56 rides, for $25.50, or 45.5¢ per ride. The cash fare is $2.50. The fare-dodgers will buy a weekly pass, and then stand at the turnstile offering to let cash-fare riders use it for $2 cash. The cash-fare rider is ahead by $0.50 and the entrepreneur can earn a return of up to 449% on their $22.50 investment.

Exercise for the reader: where is the extra value here and why doesn't SEPTA capture it? Are the entrepreneurs increasing or depleting the public good?

Thanks to M. Ilgenfritz for the initial references, which provided enough for me to get started following up the details on my own.

[Other articles in category /misc] permanent link

Tue, 10 Sep 2019

Chicken-fondling discouraged by the CDC

This week, according to the Washington Post, Kissing chickens is bad for your health, CDC warns. (The story was also reported by Newsweek last week. )

Specifically, the CDC Investigation Notice advises:

Don’t kiss backyard poultry or snuggle them and then touch your face or mouth.

This isn't quite clear. Is it:

Don’t ((kiss backyard poultry)
((snuggle them) and (then touch your (face or mouth))))

or is it rather

Don’t (((kiss backyard poultry) or (snuggle them))
and (then touch your (face or mouth)))

I think they mean the former? But if it's the latter, then the Post has it wrong, and it's okay to kiss backyard poultry, as long as you don't then touch your face or mouth.

But is this really a pressing issue? Apparently so! Kissing chickens, according to the CDC research, is disturbingly common:

Among respondents with baby poultry exposure … 13% (53/400) reported kissing baby birds.

No word on how many of the 53 chicken-kissers tried to use their tongues.

black-and-white photograph of a young boy in overalls, with his hips
pressed against a wooden door, a pained expression on his face.  On
the other side of the door, there is a large chicken, with its head
hidden by the door.

[Other articles in category /misc] permanent link

Sun, 08 Sep 2019

The exponential function is a miracle

The Maclaurin series for the exponential function converges for every complex number !!x!!: $$1 - x + \frac{x^2}{2} - \frac{x^3}{6} + \frac{x^4}{24} - \ldots = e^{-x} $$

Say that !!x!! is any reasonably large number, such as 5. Then !!e^{-x}!! is close to zero, But the terms of the series are not close to zero. For !!x=5!! we have: $$ 1 - 5 + 12.5 - 20.83 + 26.04 - 26.04 + 21.7 - 15.5 + 9.69 - 5.38 + \ldots \approx {\Large 0}$$

Somehow all these largish random numbers manage to cancel out almost completely. And the larger we make !!x!!, the more of these largish random numbers there are, the larger they are, and yet the more exactly they cancel out. For even as small an argument as !!x=20!!, the series begins with 52 terms that vary between 1 and forty-three million, and these somehow cancel out almost entirely. The sum of these 52 numbers is !!-0.4!!.

In this graph, the red lines are the various partial sums (!!1-x, 1-x+\frac{x^2}2, !! etc.) and the blue line is the total sum !!e^{-x}!!.

As you can see, each red line is a very bad approximation to the blue one, except within a rather narrow region. And yet somehow, it all works out in the end.

[ (Addendum) ]

[Other articles in category /math] permanent link

Mon, 02 Sep 2019

Louis XIV, Disco King

Some time ago I wrote:

I think a disco ball would not be out of place at Versailles.

This got me thinking about what if all of Versailles had been tricked out in awesome 1970's disco style? I could easily picture Louis XIV in a white leisure suit, open to the navel, with gold chains and bell-bottom trousers, his platform shoes glittering with real diamonds. (Surely you didn't think le Roi Soleil would wear rhinestones?)

I have been enjoying this mental picture for some time now, but part of it is wrong: the bell-bottoms. Louis didn't have a pretty face. But he had great legs, he knew it, and he never missed an opportunity to show them off:

Louis as a young man.  He is standing in three-quarter profile,
displaying his entire right leg.
He is wearing tight black leather trousers
with decorative metal studs, and tight-fitting brown leather boots. Louis,
age 29.  He is wearing his coronation robes, including a heavy blue satin robe with gold fleurs-de-lis. But the
robe is swept back to reveal his legs.  He puffy white
pantaloons only come down to mid-thigh.  Below that he wears
skin-tight white hose, with ruffled white garters at the knees, and
square-toed white high-heel shoes with enormous bows. Louis age
29 again.  He is seated, again wearing the coronation robes but his right leg is thrust out, resting on a pillow,
and is visible from the knee down.  Again he is wearing sheer white
hose and the square-toed white shoes. Louis around age 32. He wears a
steel breastplate and a skirt that comes past his knee, but it is slit
at the front and turned bake so that both his legs are visible from
the top of the thigh to the foot. His legs are clad in skin-tight
crimson hose with diamond garters, and his high-heeled shoes have
matching crimson bows. Perhaps the
best-known portrait of Louis, by Hyacinthe Rigaud, the King is 63
years old.  Again he is in three-quarter profile.  Although is upper
body is cloaked in heavy robes, both legs are clearly visible, clad in
tight white hose, prominently displayed from the thighs down.  Again he has white garters just below the knees,
this time without ruffles  His shoes are white with brown platform
heels and square diamond-studded buckles.

Notice the recurring theme: skin-tight trousers or tights. Fancy garters. When he's wearing heavy state robes, they're cut away or swept back to expose his legs, and he always stands sideways or sticks them out so that you can see them.

(In that last picture, the diamond studded platform shoes, just as I said. Nailed it!)

Here Louis is fancifully depicted as Alexander the Great. He surely did not dress up in costume for the portrait. But the unknown painter knew what Louis liked and made him bare-legged, with a diaphanous blue tunic:

This is not a man who is going to wear bell-bottoms.

[ Addendum 20190903: “Louis loved ballet and frequently danced in court ballets during the early half of his reign. In general, Louis was an eager dancer who performed 80 roles in 40 major ballets.” Thanks to Akiva Leffert from bringing this to my attention. ]

[Other articles in category /misc] permanent link

Thu, 29 Aug 2019

More workarounds for semantic problems


Philippe Bruhat, a devious master of sending a single message that will be read in two different ways by two different recipients, suggested an alternative wording for magic phrase messages:

    "I request that this commit be exempt from review for the following reasons: "
    (followed by an actual explanation)

The Git hook will pattern-match the message and find the magic phrase, which is I request that this commit be exempt from review for the following reasons:. Humans, however, will read and understand the actual explanation. I think M. Bruhat has put the first line in quotes so that humans will not attempt to interpret it. In this case it might not be a big problem if they did interpret it; at worst they might be puzzled about why the request was being sent to them rather than to the Git hook. But it also protects against the situation where the secret phrase is “Craig said I could do this” or “Chinga tu madre!”.

My only concern is that, depending on how the explanation was phrased, it might be ungrammatical. I think these quoted phrases should behave like nouns, as in

    "Tinkle in the toidy" is a highly offensive phrase.

As written, M. Bruhat's suggestion has a dangling noun without even a punctuation mark. I suggested something like this:

    This message includes the phrase "The fat man screams at midnight"
    for the following reasons:
    (followed by an actual explanation)

Or we could take a hint from the bronze age Assyrians, who began letters with formulas like:

To my lord Tukulti-Ninurta, say thus: …

Note that this is addressed not to Tukulti-Ninurta himself, but to the messenger who is to read the message to Tukulti-Ninurta. Following this pattern we might write our commit message in this form:

    To the Git pre-receive hook, I say thus:          
    "Craig said I could do this"
    because (actual explanation)

(I originally wrote “we could take a page from the Assyrians”, which is obviously ridiculous.)

Many thanks to M. Bruhat for discussing this with me, and to Rafaël Garcia-Suarez for bringing it to his attention.

[Other articles in category /tech] permanent link

Wed, 28 Aug 2019

Opposites again

In a (still unpublished) discussion a while back, of the complexities of the idea of “opposites”, I said:

"Opposite" extends to all sorts of situations in which logic doesn't apply. Red is the opposite of green, but I'm not sure that it makes sense to ask for the logical negation of green. I suppose you can go with "not green", which is certainly quite different from "red".

A related example: Red is the opposite of green.

What's the opposite of “not green”? Is it “not red”? I think it isn't. The opposite of “not green” is “green”.

[Other articles in category /lang] permanent link

DLR insurance business

DLR is the Docklands Light Railway, a light rail system that operates in East London. The fare collection system is interesting. You buy a ticket, but you don't have to show it before you board. Instead, during the ride, a ticket agent might come through the car and demand to see it. If you can't produce it on demand, you become liable for a large fine. So you can evade the fare, but doing so is a high-risk gamble.

The DLR might like to have enough fare inspectors that the gamble would have negative expected payout for the passengers. But at the time I took it, they didn't do so many inspections. The gamble was actually a good one for passengers, if they didn't mind the high risk of a rare large loss in return for small frequent wins. Most people wouldn't accept the risk, so the system worked.

But about fifteen years ago, some guy in East London had an idea. Insurance exists to diffuse risk! You'd pay him a monthly subscription fee, and then you'd ride the DLR that month without buying tickets. If you were caught by the fare inspectors, you'd pay the fine, send him the receipt, and he would reimburse you. You'd win because the insurance premium you paid this guy cost less than what you would have paid for DLR tickets. He'd win because he could set the insurance premiums high enough to cover the relatively few fines he had to pay out.

For a time this went well for everyone except the DLR. Eventually they caught the guy and punished him for conspiring to evade fares or something like that.

Does anyone remember this? Can someone point me to a reference?

[ Addendum 20190914: Leads provided by Florian Ilgenfritz produced a wealth of information about similar schemes. ]

[Other articles in category /misc] permanent link