Showing posts with label Philadelphia. Show all posts
Showing posts with label Philadelphia. Show all posts

30 April 2008

Confusing coffee pricing continued

Last week I wrote about confusing coffee pricing: Wawa, a Philadelphia-area convenience store chain, charges $1.25 for 32 ounces of coffee and $2.99 for 64 ounces. $2.99 is more than twice $1.25. Various commenters pointed out other counterintuitive pricing (train or airline fares that don't obey the triangle inequality, for example). Paul Soldera pointed out in a comment that the reason for this may just be that there aren't that many mathematicians out there, and $3 for 64 ounces of coffee sounds like a bargain to most people.

Paul Soldera may be right -- but I discovered another candidate explanation for this pricing today. Namely, I took a closer look at a sign (at a different Wawa from the one I normally go to), and it said that the 64-ounce "includes supplies". In other words, they're not selling this as a giant cup of coffee for one person to drink, but as something from which you can pour multiple cups for multiple people. Thus, they provide the cups, and perhaps other coffee paraphernalia as well.

22 April 2008

Confusing coffee pricing

Here in the Philadelphia area, we have an oddly-named chain of convenience stores named Wawa.

At Wawa, you can buy coffee for the following prices: $1.09, $1.19, $1.29, $1.39 for 12, 16, 20, 24 ounces respectively. This makes sense -- basically you pay $.79 for wandering around in their store taking up space and such, and then 10 cents for each four ounces of coffee.

However, things get weird if you bring your own cup (I'm talking about the "travel mug" sort here, not a paper cup). Then 12, 16, 20, 24 ounces cost $0.85, $0.95, $1.05, or $1.15 -- so far, so good. You save twenty-four cents by bringing your own cup.

32 ounces, in your own cup, is $1.25. So now they're really starting to reward you for buying in bulk -- another ten cents gets you eight more ounces.

But then guess what happens? 64 ounces costs $2.99. That,s right -- I can fill two 32-ounce cups for $2.50, but filling one 64-ounce cup will cost $2.99. If you extrapolate the linear trend from 12, 16, 20, and 24 ounces, 64 ounces should cost $2.15. If I had a sixty-four-ounce travel mug, I'd go in there, fill it up, and try to get it filled for $2.50 just to see how the cashiers explained it.

Perhaps they're trying to say that you really just shouldn't be drinking that much coffee. I'd have to agree -- and I'm a mathematician.

Another argument is that perhaps they are attempting to discourage people from taking that much coffee because then there's less coffee for the people after them, and people won't be happy if the store runs out of coffee. This may be true -- it seems a bit doubtful, though, since a typical Wawa store might have a dozen or so pots of coffee at once, each holding 64 ounces or so.

16 February 2008

A theorem a day brings promotion and pay...

Within spitting distance of my apartment (okay, maybe not literally), tonight, will be the Artclash Collective's Fun-a-Day show. Basically, for the entire month of January, a bunch of people each do some creative thing each day, and then these are exhibited. (The exhibit takes place tonight, at Studio 34 Yoga, 4522 Baltimore Avenue, Philadelphia.)

Some friends of mine, this year, did Breakfast Pastry a Day (I helped -- by eating some pastry), SEPTA Haiku a Day (which is still ongoing -- the person in question commutes by SEPTA and I guess once you start making haiku it's a tough habit to break), Scrabble a Day (no link -- although I actually took part in this one by being an opponent), Internet Troll a Day (or so I've heard), and so on. (More conventional "art" like drawings, comic strips, songs, etc. also is pretty well represented.)

Unfortunately most of my creativity lies in mathematics... and theorem-a-day would just be too hard. I googled "theorem a day" and most of what comes up are variations on Erdös' quote "A theorem a day means promotion and pay; a theorem a year and you're out on your ear." (What does a theorem a week bring? Or a theorem a month? And does anything rhyme with month? The best I can do is "n-plus-oneth", which isn't a word in ordinary English -- but it is in mathematical English!) Although something like "proof-without-words-a-day" seems feasible. And a project involving pretty pictures, of course, has the advantage that the non-mathematical people in the audience (which, in a general audience, is most of them) could enjoy it too. But I tend to be the sort of mathematician who has much better pictures in my head than I can put on paper. Making a good mathematical picture is hard.

Then again, maybe it's precisely for this reason that I should be making more pictures that really do reflect what's going on in some mathematical problem. So come to Fun-a-Day in 2009... my work might be there! (We'll see how I feel next January.)

09 February 2008

A mathematician goes to the post office

There's a pretty standard theorem that one proves at the beginning of, say, a differential geometry course -- that any (n-1)-dimensional manifold embedded in n-dimensional Euclidean space is locally the graph of some function. (To any geometers are reading this, I apologize if I haven't stated this correctly.)

This morning I had to go to the post office to pick up a piece of certified mail. I live on one side of a large set of railroad tracks; the post office is about a mile away on the other side of the tracks. I generally don't go past the tracks, because very little that interests me is there, and I hadn't looked at a map before setting out. It's important to know where the tracks are when walking around in that neighborhood, because there are a lot of streets that exist on both sides of the tracks but are interrupted by them. The street on which the post office is, Florence Avenue (links goes to Google satellite imagery) may be such a street; it exists on both sides of the tracks, and doesn't cross over the tracks. It might cross under; Google Maps won't tell me, and I'm not curious enough to head out there again and look. So the scheme of "follow the street with the same name" doesn't always work.

I knew the tracks run basically from northwest to southeast. (For those who know where I live, or who are looking at the map I linked to: all directions are "nominal", i. e. by "west" I mean "the direction in which the street numbers get higher".) At one point on the way back I crossed a bridge and I was wondering "could that have been the tracks I just walked over?" Then I thought "hmm... I'm further north than I was when I crossed the tracks heading to the post office, so the tracks must be further west here."

Why must they? Because the tracks are basically a one-dimensional manifold embedded in two-dimensional Euclidean space. So locally there's a function mapping east-west streets to north-south streets that gives the position of the tracks. Everyone knows this intuitively. If you asked someone who knows that neighborhood well "Where does [insert street here] cross the tracks?" you'd get an answer, even if they're totally ignorant of geometry.

21 August 2007

information-theoretic entropy in the weather

Right now, in Philadelphia, it's sixty-one degrees, with a light rain.

I have long maintained that this is "generic Philadelphia weather". By this I do not mean that it's always like this here. What I mean is that if I for some reason do not know what season it is, and I head outside and find it is sixty-one degrees with a light rain, this gives me very little information, because this sort of weather can happen any time of year. Another characteristic of such a day is that the high and low temperatures are very close together, say within ten degrees of each other; it's been between 60 and 64 since midnight and probably won't get out of the sixties (in either direction) all day.

Looking at the data from the last year, June 14 was pretty close to this, although it was just overcast, not rainy; January 6 might look that way on paper, except I remember it clearly and it was actually a freakishly warm and sunny day. I wore shorts. It was January. We had the New Year's Day parade that day. November 8, 13, and 14 fit as well; also October 11 and a few other October days; September 1. (I remember the weather on September 1 quite well, because I moved that day. The rain was light for most of the day and got heavier about an hour after my movers were done getting everything in.) I'm deliberately being vague about what constitute a day like this.

Not surprisingly, this sort of weather is most common in the spring and fall (mostly because I care about temperature) but it is possible in the winter or summer as well. And this gets me wondering -- in general, what is the information content of the weather? If it's 100 degrees and sunny, there might be a 2% chance that it's July 24; a 0.5% chance it's September 1; an 0.01% chance that it's November 1; and a one-in-a-million chance it's January 15. This sort of weather is very localized towards a certain time of year. One could imagine calculating the Shannon entropy corresponding to this distribution; it would be a lot smaller than the entropy you'd get from a similar distribution if you conditioned on sixty degrees and light rain.

Of course, in this formulation, the whole idea is kind of silly -- when am I not going to know what the date is? But looking at the information-theoretic entropy of weather seems like a potentially useful way to quantify how extreme the seasons in some place might be; it's possible but not normal to get the same weather in winter and summer in Philadelphia, say; routine in San Francisco; unheard of in Minneapolis. (I am picking these places without looking at actual statistics, so I might be wrong.) Why one would want to quantify that, though, I'm not sure.

04 August 2007

geographical random walks

Let's say you have a map of the streets in an area. Could you guess, from looking at that map, which intersections the locals consider "most important"?

You could probably make a decent first guess by assuming that the importance of an intersection goes up with the number of roads at the intersection.

Why? Imagine you are randomly walking around a town. Each time you get to an intersection you choose uniformly at random from each of the possible ways you could go. (For the sake of simplicity, I'll assume that this includes going back the way you came.) It's a well-known result that this sort of random walk on a graph leads to a certain stationary distribution; that is, if a bunch of people walk around randomly you'll get to a point where the number of people at any given intersection is roughly constant. And that result is that number of people at any intersection is proportional to the number of roads coming into it. (I'll count the two directions of a road coming into the same intersection as two distinct roads.)

This has implications if, say, you want to start a business. If you're located in the middle of a block, there are two roads coming in. If you're at a "T"-shaped intersection, there are three. A normal grid intersection, four. An intersection like 48th and Baltimore or 23rd and South, five -- both of these have two streets that go through and a third that starts there. (Most of the intersections on Philadelphia's Baltimore Avenue are five-pointed, because the street grid has a sort of discontinuity there; this may explain why it's sort of the main street of its part of the city.) An intersection like Broad and McKean, which has three streets going through it, six. You want to be where there are more roads, so that more people will walk by. In Washington they have intersections like Dupont Circle where five roads go through, for a total of ten "arms". (The counting gets a bit tricky, because some of the roads don't actually go "through".) In Paris there's an intersection with eleven arms, fittingly called L'Etoile. (Much more than that seems impractical.)

Of course, this neglects a huge number of facts. Not all roads are equal. For example, I'm ascribing Baltimore Avenue's primacy in its part of Philadelphia to the fact that it's got five-pointed intersections; but probably more important is that, historically, it was the road that went to Baltimore. (Hence the name.) Also, a trolley runs down Baltimore Avenue and has for over one hundred years; but why is it there, and not somewhere else? Because people already were living or working on or near that street. And they were doing that because other people were. Once a slight imbalance is created -- say by the random-walk model I alluded to above -- people are naturally going to gravitate, even if it's very slightly, towards the place where people already are. The roads that lead towards the important nodes will become important in their own right. And street networks aren't static -- they can change. (River networks can't, though -- and a lot of cities are located where two rivers come together to form a third, the most famous U. S. example probably being Pittsburgh.) But the initial imbalance has to come from somewhere, and this is as good a place as any, especially in places where the roads mostly form a grid and hence their arrangement is determined well in advance of their actually being built.

Incidentally, this is my theory on why Boston and Philadelphia -- two cities which are of similar size and population density, at least if you consider them as the center of their respective metropolitan areas, and the two cities I am most familiar with -- differ in their transit system. Boston is able to have subways because for the most part it's obvious where the subway stops should be. Radical Cartography has a map of Boston as a series of squares; the original transit system was basically built around people getting from one square to the next. Philadelphia would have trouble supporting a subway system more extensive than its current two lines, because it's hard to point to a place that a huge number of people go which isn't served by the existing system; the population is more diffuse, because for the most part Philadelphia's streets form a grid and no node is any different from any other. If I wanted to I could draw, say, six or eight subway lines that I'd like to exist in Philadelphia -- but none of them seem essential to me, at least at the price that it costs to build a subway. (Some Philadelphians will point out that there's a long-standing plan to put a subway down Roosevelt Boulevard; to them, I will say that I have very rarely had any reason to be in Northeast Philly, so I forget about the Boulevard. I'm sorry.) Manhattan has subways -- even though it's for the most part a grid -- because it's so dense. (But I think I heard somewhere that Times Square is the busiest subway stop -- and it's under Broadway, which cuts through the grid diagonally.)

18 July 2007

SEPTA fare hike "11 percent"?

Funding heads off SEPTA fare hike.

The public transit provider in Philadelphia, SEPTA, recently raised its fares; the article is saying that they won't have to raise fares again in September. In the media the fare increase was widely reported as an "11 percent" increase. And it basically was. People who hold a weekly pass for the buses and subways saw the price raised from $18.75 to $20.75; monthly pass holders, from $70 to $78. A one-day pass was raised from $5.50 to $6. (A rule was made that a one-day pass was actually only good for eight trips, though.) SEPTA also runs commuter trains from the suburbs. A typical fare increase there (zone 3, off-peak) was from $3.75 to $4.25; a weekly pass for such a commuter train went up from $34.50 to $39, a monthly from $126.50 to $142.50.

So far, all the fare increases I've mentioned were between 9% and 13%. So far, so good.

But how much of a fare increase will I, personally, see? Zero.

Why is this? SEPTA decided to eliminate the transfer. Currently, there are three ways one can pay for a single trip on SEPTA: pay a $2 "cash fare", use a token which costs $1.30 (but tokens are only available in quantities of more than one, and it can be astonishingly difficult to find someplace which sells tokens!), or use a transfer, which costs 60 cents but can only be used for the second or third vehicle in a trip that requires more than one vehicle.

The cash fare and the token will remain at $2 and $1.30, respectively. The transfer will be eliminated. Because of where I happen to live and where I happen to go on a regular basis, and the way SEPTA's routes are structured, I never need to transfer. (Also, I never figured out how to buy a transfer.)

SEPTA says only 6.8 percent of riders use transfers. This makes sense; under the old fare structure, if you needed to use a transfer for a round-trip five days a week, that came to $19 a week; compare $18.75 for a pass. These figures are quite similar, and I'm assuming that our hypothetical person never goes anywhere but to work. The people who get screwed are the people who ride less then daily but need a transfer when they do so; they'll have to pay $2.60 (twice $1.30) for their trip instead of $1.90, a 37% fare increase. And these are probably the people who can least afford it.

I would have preferred to see, say, the $2 cash fare raised to $2.20, the token raised to $1.45, and the transfer continuing to exist (at 65 or 70 cents). (I haven't done the math to know if this would actually bring SEPTA the same amount of money as what they're doing; I'm just applying the 11% figure across the board.)

The article says a hearing is being held to restore the transfer. I think that's the right thing. It's not the rider's fault that SEPTA doesn't have a single route that goes from where they are to where they want to be; designing a transit system such that everyone has a one-seat ride would be essentially impossible. A good transit system works because of these network effects -- two routes are more than twice as valuable as one, a hundred routes are more than twice as valuable as fifty. But only if you make it possible to use the system as a system.

16 July 2007

You're paying for the bottle, not the water

A couple weeks ago I came across a suspicious-sounding claim that New York City tap water costs 24 cents a gallon; the correct figure is 0.24 cents per gallon.

The New York Times gets it right today; in an article about how people drink more bottled water and less of just about everything else, they claim that

THOSE eight daily glasses of water you’re supposed to drink for good health? They will cost you $0.00135 — about 49 cents a year — if you take it from a New York City tap.
As I said before, NYC water rates recently went up to 0.27 cents per gallon; assuming that "eight glasses" means "eight [measuring] cups", or half a gallon, this is correct. They then go on to point out that buying bottled water at the same rate would cost about $1,400 yearly. If you work it out, that's $4 a day, which values a 16-ounce bottle of bottled water at $1; that seems about right if you buy them individually, not in cases.

But with bottled water, you're really paying for the bottle, not the water.

On a related note, the Philadelphia Water Department is now giving out free bottles of tap water for events. The thinking is not financial, but environmental; they figure that if people are aware that tap water tastes good, then they won't use as much bottled water in the future. Bottled water is bad for the environment, because it's packaged in plastic containers and is often transported very long distances. Yesterday I saw someone buying FIJI water at the store on my corner. This comes from -- you guessed it -- Fiji, which is eight thousand miles away.

Personally, I buy bottled water for the convenience when I'm away from home but would never consider buying bottled water for my home. I've also been known to refill empty bottles with tap water, although there are rumors that that's unsafe.

02 July 2007

jury duty: coincidences, and semi-juries

Today I had jury duty.

During the lunch break I went to Reading Terminal Market, where I spent $9.05 for lunch (it was a large lunch, because I didn't want to be sitting around hungry); my pay for one day of jury duty was $9. (I was not chosen for a trial.) Coincidence? Probably, because I wasn't thinking "I'm spending my nine bucks on lunch" when I was walking around choosing where I would buy it.

Then I wandered down to a bookstore and found myself flipping through Steven Landsburg's book More Sex Is Safer Sex: The Unconventional Wisdom of Economics. . (I didn't buy it; it seemed interesting, but not $26 worth of interesting.) In particular, this book suggests that the jury system is broken (the link goes to the Freakonomics blogs, where he was interviewed a few weeks ago). The basic idea is that jurors have no incentive to do a good job. This is clearly true, although I'm not sure how to incentivize the jury system. When I got home I ran across an entry in the Freakonomics blog which mentioned that book. Coincidence? Maybe. Maybe not. (And I thin I saw the original Landsburg interview a few weeks ago and forgot about it, which may have primed me to be more likely to look at that specific book.)

Yet another coincidence: I went to high school with the judge's son. (I don't think this is how I got out of serving.) I also went to high school with the son of one of my panel-mates. It occurred to me as I was heading in this morning that if a few hundred people were called today, the chances I'd know one of them were not bad; there are probably about a million adults in Philadelphia, of whom I know a few hundred. I don't think anyone I know was there today (if so, I didn't see them) but as I said there were parents of people I knew. In some ways Philly is the largest small town in the country.

While waiting to be selected, it occurred to me that the voir dire procedure is set up so that no individual juror who is selected was biased. We were a panel of 50 for a sexual assault case, from which fourteen jurors were essentially selected; although I wasn't counting, I would guess that there were no more than twenty people who satisfied the following three conditions:

  • 1. doesn't possess a strong technical background (we had to write our occupations on the forms that were distributed; it seemed that all the people who were asked about their occupation by the judge were either people in technical fields or people who worked as lawyers, police officers, etc.);

  • 2. does not claim that jury duty would pose an extreme hardship;

  • 3. had not been sexually assaulted or had someone close to them sexually assaulted. It's often said that one in four people are sexually assaulted during their lifetime.


Still, would it have been such a horrible thing to have a sexual assault victim on the jury? A randomly selected panel of fourteen would probably have had at least one. I don't see why each individual juror has to be unbiased in order for the group as a whole to be unbiased.

Finally, some math. In Landsburg's book he suggests the following: break each jury up into two half-juries of six. If they come to the same conclusion, that's the verdict; he wasn't clear on what to do if they came to opposing conclusions. (Presumably it would be treated like current hung juries are.) In this study by Bruce Spencer it's suggested that juries are "right" about 88% of the time. This got me thinking -- how likely does this mean an individual juror is to be "right" about the verdict? If we assume that jurors make their decisions independently, that majority rules (which is a bit ingenuous because juries in criminal cases have to be unanimous), and throw out 6-6 results, it turns out each individual juror has to come to the right decision with probability 63.6% to recover this 88% probability. This is related to the post I made a couple weeks ago about the World Series; if one team is slightly better than another, they have a decent chance of winning a single game but not so good a chance of winning a whole series. The teams here are, of course, "guilty" and "not guilty".

So what does this say for the half-jury suggestion? Let's say that each juror, indepedently, has a 63.6% chance of being right, and there's a jury of six. Say the defendant is guilty. Then the probability that all six jurors will say this is (.636)6 = .066; the probability that five think he's guilty and one thinks he's innocent is 6(.636)5(.364) = .227; the probability of the 4-2 split is 15(.636)4(.364)2 = .325. So the probability of one of these three results is 0.618; the probability of having a 3-3 split is 20(.636)3(.364)3 = 0.248. So the probability of a half-jury finding the defendant guilty is (.618)/(1-.248) = .821. Not surprisingly, this is less than the chance of a full jury finding the defendant guilty.

But the chance that both half-juries find the defendant guilty is (.821)2 = .674; the chance that they both find him innocent (even though he did it!) is (1-.821)2 = .032. So the probability of finding the defendant guilty, given that there's a verdict at all, is .674/(.674+.032) = .955. In the end, this plan achieves much greater accuracy at the expense of increasing the number of hung juries. It seems worth considering, though. (Incidentally, you can't beat the hung jury problem by changing the sub-jury size; either at least one sub-jury is of even size or there's an even number of sub-juries, since 12 is even.)

I suspect, though, that this sort of thing would be rejected as being unnecessarily complicated. But the current voir dire process is byzantine enough that that hardly seems like a legitimate complaint.

edit (Tuesday, 9:16 AM): Landsburg has commented to this entry. In particular he points out that my assumption that juries would have the same accuracy in the arrangement with two half-juries as in the current system is incorrect; jurors would have more incentive to be accurate in his proposed system. This is true because in his proposed system the jurors are rewarded when both juries agree. But what I intended to show was that even without such a reward, his system still leads to a greater proportion of correct verdicts.

edit (Tuesday, 2:16 PM): Richard Dawkins suggested in 1997 that "Two juries of six members, or three juries of four members, would probably be an improvement over the present system". He also points out that jurors don't act independently, which is true; in my original analysis I was suggesting that even though jurors don't act independently, we'll assume that they act independently up until the moment they begin deliberation. This assumption is of course not true, but it was only a crude analysis.

22 June 2007

Six murders in one day in Philadelphia.

There were six homicides in Philadelphia yesterday. The headline in the Philadelphia Inquirer is "Summer's beginning: Six dead in one day". The events happened as follows:

  • a triple homicide in North Philadelphia;

  • a triple shooting in Kensington -- two died, one was critically wounded;

  • one man shot to death in Kingsessing.


I saw the headline while walking past a newspaper box well before I read the article. I thought "hmm, six murders in one day, is that a lot?" Last year Philadelphia had 406 murders; this year there have been 195 so far, as compared to 177 up until this time last year. The number I carry around in my head is that Philadelphia has one murder a day, although the actual 2006 figure was about 1.11 murders per day.

Since I didn't know that there had only been three incidents, I assumed that the six murders had all been separate. Furthermore, I assumed that murders are committed independently, since the murderers aren't aware of each other's actions. This second assumption seems believable to me. I've heard that, say, school shootings inspire copycats, mostly because they create a media circus around them -- at the time of the Virginia Tech massacres I remember people saying that the media shouldn't cover the shootings so much because they might "give people ideas", and I vaguely recall similar sentiments around the time of Columbine. But a single murder, in a city where the average day sees one murder, doesn't draw much attention.

If the murders are independent, then I figure I can model the random variable "number of murders per day" with a Poisson distribution. The rate of the distribution would be the average number of murders per day, which is 1.11; thus the probability of having n murders in a day should be e-1.11 (1.11)n/n!. This leads to the numbers:



n:01234567+
Prob. of n murders in one day0.32960.36580.20300.07510.02090.00460.000860.00016

So six or more murders should happen in a day about one day in a thousand, or once in almost three years. That seems like an argument for newsworthiness. But on the other hand, let's say there's some lesser crime -- crime X -- that is committed in Philadelphia with such frequency that crime X does not occur on only one day in a thousand. (Such a crime would be something that happens 2516 times per year, or 6.9 times a day.) I don't see that being front-page news. Lots of one-in-a-thousand things happen every day.

Of course, what actually occurred yesterday was not six independent murders. It sounds like there were only three murderers. So it's time for new assumptions. Let's now assume that all murderers act independently, but that two in five of them kills one person; two in five kill two people; one in five kill three people. This means the average murderer kills 1.8 people. Further, let's say that murderers go out and kill people as a Poisson process with rate 0.62 -- that's the old rate divided by 1.8, so there are still the same number of murders.

(The assumptions of how many people a murderer murders are made up, I admit, but the only list of murders I can find are the Inquirer's interactive maps, and it doesn't seem worth the time to harvest the data I'd need from them.)

Now, for example, the probability that three people are murdered on any given day is the sum of the probability that there's one triple homicide, one double and one single, or three single. Running through the computation, I get:



n:01234567+
Prob. of n murders in one day0.53790.13340.14990.10120.03720.02300.01030.0071

The probability of one or two murders in a day goes down; the probability of zero, or of three or more, goes up. Suddenly yesterday isn't nearly as rare. Days with six or more murders are, under these assumptions, 1.74% of all days -- just over six per year.

The calculation I'm afraid to do -- if I even could do it -- is "how likely am I to get murdered each time I go outside?" Fortunately I live in a decent neighborhood; but some neighborhoods not that far away from me have had some of the worst violence. But it occurred to me that at 400 murders a year, if you live in Philadelphia for 75 years there will be thirty thousand murders in that time span. Philly has about 1.5 million people. So if things stay like they are, the average Philadelphian has a one in fifty chance of dying by murder. In comparison, the nationwide murder rate in 2005 was 5.6 per 100,000; multiplying by an average lifespan of 75 years we get 420 murders per 100,000 people. So one in every two hundred and forty Americans will die of murder, if things stay like they are.