Author Archives: david

Well that didn’t last long

As you’re probably aware, I joined Google back in June.

Well, on Thursday I handed in my notice. By the time my notice period completes that will be exactly 6 months employed here, making it one of my shortest employments to date.

This shouldn’t be taken as anything against Google per se, it was just a really bad fit between me and them. It resulted in my being unhappy and my doing bad work, so I took the decision that it would be better for both of us if I went and did something else. So that’s what I’m doing.

In the short term my plan is to put the financial buffer that even a short time working at Google was very good for building up to good use, so I am taking until at least the end of February to work on my own projects and do some self-study. I am explicitly refusing to think about what my next job will be until February 1, so please don’t ask or suggest things until then.

I’m not yet sure whether or when I’ll be going back to London. When time comes to look for a new job I’ll be considering jobs in both Zurich and London, as well as remote work ones. If I find a job I want to do in Zurich obviously I’ll stay, similarly if I find one in London I’ll obviously move back. I don’t yet know what I’ll do in the case of remote work.

This entry was posted in Uncategorized on by .

So you want to read some Fantasy

This is a slightly cleaned up post from my tumblr. AKA I’m phoning this one in because I don’t have any good ideas and I’m about to derail on my Beeminder goal for blogging.

So you like sci-fi and want to try some fantasy books but are kinda allergic to elves and Tolkien. Where to start?

Well, here are some things you could try. It’s a list of books I selected roughly for covering a wide spectrum while being enjoyable reads with solid world building and a relative paucity of the standard fantasy tropes (all guaranteed 100% elf free). It’s very much not intended to be a selection of great literature, though some of them are pretty good.

The Chalion series by Lois McMaster Bujold

“The Curse of Chalion” and “The Paladin of Souls”. I actually don’t remember this series all that well, but it’s good (Bujold is generally excellent), fairly political fantasy with a modest amount of magic (magic is a major plot point, but there’s a shortage of people throwing fireballs around) and absolutely zero elves.

The Mistborn series by Brandon Sanderson

Action heavy save-the-world-from-the-dark-overlord fantasy. Probably the closest to a Tolkien derivative on the list, but closer to a deconstruction than a derivative. Very well thought out world building (it’s one of Brandon Sanderson’s strength) and lots of violence.

The PC Peter Grant series by Ben Aaronovitch

Now in the other end of fantasy – urban fantasy. Meet PC Peter Grant. He’s a cop! But he’s also a wizard! Crime solving and a modern genre savvy character who has been introduced to magic once he was an adult and spends a lot of his time (when not solving crimes) trying to figure out how the fuck it actually works. Steeped in lots of lovely detail about London (only some of it fictional).

The Kate Daniels series by Ilona Andrews

Post-apocalyptic urban fantasy. Vampires and Werewolves (the former non-traditional, the latter pretty standard). Another action heavy recommendation. Interesting collection of sometimes deeply flawed characters. A great deal of violence, often dealt out by the very large sword the protagonist (Kate Daniels) wields.

The Parasol Protectorate series by Gail Carriger

Super adorable steampunk. Also contains vampires and werewolves. The protagonist suffers from several disadvantages in polite society – she’s half-italian, far too strong minded for her gender, and unfortunately finds herself lacking a soul. She rarely lets these stop her.

Everyone I’ve recommended these to has gone from “Oh god are you serious?” to “THESE ARE AMAZING”.

Chronicles of an Age of Darkness by Hugh Cook

There’s nothing else like this series. It’s also out of print so may be hard to find. Vast sprawling multiple viewpoint hybrid sci-fi and fantasy. Well worth reading.

The Farsala trilogy by Hilari Bell

The evil empire is invading, and a hero must rise to defend against it.

Only… the hero in question doesn’t actually exist, and the evil empire turns out to be really a lot less bad than some of our allies.

Very enjoyable little series deconstructing how myths get made. Manages to include lots of shades of grey while avoiding everything being grimdark and terrible.

The Farseer series by Robin Hobb

Our protagonist, Fitz, is a royal bastard who gets trained up as an assassin.

He’s also the author’s chew toy. Honestly by the end of the series you just want to wrap him up in a blanket and give him a big hug. Sure, a lot of it is his own damn fault, but the poor guy just can’t catch a break.

Contains dragons, and may contain trace quantities of elf if you squint hard but they’re all very dead.

The Legends of Ethshar series by Lawrence Watt Evans

Probably the most obscure recommendation on this list.

A series of shortish novels set in an interesting and well constructed world. They’re none too deep, but they’re all enjoyable reads. They cover a bunch of fantasy tropes while managing to avoid either being cliched or going full blown deconstruction.

Contains dragons and extinct elves.

The Steerswoman Series by Rosemary Kirstein

OK, this one is a cheat. It’s totally not fantasy, but is in fact science fiction.

This is despite the fact that it is mostly a sword and sorcery series about evil manipulative wizards.

However I include it here because a) It’s really good and b) Its very nature might make it a good gateway fantasy novel.

The Furies of Calderon by Jim Butcher

This is not the Jim Butcher series that everyone will recommend you read (that would be “The Dresden Files”, but I consider the Kate Daniels books a much better intro to that class of fantasy).

Roman derived culture with magic. A certain amount of political intrigue. Quite a lot of war. An alien invasion to fight off.

The Magister Trilogy by Celia Friedman

Celia Friedman’s general schtick is deals with the devil (generally not literally the devil, though in one other series it comes pretty close) to save the world.

In this world magic is done by literally draining your life – magic users tend not to last very long, dying of old age in their late 30s if they push themselves too hard. There is however one group called the magisters who can somehow do magic without.

By complete coincidence there is also this mysterious wasting disease that affects some of the population.

The Craft Sequence by Max Gladstone

Magic as a metaphor for economics. This is really more a collection of same world novels than a series per se. The first book is basically a law procedural with necromancers.

The Guards books by Terry Pratchett

Discworld in general is good, but I regard the Guards books (Starting with “Guards! Guards!”) as some of the best of them, and generally a very good intro to how Pratchett’s use of fantasy for social commentary.

And the rest

This is just a fairly random cross section of fantasy books I like that I think make good intros and cover a good segment of fantasy while escaping Tolkien almost entirely. There are plenty of others, though I’d probably say that if you don’t like any of these fantasy might not be your genre (and that’s fine).

This entry was posted in Books on by .

Fallacies programmers believe about credit cards

Actually I only have one:

  1. The person trying to use this credit card wants to pay in the currency of the country they are currently in

I have encountered this as a problem multiple times recently: I live in Switzerland. I don’t however have a Swiss credit card, and my bank card is not one I can use to pay online. This is a thing I should sort out but in the meantime I would greatly prefer it if when paying on a British site they would give me the option to have my British credit card billed in GBP. Seriously, this is really starting to get on my nerves. You want my money in GBP. My credit card pays out GBP. Let me tell you to bill it in GBP instead of getting me hit with a foreign currency conversion fee by my bank.

This entry was posted in programming on by .

Asymptotic behaviour of max(Z_n)

More on high variance strategies.

I was wondering what the asymptotic behaviour of \(\max(Z_n)\) was. It seems “obvious” that it should grow without bound, but it turns out that it grows really very slowly. It turns out that for \(n = 10^{10}\) it’s still less than 7.

I thought I would quickly verify that it does actually grow without bound.

Let \(T_n = \max Z_n\). Then \(E(T_n) = E(T_n | T_n < 0) P(T_n < 0) + E(T_n | T_n > 0) P(T_n > 0)\). But \(E(T_n | T_n < 0) \geq -1\) (because \(E(Z_1 | Z_1 < 0) = -1\) and \(T_n \geq Z_1\)\) and \(P(T_n < 0) = 2^{-n}\), so \(E(T_n) \geq (1 – 2^{-n}) E(T_n|T_n > 0) – 2^{-n}\). So we need only concern ourselves with the positive behaviour.

Let \(S_n\) be a random variable with the distribution of \(T_n | T_n > 0\).

Consider \(t > 0\). We want to show that for sufficiently large \(n\), \(E(S_n) > t\).

Now for any \(s\), \(E(S_n) \geq s P(S_n \geq s)\), because \(S_n\) is always positive. So let \(s = 2t\). Now \(E(S_n) \geq 2t P(S_n \geq 2t)\).

But \(P(S_n \geq s) \geq P(T_n \geq s) = 1 – F(s)^n\) where \(F\) is the cdf of the standard normal distribution. So \(E(S_n) \geq 2t (1 – F(2t)^n)\).

But if \(n \geq \frac{\log(\frac{1}{2})}{\log(F(2t))}\) then \(F(2t)^n \leq \frac{1}{2}\) and so \(E(S_n) \geq 2t (1 – \frac{1}{2}) = t\).

Thus \(E(S_n)\) grows without bound and thus so does \(E(T_n)\).

This could be tightened up a bit to get the asymptotic behaviour of the growth, but I’m not that clear on what the asymptotic behaviour of \(F(t)\) is so I haven’t worked through the details yet.

This entry was posted in Numbers are hard on by .

Another take on high variance strategies

So I was thinking about my high variance strategies post and I realised that there was a case I hadn’t considered which is kinda important.

Which is that often you’re not very interested in how good your best solution is, only that it’s at least this good for some “this good” bar. e.g. you don’t care how cured cancer is as long as it’s pretty cured, you don’t care how many votes you got as long as it’s enough to win the election, etc.

So for these circumstances, maximizing the expected value is just not very interesting. What you want to do is maximize \(P(R \geq t)\) for some threshold \(t\). The strategies for this look quite different.

Firstly: If you can ensure that \(\mu > t\) the optimal strategy is basically do that and then make the variance as low as you can.

For the case where you can’t do that the region of which is better, variance or mean, becomes more complicated.

Let \(F\) be the cumulative distribution function of your standardised distribution (this can be normal but it doesn’t matter for this). Then \(P(R \geq t) = (1 – F(\frac{t – \mu}{\sigma}))^n\). This is what we want to maximize.

But really what we’re interested in for this question is whether mean or variance are more useful. So we’ll only look at local maximization. Because this probability is monotonically decreasing in \(g(\mu, \sigma) = \frac{t – \mu}{\sigma}\) we can just minimize that.

\(\frac{\partial}{\partial \mu} g = -\frac{1}{\sigma}\)

\(\frac{\partial}{\partial \sigma} g = -\frac{t – \mu}{\sigma^2}\)

So what we’re interested in is the region where increasing \(\sigma\) will decrease \(g\) faster than increasing \(\mu\) will. i.e. we want the region where

\(- \frac{t – \mu}{\sigma^2} < -\frac{1}{\sigma}\)

or equivalently

\(t – \mu > \sigma\)

i.e. \(t > \mu + \sigma\)

That’s a surprisingly neat result. So basically the conclusion is that if you’re pretty close to achieving your bound (within one standard deviation of it) then you’re better off increasing the mean to get closer to that bound. If on the other hand you’re really far away you’re much better off raising the variance hoping that someone gets lucky.

Interestingly unlike maximizing the expected value this doesn’t depend at all on the number of people. More people increases your chance of someone getting lucky and achieving the goal, but it doesn’t change how you maximize that chance.

 

This entry was posted in Numbers are hard on by .