Hacker News new | ask | show | jobs
by kgroll 5675 days ago
Edit: Just noticed that the Wolfram links break because of their syntax. HN then worsens the problem, by shortening the displayed links with '...', meaning copy/paste breaks! So I'm just removing the http prefix and you'll have to copy/paste to view any of the graphs.

---

This seems to disagree with the gist of the comic, but I think the answer to the final part (largest dating pool) is 23 years old.

I arrived at that by doing the following, please correct me if you spot an error along the way!

The dating range for any age, t, would be defined as:

  lower limit = .5t + 7
  upper limit = 2t - 14
This agrees with the example in the XKCD strip. The dating range for an 18 year old is from .5(18)+7 = 16 to 2(18)-14 = 22. Because this is linear, the range will always be increasing with age.

Despite the range growing with age, we know that the proportion of singles is decreasing with age. Sigh. That's where the other model comes in. The author of this problem gives:

  S(t) = e^(-0.05*t)
That looks like this: www.wolframalpha.com/input/?i=Plot[E^(-0.05+x),+{x,+85,18}]

I believe the largest dating pool would correspond with the greatest area yielded by taking the definite integral of this function from .5t+7 (the lower age limit) to 2t+14 (the upper age limit). To see this in pretty print, you can visit this link: www.wolframalpha.com/input/?i=integrate+(E^(-.05x))+dx+from+(.5x%2B7)+to+(2*x-14)

Evaluating that for any age would give the area under the curve corresponding to that age.

The next step, then, would be to find the maximum area for any age. To do this, we should be able to take the derivative of that previous equation, and set it equal to 0 in order to maximize it. Again, correct me if I'm wrong, but for the result of that, I get:

  -2000(e^(-0.1t+0.7) - e^(-0.025t+0.35)) = 0
I plotted that to find that the max was located at age t = 23.

This graph illustrates the size of the dating pool corresponding to age along the x axis: www.wolframalpha.com/input/?i=Plot[-2000(e^(-0.1x%2B0.7)-e^(-0.025x%2B0.35)),+{x,+0,+100}]

Comments? Did I approach this totally wrong? Did I miss something along the way? Does that seem reasonable?

1 comments

The upper age limit is 2t-14 (as you note earlier in your comment) rather than the 2t+14 you mention later.

Integrating, you get -20(e^(-0.05(2x-14)) - e^(-0.05(x/2+7)))

The derivative (eliminating the constant) is: (e^0.7)(-0.1)(e^(-0.1x))+(e^-0.35)(0.025)(e^(-0.025x))

Wolfram gives about 32.5 as the root. You can plot the integral (try www.coolmath.com/graphit) and mouse over to confirm.