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 Uncategorized 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 .

A Martian makes a bet

I’m a Martian.

As a Martian, we’ve long ago licked this “singularity” thing, so I’m logically omniscient, but I’m also bored. I decide to invade Earth, mostly for the lulz. I land my flying saucer, pull out my ray gun, and prepare to get invading.

I come across two earthlings in heated debate. They turn to me and look excited.

“Ah, excellent. A Martian! You can serve as an impartial adjudicator to our debate.”

I am, naturally perplexed.

“Uh, you do know I’m here to invade you right? I have this ray gun?”

“Yes yes. It’s very impressive, but this is much more important.”

“More important than the fact that I’m planning to enslave you all and force you to obey my every whim?”

“Sure, sure. That’s just politics. We don’t care about that. We’re too concerned with matters of real import. We want to know what you think about the sportsball tournament“.

“The what?”

“Ah ha! Excellent. A truly impartial adviser! Tell me, what do you think the chances of the Las Venturas Bandits winning the sportsball tournament are?”

Obviously I have no idea about sportsball. I’m a Martian! We don’t play such things. Still, from a position of complete ignorance I must presume that each team is equally likely to win, so I need only find out how many teams there are to determine my probabilities. So I ask them.

“Oh no. We couldn’t tell you that. If we give you information about sportsball you’d no longer be an impartial judge.”

Their reasoning is odd, but I shall for now adhere to their quaint local customs and apply the obvious prior of \(\frac{1}{n(n+1)}\) on the number of sportsball teams there could be (I leave it as an exercise to the reader why this would be obvious. If you’re logically omniscient like me you already know, if not it should be a simple calculation). From there, the answer is a straightforward calculation.

“Well, naturally the probability is \(\frac{\pi^2}{6} – 1\), or about \(0.645\) if you want to be all numerical about it.”

“Gosh, so confident! But what, then, is the chance of the Beaneaters winning?”

The answer is equally immediate: About \(0.290\).

“Interesting, interesting. But what, pray tell, is the chance of the Jersey Boomers winning?”

“0.185, naturally”

At this point the quieter of the two is starting to look slightly confused, but the loud one keeps talking.

“Truly Martians are very insightful. Can you tell me,  how likely do you think it is that the Swedish Meatballs will win?”

“Oh, about 0.135 I would say”

At this point the one who has been quiet can no longer contain himself.

“I say! These probabilities you’re giving us don’t make any sense. I’ve been counting, and they add up to much more than one! You’re at 1.25 already!”

“Well, naturally. I had to update my probabilities as you gave me new information. At this point the probability of any individual one of the teams you’ve mentioned winning is about 0.135, with about a 0.459 chance that some other team you haven’t mentioned yet wins”.

“But we didn’t give you any information! The whole point was you were supposed to be impartial!”

“Of course you did. You gave me a lower bound on how many teams there were.”

At this point they both turn bright red and start shouting again at each other about how they’ve ruined everything. Thankfully, this gives me the insight I needed to calculate a truly accurate probability for who will win this game.

“Excuse me?”, I interrupt. They both turn to me.

“I’ve now understood the problem more thoroughly and can tell you the chances of each of your teams winning”

“Really? Do tell”.

They both look very eager to have the debate resolved.

So I shoot them.

And then I conquer the planet and ban the whole silly game of sportsball.

The answer is of course, zero. When you make me play silly guessing games, everyone loses.

Addendum

What’s going on here?

Well, the Martian’s prior doesn’t matter really. If you must know, it’s based on a hierarchical Bayesian model where the number of teams is geometric, but the geometric parameter is also unknown and is distributed uniformly on \([0, 1]\). Really this example would work with almost any reasonable prior though (say, any proper prior which assigns non-zero probability to every positive integer). I just wanted something concrete so I could put numbers to it.

So we have a prior on the number of teams. Call this number of teams \(T\). The probability of a given team winning given \(T = n\) is \(\frac{1}{n}\), so the probability of a single named team winning is \(E(\frac{1}{T})\).

But we don’t have a single named team. We’ve been asked a series of questions, each of which tells us the existence of a named team. Therefore our answer to the nth question is not \(E(\frac{1}{T})\) but instead \(E(\frac{1}{T} | T \geq n)\), because we know at that point that there must be at least \(n\) named teams.

For our particular example this is always decreasing, but even in general it must eventually head towards zero because \(E(\frac{1}{T} | T \geq n) \leq \frac{1}{n}\). So as time progresses and we become aware of the existence of more and more teams your probability that you assign to any given one of them must go down.

This is a neat example because it demonstrates how if you insist on Bayesian rather than Knightian uncertainty here, the mere asking of questions can itself be a source of information which causes you to update your probabilities. As we are asked questions we are given an idea of the scope of possibilities available, and this forces us to adjust our updates. This happens even though we are logically omniscient – the questions are not forcing us to consider new possibilities, they are genuinely providing us with new information about the world.

(It is of course possible that the questioners are making names up – say by some ludicrous procedure like just picking names at random from Wikipedia’s list of fictional sports teams – but you could include a term in your probability distribution for that if you wished. I didn’t because that would have made the example harder to follow)

 

This entry was posted in Uncategorized on by .