I’ve been stealing recipes from my mother: Ice cream pie

This recipe is a bit of a childhood favourite of mine, and when I was home for the weekend my mother made it for the first time in probably about ten years. It’s apparently very labour intensive to make, which is why she doesn’t make it that often.

It’s an incredibly 70s thing, but it’s a deliciously 70s thing rather than Ham, Banana and Hollandaise.

What is ice cream pie? It’s pretty much exactly what it sounds like. It’s pie… filled with ice cream. The topping is meringue rather than a pastry crust, which means it can cook quickly enough for the ice cream not to melt.

Here’s the recipe in its original form:

piecomposite

Transcription

DELUXE ICE CREAM PIE

Make a crumbcrust in a 9-10″ pie plate. BAKE and COOL.

FUDGE SAUCE: Beat 3 egg yolks until thick and lemon colored. Beat in \(\frac{1}{2}\) cup powdered sugar and 2 oz. melted unsweetened chocolate. (if swwet choc, reduce powdered sugar to \(\frac{1}{4}\) cup or less. Beat 3 egg whites until soft peaks form. Fold into chocolate mixture. Spread half of this mixture over bottom of pie crust. Then layer with favorite ice cream, using two flavors. Put one layer of choc. sauce in middle also. Top with wipped cream or meringue (see back recipe).

Freeze pie for at least 6 hours before serving. Can be made up one week in advance and topping added later.

MERINUE TOPPING: (for one pie)

  • 3 egg whites
  • \(\frac{1}{4}\) tsp. cream of tartar
  • 3/4 cup sugar
  • \(\frac{1}{2}\) tsp. vanilla

Beat egg whites until frothy with vanilla and cream of tartar. Gradually add sugar until satiny. Pile on top of frozen pie, bake in preheated \(400^o\) oven to brown,approx 8 mins. Serve immediately – at this point the ice cream will have softened just enough for easy cutting and serving.

Notes

Primary note: Om nom nom.

Secondary note: I don’t actually know how to make a crumb crust (I don’t do much baking). This looks like a good recipe for it though. I believe my mother uses digestive biscuits rather than graham crackers, but that might just be because we’re in the UK so they’re easier to obtain.

This entry was posted in Food on by .

Deterministic voting is just too random

One of the issues that often gets cited as an objection to random ballot is that it’s too random. What happens if a lunatic fringe gets voted in to power? People might get a majority simply by random chance.

This is just a brief note on how unlikely that is.

Suppose there are \(N\) seats, and we have a party with a fraction \(q\) of the vote. Let \(W_i\) be a random variable which is 1 if the party wins seat \(i\) and 0 if it loses. Let \(W = \sum W_i\) be the number of votes won and \(q_i = P(W_i = 1)\).

\(W\) is a sum of independent random variables. I’m going to assume that \(N\) is large enough that we can apply the law of large numbers and approximate it as a normal random variable.

So from now on we’ll pretend \[W \sim \mathrm{Normal}(qN, \sigma^2)\]

Then the probability of getting a majority is
\[
\begin{align*}
P(W > \frac{1}{2}N) & = P(Z > \frac{(\frac{1}{2} – q)N}{\sigma})\\
&= 1 – \mathrm{erf}\left((\frac{1}{2} – q)\sqrt{\frac{N}{q(1-q)}} \right) \\
\end{align*}\]

erf is monotonic increasing, so this value is maximized by making the argument as small as possible. Everything in there other than \(\sigma\) is fixed, so this is done by maximizing \(\sigma\), or equivalently \(\sigma^2\)

When does this happen?

Well \(W\) is a sum of independent random variables, so its variance is the sum of their variances. So \[\sigma^2 = \sum q_i(1 – q_i)\]

We want to maximize this subject to the constraint that \(\sum q_i = qN\). We can turn this constrained optimisation problem into an unconstrained one by adding a lagrange multiplier t. So we’re optimising the function \[f(q_i, t) = \sum q_i(1 – q_i) + t (\sum q_i – qN)\]

Taking partial derivatives we have

\[\frac{\partial f}{\partial q_i} = 1 – 2 q_i + t\]

Setting this to 0 we get

\[ q_i = \frac{1 – t}{2} \]

The significant part of this being that it’s a constant that doesn’t depend on i. So applying the constraint we have \(q = q_i\), and \(\sigma^2 = N q (1 – q)\).

(I think it’s probably possible to reach this conclusion without the normality assumption, but I haven’t thought through the details).

Thus
\[
\begin{align*}
P(\mathrm{majority}) & = 1 – \mathrm{erf}\left(\frac{(\frac{1}{2} – q)N}{\sigma}\right)\\
& = 1 – \mathrm{erf}\left((\frac{1}{2} – q)\sqrt{\frac{N}{q(1-q)}}\right)\\
\end{align*}
\]

At this point we’ll just plug some numbers in. Here’s some python code:

import math
from scipy.special import erf
 
def probability_of_majority(n,p):
    sd = math.sqrt(n * p * (1 - p))
    deviations_to_majority = n * (0.5 - p) / sd
    return 1 - erf(deviations_to_majority)

At this point let’s just plug some numbers in.

Consider the UK house of commons with its 650 seats. Suppose we have 40% of the vote. What are the chances of us getting a majority?

Plugging them into our python code we get that the answer is 1.84e-13. i.e. if we ran a general election 5 times a year between now and the point when homo sapiens first started to appear, it would still be extremely surprising if any parties with 40% of the vote had ever achieved a majority.

At 45% of the vote we have a probability of 0.00029. If we ran an annual election every year since the birth of Christ, it’d still be more likely than not this would never have happened but it wouldn’t be very surprising.

At 48% of the vote we’re up to 0.15. At this point we expect this to happen every few general elections.

So the lunatic fringe? They’re not going anywhere. The lunatic majority? Well, that’s what you get in a Democracy. But unless someone actually has a majority they’re not getting in.

Compare this to the percentage of the popular vote with which parties typically reach a majority in the UK under a deterministic system.

From this I can only conclude that deterministic voting (in a constituency based system) is simply too random to be practical.

This entry was posted in voting on by .

Now with added Flattr

I’ve been using The Old Reader as my replacement Google Reader. It’s not perfect, but I’m hopeful the bits that annoy me will improve (I think they’re about 80% scaling issues). As such I wanted to pay for it. They did a post recently saying that right now the way to do that was Flattr. I’d encountered the idea before but not really paid attention, but oh well. So I’ve signed up and am now Flattring the old reader. So to speak.

While there, I also hooked it up to my Github account, because it was easy and I figured I might as well. Then it occurred to me that this means that I in principle am also receiving money for my github projects (this doesn’t seem to actually be the case – the small number of people who have starred something I wrote don’t appear to have Flattr accounts. Oh well), and that if I was going to do that I might as well add a Flattr connection to my other primary repository of content online: Here.

So, yeah, that’s why you now see a Flattr link on each post and page on this site. I don’t really expect people to give me money, and I’m certainly not counting on it, but if you enjoyed something I wrote and want to say thanks, please do!

This entry was posted in Admin on by .

A bugfix for my queuing business model

I’ve been thinking about the queuing model of business I posted the other day and I’ve realised it has a bit of a flaw that I’d missed because it’s not really relevant in the original medical context I came up with this in. Fortunately, some thinking around this flaw has caused me to come up with a model that I think is actually better, even for the original medical application.

The problem comes in two parts, but really they’re the same core issue: Your highest paying customer can always hog resources (this was much less of a problem for the medical case because you’re naturally limited in terms of how many resources you can actually consume as an individual).

Consider the following two problem cases:

  • Your top customer wants to transcode 1000 videos
  • Your top customer is asking for the meeting room every day

In the first case your customer is spamming the queue with a large number of jobs. Each job takes up a position in the head of the queue and they all have to be cleared for any jobs from other customers to be cleared.

In the second case you are not filling the queue at any point, but the fact that you are repeatedly queue jumping means you’re getting a highly disproportionate share of the resources.

So how do we fix this?

The basic idea remains the same: You have a FIFO queue and a second queue which allows people who pay more to get processed sooner. However we make two modifications:

  1. The second queue is a queue of customers, not jobs. Whenever a customer’s turn comes up, their earliest submitted job gets processed.
  2. The second queue isn’t really a queue at all. It’s a probability distribution.

The second point might require some elaboration…

The idea is simple: If we have three customers with scores 2, 1 and 1 respectively, we want to give the first customer 50% of the resources, but no more than 50% of the resources. The second two should split the remainder equally.

So what we do? We run a lottery! (yaaaay).

When we want to process a paying customer, we pick a customer at random with probability proportional to their score. So someone with twice as high a score gets picked twice as often.

And, yeah, that’s pretty much it.

As well as being fairer as less prone to pissing your customers off, this also has a really nice business benefit: People always have an incentive to pay you more. In the old model there was very little benefit to increasing the amount you pay unless you increase the amount you pay by a lot. In the new model every penny you add increases the percentage of the priority resources you get and thus is potentially of benefit to you.

This entry was posted in Uncategorized on by .

A freemium model for scheduling

As a software developer I like proposing algorithmic solutions to social problems.

As someone with an unhealthy addiction to startups, I like business models (actually I’m not sure that follows…).

As a Brit, I obviously fucking love queuing.

As a leftie, I think socialized healthcare is a fundamental human right and I love the NHS to bits.

So when tell you that this is a blog post about a queuing algorithm based business model inspired by a question of socialized healthcare, you can understand how it might be difficult to convey my excitement about this idea without, frankly, being a bit inappropriate.

It also works well with randomized algorithms, a pet love of mine, so there’s that too.

Best cup of tea ever by alittlething, on Flickr

For some added Britishness…

Continue reading

This entry was posted in rambling nonsense, Work, World domination on by .