Sound and Fury

Signifying nothing

Archive for the ‘maths’ Category

Geek poetry

without comments

I’ve not posted for a while: I’ve been busy doing things other than procrastinating! OK that’s a lie, but the procrastination hasn’t taken the form of blog posts for a while. My website looks much the same as ever, but lots has changed under the hood, as it were. It now validates as XHTML and the columns are the same height and extend to accommodate as much text as needed. Hoorah. I also have an essay I’m rather proud of. (Actual work, shock horror!) It is probably over long and not all that much of it can be adapted to fit into my literature review, but I’m still happy with the (almost) finished product. On an unrelated note, here are some poems that appealed to the geek in me.

Here is the halting problem proven in poem form.

A poem composed entirely of punctuation. (I may have linked to this before.)

I remember a maths lecturer at Warwick starting a lesson by telling us:
Integral t-squared dt
from 1 to the cube root of 3
times the cosine
of three pi over 9
equals log of the cube root of ‘e’.

More maths limericks here.

A history of Western philosophy in limerick form you say? Well why not?

And of course there’s limerickdb. The marked geeky charm of the top 150 indicates that this project is from the chap behind xkcd.

And while it’s not a poem, it’s certainly the same ballpark.

And finally my own contribution thanks to getting bored during measure theory lectures. I give you a haiku about basic measure spaces:

A finite union
of disjoint rectangles is
elementary

I have tons more of these on some scrap of paper in my old notes folder. I also wrote a limerick about Rene Magritte once… (I rhymed “Rene Magritte” with “ceci n’est pas une pipe”)

Written by Seamus

August 6, 2009 at 12:13 am

Posted in internet, logic, maths

Tagged with , , , ,

Majority logic I

with 3 comments

When I went for an interview at Oxford for my undergrad degree one of the things we had to do was a kind of logic test. It had things like “All men wear hats, some men wear ties” and you were asked what it was possible to conclude from that. Presumably they were looking for something like “Some men wear ties and hats”. One of the questions was “Most men wear ties, most men wear hats”. I said that it wasn’t possible to conclude anything from this. But it was then explained to me that if hat-wearers and tie-wearers are both in a majority, then there must be some who are both: the proper conclusion is that “Some men wear ties and hats”.

“All men” is standing in for the universal quantifier (x) and “Some men” stands for the existential quantifier (Ex). But “Most men” is awkward to put in similar terms without resorting to some sort of logic enriched with predicates relating to numerical proportions. But that sort of “statistical logic” is too complex. The fact that some predicate applies not to all but to a majority of some domain is an easily understood fact that does not need a whole logic of proportions behind it. Let’s make “Most of” a new kind of quantifier: (Mx). What properties does (Mx) have?

  • (Mx)Px \wedge (Mx)Qx \rightarrow (Ex)Px \wedge Qx

This is the property my interviewer at Oxford was exploiting. If most x’s are P’s and most x’s are Q’s, then some x’s must be both.

  • (x)Px \rightarrow (Mx) Px
  • (Mx) Px \rightarrow (Ex)Px

These two properties simply say that if all men wear hats then most men wear hats and if most men wear hats then some men wear hats.

Do we really need a third quantifier here? Is there some way to express “most of” in terms of universal and existential quantifiers? I’m not sure there is. Here’s a first stab. When you say “(Mx)Px” what you are really saying is:

  • [(Ex)Px ] \wedge [(Mx)Qx \rightarrow (Ex)Px \wedge Qx]

But that’s no good, because that expression still contains an “Mx”. We are kind of going beyond standard predicate logic, but only a little bit. Perhaps Mx shouldn’t be a quantifier, but a property of predicates? But I don’t think that is a particularly satisfying suggestion. A property of predicates would be a third-order entity, and that seems extravagant given the modest goal of formalising the easily understood concept of a majority.

Soon I’ll post again and discuss the “dual” of (Mx): “Only a few men wear hats” “Hat-wearers are in a minority”.

A note on the symbolism: I wanted to use \forall and \exists but I couldn’t think of a way to “invert” the letter “M” in a similar fashion. It shares the vertical symmetry of “A” but when reflected around a horizontal axis as \forall is, you get a “W”, which is no good if the idea is to come up with a new symbol. So I reverted to old-style quantifiers. Suggestions regarding how to “symbolise” majority are most welcome.

Written by Seamus

May 26, 2009 at 10:34 am

Posted in logic, maths, philosophy

Tagged with

Dutch books

without comments

I’ve been thinking about the Dutch Book Argument (DBA) recently. I think the constraints on rational betting preference that underpin the force of the argument are unreasonable. At least they are not always reasonable. I think a better way to think of the argument is as a conditional argument: “Given these rational betting preference conditions, this is how rational degrees of belief should be constrained.” Then you can have a whole series of different DBAs with different betting preference conditions leading to different constraints on credence. It would be interesting to see how one would have to constrain betting preferences in order to have you beliefs behave like upper and lower probabilities or Dempster-Shafer belief functions

I think this isn’t to undermine the force of the DBA, but to reinforce it. With this wider framework we can understand why people often fail to reason probabilistically. We can understand what aspects of rational betting preference are “non-probabilistic”.

That’s not to say that the DBA isn’t without its flaws. Some elements that concern me are:

  • Using betting behaviour as a proxy for belief
  • Existence of exactly specific numerical credence (and utility)
  • Reasoning as calculating expected utilities
  • The idealisations involved in discussing “ideal rational agents”: utility maximising, purely self interested, perfect calculating agents…

Written by Seamus

February 22, 2009 at 7:27 pm

Enumerating structure on sets, again.

without comments

The number of partitions on an N-membered set is called its “Bell number“. The number of strict total orders, I’m not sure about that… There is some relevant information here.

Well it’s good to see those problems solved, and I’m glad they weren’t trivial… Here is a more general issue. How many relations are there on a set? How many transitive? And so on.

So, a relation is simply a set of ordered pairs. So there are 2^X possible relations if there are X ordered pairs. For a set with N elements, there are N^2 ordered pairs. Thus 2^(N^2) relations on N elements. To give you an idea of scale, there are 65,536 relations on the 4 element set. But there are only 15 partitions on the 4 element set (not 18 as I said before; I counted each 2+2 partition twice.) So the properties of being transitive, reflexive and symmetrical must seriously cut down the number of relations! The only thing I’ve concluded in answer to this question is that there is an upper bound on the number of possible total relations on N elements: 2^(N^2) – 2^([n^2]/2). This is because the property of being total means that the size of the set of ordered pairs has to be big enough to contain at least one of (a,b) or (b,a) for every a,b. So small sets of pairs are ruled out.

Written by Seamus

February 12, 2009 at 3:36 pm

Posted in maths

Tagged with , ,

Ennumerating structures on sets

without comments

I have a question: for a set of N elements, how many different ways are there of partitioning it? In other words, how many distinct equivalence relations are there on a set? Similarly, how many distinct strict total orderings are there? How many weak partial orderings?

All of these things (equivalence relations, orderings…) are determined by sets of ordered pairs on the set. So is it easier to calculate numerical formulae for each type of structure on the set, or is it easier to demonstrate that, for example there are more weak partial orderings than there are partitions… It’s trivial, for example, to show that there are at least as many weak partial orderings as there are strict total ones, since each strict total order is equivalent to a weak partial order.

There could be quite a lot of partitions. A partition is a subset of the power set. Or an element of the power set of the power set. So the absolute upper bound on partitions for a 4 element set is 2^(2^4) = 65,536. Obviously this is a ridiculously high figure, but I can’t see an easier way to get closer to the actual number. I am no good at combinatorics. But for the 4 element set you could probably just list all the possible partitions. First list all the ways the sets could break down:

  • 1,1,1,1
  • 2,1,1
  • 2,2
  • 3,1
  • 4

Then list the number of ways of splitting up the 4 elements, A,B,C,D into those sets.

  • Only one {1,1,1,1} partition
  • Six {2,1,1}
  • Six {2,2}
  • Four {3,1}
  • One {4}

For a total of 18 partitions. So there are more partitions than there are subsets. But for the 2 element set, the power set has 4 elements, whereas there are only two possible partitions. My guess is for bigger sets there will be more partitions than there are subsets.

As for strict total orderings, I think there will be N! of them. Because there are N choices for the maximal element, N-1 choices for the next “biggest” and so on. So the 4 element set has 24 strict total orderings on it. N! > 2^N for N>3. As for weak partial ordering, there’s probably even more of them…

What other kinds of structure can one impose on a set? If one thinks of graph theory in terms of set theoretic structure, what then? In undirected graphs, the edges of a graph are pairs of elements of the set of vertices. I just did a little googling and learned that there is something called “graph ennumeration” which is where one studies the number of graphs with a certain number of vertices that have certain properties. Much like the classification of finite groups, I suppose. So for example there are no asymmetric graphs with less than 5 vertices. (Or possibly 6?)

Anyway, that’s just what I was thinking about this morning, when I should probably have been trying to understand the game theory lecture…

Written by Seamus

February 10, 2009 at 2:51 pm

Posted in maths

Oddly enough…

without comments

I read this article which is in the Reuters “Oddly Enough” section, where they put their quirky, weird stories. It was just a little too bleak for my liking. A conman has been exectued in China. And one of the people he conned has commited suicide… Wahey! Funny old world, eh?

Synonymy must be one of very few words to have 3 “y”s in.

There was recently an article in the Guardian saying that some watchdog or thinktank or something had put the UK in the group that is likely to be worst hit by the credit crunch. Along with the Netherlands, Spain, Hungary and Luxembourg… All I could think was “Wow cool, Luxembourg got mentioned in the paper. Wait a minute. Oh shit…” (P.S. I’m not sure those were the right countries, but it was something like that…)

I’m writng an essay on Bertrand’s paradox and similar problems with the principle of indifference, but I’ve changed my mind so many times in the course of writing it… It’s going to need some serious tidying up once I decide what my actual position is. My thinking on the problem over the last year-ish has gone: Ooh Bertrand’s paradox, It’s OK, Jaynes has solved it. Oh no he hasn’t. It’s OK van Fraassen solves problems with indifference, Ah. he hasn’t. Actually, the wine/water problem is fairly conclusive. Actually, Mikkelson has solved it. Ah no he probably hasn’t… Since writing the essay, I’m vacillating between thinking that there is no problem, there’s only a problem in infinite cases, there’s only a problem in uncountable cases or the real problem is only in finiite cases. Now I’m not sure what to think…

Written by Seamus

November 30, 2008 at 1:11 pm

Python and primes

without comments

Today I spent a while reaqcuainting myself with Python and IDLE and trying the first few project Euler challenges. I decided it would be worthwhile to have a list of the first few prime numbers, that would make my job easier for several of the problems. (I don’t care if that’s cheating, I still had to make the list of primes…) So I wrote a program to find primes. It’s tremendously inelegant and probably terrible inefficient, but I’m only going for the primes under 10,000 or so. It doesn’t take long to get them. Then I decided to write something that would find the prime factors of an input. The idea is that if the number to factorise is bigger than the biggest prime in the list, it will run the “find primes” program, until it has big enough primes. Anyway, I haven’t got there yet because it’s late and my brain won’t work properly any more. But I do have a number that will give you prime factors, as long as you give it small enough inputs. To try it out, I ask it for the prime factors of the first number to come into my head: 24. [2,3]. Awesome. Now, try it on something bigger. 2400? [2,3,5] hm. Try something else 24001. Too big. 2401 [7] Whaat? What are the odds of my pick 7^4 to test a prime factorisation program. Anyway, eventually I found a number random enough to satisfy me that the thing was working…

The thing is, the whole thing kind of pulls iteslf up by its bootstraps. So if, somehow, a number that isn’t prime crept into the list or a prime was missed out, the whole thing would be invalid. Because it only checks for divisibility of numbers in the list of primes… I should write some sort of consistency check program to make sure all the numbers in the list are not divisible by any of the smaller numbers in the list.

Written by Seamus

August 24, 2008 at 10:06 pm

Posted in maths, python

Tagged with , , ,

Monty Hall, philosophy links and musical look-alikes.

without comments

The solution to the Monty Hall problem (switching wins you 2/3 of a car) depends for its answer on the fact that you know how Monty will act. Other host behaviours are possible. So my question is this: what is the best strategy if you don’t know what Monty’s behaviour is? Is it different in single case vs long run scenarios? In the latter case, what about a strategy that allows you to alter your behaviour depending on Monty’s behaviour? I don’t really know how to answer these questions; I have enough trouble convincing myself of the solution to the original problem!

In other news, a couple of books by D.H. Mellor are available for free online! Matters of Metaphysics and The Matter of Chance. And more philosophy gubbins- Philosophy Bites: Bitesize philosophy podcasts. Wonderful.

One last thing. Tim Minchin and Duke Special look quite similar. They both play piano type music. But Tim Minchin is from Australia and does comedy songs and Mr. Special is from Northern Ireland and plays “proper music.”

Tim Minchin

Tim Minchin

Duke Special

Duke Special

Written by Seamus

August 11, 2008 at 5:08 pm

Why people are irrational and stupid. Part 1

without comments

So this is the first in what I hope will be a regular feature on this blog highlighting some paradoxes and thought experiments that show that people are not very good at thinking rationally. I hope to convince you that people really do suck at probabilistic reasoning and sometimes even simple logical reasoning fails. This is motivated partly by misanthropy- I think people are stupid. And partly by my fascination with these kinds of puzzles. A third motivation is that I think epistemology based on rational degrees of belief (Subjective Bayesianism for example) is flawed. Particularly in cases like quantum mechanics. But more of that in a later post. For now I’ll stick to the Monty Hall problem.

Monty offers you three doors- A,B and C. Behind one door is a car and behind the other two doors are goats. The idea is to pick the door with the car behind it because then you win the car. But if you don’t want a car, or you do want a goat, imagine that behind one door is something you really do want and behind the other two doors are things you don’t want. Like one door could be a treasure chest full of gold doubloons and behind the other two doors are scurvy. Or behind one door is cake and behind the other two doors is death. Or behind one door is Hans Christian Andersen’s The little mermaid and behind the other two doors is Katie Price’s Mermaids and Pirates. Behind one door is Battleship Potemkin and the other two doors the Pokemon movie. You get the idea.

So you pick a door. WLOG assume you picked door A. Monty now opens one of the other two doors and reveals a goat (scurvy, whatever). Now, you are offered the chance to swap doors. Should you swap doors? The answer is that yes you should. The probability of your winning a car by swapping doors is higher than if you stick with your original door. That does seem a little counter-intuitive, does it not? Surely once one of the goat doors has been revealed, there are two doors remaining and one has a car behind it. 50-50? If you are thinking that, then you are irrational and stupid. That’s not how to think about it.

Think about it this way- 2/3 of the time, the first door you pick, door A, will have a goat behind it. In those circumstances, one of door B or C will have the car (doubloons etc) behind it. So Monty won’t be able to open that door, he’ll have to open the other one. Which means switching will give you the car door. That happens 2/3 of the time… So you should always switch.

To make this even clearer, imagine there are 100 doors. 99% of the time you pick a goat door. Now Monty opens 98 goat doors. To leave you with your door and one other door remaining. So switching doors will net you a car 99% of the time.

There are two strategies. Either always switch or never switch. (OK, there are strategies where you randomly switch with probability p, but trust me setting p = 1 is optimal…) So two options. If you decide to never switch, you get the car 1/3 of the time – those times you pick the right door first time. Always switching, you’d think, would get you the car at least 50% of the time. In fact it’s even better than that. It gets you the car 2/3 of the time. Because if the only strategies are switch or don’t switch, and the only outcomes are win or don’t win; if one strategy wins 1/3 of the time, the other strategy has to win the other two thirds of the time.

Why isn’t it 50%? Because having Monty open a door tells you more about the door you haven’t picked than it does about the door you have picked. If you still aren’t convinced and think it is still 1/2, I suggest we meet up and simulate the game with playing cards, or play the card version of Bertrand’s box paradox. For money. I promise you, if we play for long enough, I will be able to buy myself a car with the money I swindle out of you. Except that I can’t drive. So I’d be looking to buy a chest full of gold. YARRR.

Written by Seamus

August 9, 2008 at 5:33 pm

Posted in maths, paradox

Tagged with , ,

Shoes that annoy me

with 3 comments

Happy Pi approximation day! It’s 22/7, geddit? Here is some history of pi.

On an unrelated note, here are some types of footwear that annoy me more than footwear should.

  • Crocs. Who cares if they’ve been designed to be 62.6% better than standing barefoot? They look really really silly.

    Crocs annoy me

    Crocs annoy me

  • Sandals with socks. Why would you do this? What goes through your mind? “Hmm, it’s warm enough for sandals today… But I’ll put some socks on in case my feet get cold.”

    Sad sad sad.

    Sad sad sad.

  • Converse. I don’t really know why this one annoys me so much. But it does.

    Whod have thought shoes could annoy me so much

    Who'd have thought shoes could annoy me so much

  • Goth boots.  I suppose this just kind of follows from the fact I just don’t really “get” the whole goth thing. But I especially don’t understand how wearing huge boots with comically big heels fits with the whole look. What’s next? Punks on stilts?

    Platform shoes for the terminally moody

    Platform shoes for the terminally moody

Right, that’s about it as far as varieties of footwear I dislike goes.

Written by Seamus

July 22, 2008 at 2:07 pm