My name is Vince Knight and I'm a lecturer in Operational Research at Cardiff University with interests in game theory and queueing theory. I'll be using this blog to post about various things mainly including math and software...
www.vincent-knight.com
For the past 4~5 years now I've been lucky enough to tag along with +Paul Harper when he does outreach in high schools. I've developed my own little 'roadshow' that introduces students to Game Theory.
On Wednesday there was a cool event at the School of Mathematics where we had 120 odd 17 year olds in to get a taste for the Mathematics at University (some pics: here and here).
I've blogged many times (and +Dana Ernst has as well: here) about the activity that I run which involves a Prisoners dilemma tournament and 2 rounds of a 2/3rds of the average game, here is my updated set of results over all the times I've played it (the second guess is after we all discuss rational behaviour):
(if any of my student are reading this the above could help them win a box of chocolates on Monday)
This is not the purpose of this post.
Something terrible happened on Wednesday.
During my activity I always show this clip from A Beautiful Mind (awesome movie about John Nash):
Before showing the clip I always ask: "How many of you have seen the movie 'A Beautiful Mind'?".
Now, I've been doing this for 4~5 years and the response I get to this question has made me realise that I'm not cool anymore. I guess there's a point in everyone's life where that realisation hits them. I've been in denial until Wednesday when for the first time ever: not one student had seen the movie :'(. This makes me sad because I think this is probably one of my favourite movies and one I've always thought was pretty cool.
Here's a little plot showing what I've been telling myself over the past few years (the fact that xkcd style graphs is now native to matplotlib is cool, my previous attempt at one of these: 'probability of saying yes to academic responsabilities'):
When I first asked and had about a quarter of the room know what I was talking about I thought that it was kind of cool and a sign of no longer being a kid...
When in twenty years time I embarrass my daughter by opening the door to her boyfriend/girlfriend wearing pyjamas; inviting him/her inside for a talk and reading him/her passages of my PhD thesis or whatever else I can think of, I'll be able to say that it's revenge for not being cool any more and that I made this decision on the 22nd of January 2014.
I just added Graham Poll's awesome +YouTube playlist (http://goo.gl/UZ1Ws) to my "reading" list for my Game Theory course that I'm teaching on Monday and thought that I should also include the humble videos related to Game Theory that I have on my channel:
I also thought I could get away with making a blog post about this. The playlist above has them in 'last in first out' order but here they are in the order that I made them:
A video close to my research interests which look at the intersection of Game Theory and Queueing Theory. This video is actually voiced by +Jason Young who was doing his first research internship at the time with me and will be starting his PhD at the beginning of the 2014/2015 academic year.
A video describing a type of Game called a 'routing game'. Pigou's example is a particular game that shows the damaging effect of selfish (rational) behaviour in a congestion affected system. This video also comes with a bit of +Sage Mathematical Software System code.
This is one of my most popular videos despite the error that +Brandon Hurr pointed out at 3:51. It describes a basic aspect of Cooperative Game Theory and uses the familiar example of needing to share a taxi fare as an illustration.
This video shows off some Python code that I've put online that allows the creation of a population of players/agents that play any given normal form game. There are some neat animations showing the players choosing different strategies as they go.
This isn't actually a video of mine. It is on +LearnAboutOR 's channel but it's a 1hr video of one of the outreach events I do which gets kids/students using Game Theory.
I built a simulation of a queue (Python code here) with a graphical representation (so you see dots going across the screen). This video simply shows what it can do but also shows how selfish behaviour can have a damaging effect in queues.
I'm going to be putting together (fingers crossed: time is short) a bunch more over the coming term.
This academic year is a very busy one for me and I spent most of Christmas working (this isn't unusual at all amongst academics) . This didn't feel strange or 'hard': it was simply what I did.
When one of my brothers in law pointed out that writing code on Christmas morning was a bit 'strange' it reminded me of the fact that Jonny Wilkinson (one the best rugby players of all time) supposedly/famously practices on Christmas day (fact #3 here).
This post is going to be some thoughts about the similarity between professional athletes and academics...
I watched this great +TEDx talk the other day about a kid who describing his 'hackschooling' and in particular discusses 'what he wants to be when he grows up' (the answer is 'happy'):
As a young kid all I ever wanted to be was a professional rugby player (reality set in at about 13-14) . I more or less always had a ball with me, here's a picture of me (I'm the one with my head down) when I was 12ish (I think):
I went to a rugby boarding school when I was 16 and had the best time of my life there. I was never athletically good enough to ever 'be what I wanted to be' (a pro rugby player). A nasty roller blading accident when I was 18 more or less finished off my rugby 'career' anyway.
From the age of about 15 though I think I realised that I needed a more realistic plan and when people would ask me what I wanted to be I'd always say: 'I want a PhD in mathematics and to be a mathematics researcher'. I don't think I really knew what that was, but that's what I would say.
15 years later that's what I am and I consider myself very lucky to be what I wanted to be when I was a kid.
1. Passion
I think that's probably the first similarity between athletes and academics, it's such a competitive environment. Kids who play pro anything most probably invested (as did their families) a lot of time and effort in to getting there.
Similarly for academics. You have to work extremely hard, to get in to a good University, to do well, to get a PhD and then to finally get a 'pro contract' in the form of post-doc or similar.
2. Luck
For every good pro athlete (I don't mean great), there are probably a bunch that were never 'discovered' (or who themselves never discovered that they were/could be great).
I think this is similar to academics, with less and less funding available for research positions and the extremely competitive job market, there are probably quite a few talented people who never even think of pursuing a career in academia.
A lot of it is probably about being in the right place at the right time. Playing a game when a scout happens to be watching is quite similar to how I got my first post-doc: there happened to be some funding available when I was coming to the end of my PhD and my current employers where open minded enough to appreciate my ability to change fields.
3. Hard Work
Academia is hard. Ridiculously hard. You have to juggle various things: teaching, research, outreach, admin (I really hate admin...) and you have to be good at all of them.
Being a pro athlete is (probably) hard. You have to juggle various things: athletic ability, injuries, athletic IQ, press/media and you have to be good at all of them.
The thing is you do all these things, whether or not that's why you got in to the field in the first place. That's probably because of the passion or the pay (I'll get back to the pay later...).
As a rugby player I was not a good tackler, I was terrible. It was something I had to work on a lot harder than on my vision and fitness for example. I used to spend more time than most working on tackling.
In academia it took me quite a while to get 'ok' at writing (my PhD supervisor and +Paul Harper who proof read a lot of my early drafts will no doubt agree with that). This was something that I had to work quite hard at (and still do!).
Ultimately athletes and academics are faced with the same 'problem'/'opportunity'. We can work as hard as we want to. There's always further to go (more weights to lift, another training session to have, more tape to watch, more recovery techniques to try...). Here's a good +PHD Comics that was published today illustrating what I mean:
4. Competitiveness
I love competition. I don't really mind losing, but I love competing (I have a rant that I repeat fairly often about the difference between being a bad loser and being competitive but I'll leave that for another time).
When I was in the running for my permanent post I loved knowing that I was working as hard as I possibly could to get it. If someone was going to get appointed ahead of me it was not going to be because I did not push myself hard enough.
The analogous holds immediately with pro athletes and it's a part of my job that I love.
5. The pay
Ok this is where my analogy perhaps breaks down as the pay is pretty much incomparable but I think there are some parallels to be drawn.
In the press a lot of athletes apparently 'fall out of love with the game' (recently an England cricketer for example was told to go home and remember why he liked cricket), I guess that they sometimes (understandably given how much money comes their way) play for money and it becomes about contracts etc...
For a lot of Academics it's probably the same thing. After a while (snowed under by a pile of admin) it just becomes a job. There's nothing wrong with that of course (a lot of people perhaps end up in Academic 'by mistake' also).
Personally, I think I have the coolest (second to being a pro rugby player) job in the world and am just ridiculously grateful to be able to do it.
The bad sides of this are that I am a workaholic and don't see my wife very often (she sometimes +1s my G+ posts so we do interact), but ultimately I get to do what I wanted to do when I was a kid (if I had been bigger, stronger and faster I'd be writing a flipped version of this on Toulouse's website right now...). In particular I have found teaching to perhaps be one of the most rewarding experiences one can have.
I'm sure there is a lot wrong with my analogy and a huge amount of differences between 'us' and pro athletes... Perhaps this comparison is just a young boys way of coping with his workload and believing that it's actually what he wants to do and that he made it as a 'pro athlete'... ;)
The other great reason why this is awesome is that it just got really easy to use and install Sage.
Here's a short video demonstrating everything I've done below:
If you're familiar with git then you know this but if you're not then you can simply open up a terminal on anything *nix (linux/Mac OS) and type the following:
$ cd ~ $ git clone git://github.com/sagemath/sage.git This basically goes to the git repository on github and clones it to a folder called sage in your home directory (if you don't have git installed you'll have to do that first). Once you've done that you need to 'make' sage: $ cd ~/sage $ make This will take a little while (it goes and gets most of what you need so it's hard to say how long as it depends on your machine) but after that you'll have Sage on your machine. If you're still in the ~/sage directory you can simply type ./sage to start sage. You'll want to add sage to your path so that you can use it from any directory. In this video I did this by using a bit of a trick but here's I'll do something simpler: create a symbolic link to the sage file in ~/sage directory and place that symbolic link in your path (in /usr/bin/local). To do that type this: $ ln -s ~/sage/sage /usr/local/bin/sage Now you can type sage anywhere and you'll get sage up and running. What's really great about all this is that if and when updates/development happens you can just git pull to get all up to date changes. Based on the +Sage Mathematical Software System post on G+: here: it looks like you can already play around with the develop branch... Awesome.
Of course if you want the easiest way to use Sage then simply grab an account on +The Sagemath Cloud. I gave a talk last week at the Cardiff Django/Python user group about it and +William Stein was kind enough to drop in and take some questions: http://www.youtube.com/watch?v=OYVLoTL4xt8 (sound quality isn't always great because I move around a fair bit...)
This is one of those: 'writing this post to make sure I remember how I've done this'.
+William Stein posted about bup which he is using to backup +The Sagemath Cloud (if you haven't seen that before make sure you go check it out, here's a video in which I describe it: http://goo.gl/5DtYQq).
bup is a piece of backup software based on git. Here's a talk by +Zoran Zaric explaining it:
Anyway, here's how I setup bup to work like apple's time machine.
Once bup is installed (super easy following readme instruction on Mac OSX and ubuntu). I run:
$ bup -d pathtochosenharddrive init
By default bup uses the ~/.bup directory for everthing. Using the -d flag tells bup to run whatever command (in the above instance: init) in a chosen hard drive. If you're happy to backup to your ~ then ignore all instances of -d pathtochosenharddrive in the following. (Note you can also change $BUP_DIR to take care of this, and you'll also need to know the path to your given hard drive). This initialises a git repository (you only need to do this once really). I put the following in a script (backup.sh): bup -d pathtochosenharddrive index -ux /directorytobackup bup -d pathtochosenharddrive save -n backupname /directorytobackup The first line indexes the files (the -ux flags are something to do with recursively going through the files: type man bup index to read more). The second line checks the index and then saves all files as required (giving them a name). To setup this backup script to run every hour I write the following to a txt file (crontab.txt): 0 */1 * * * globalpathtobackupscript/backup.sh
To add this to the cron jobs:
$ crontab crontab.txt If you type: $ crontab -l You should see the the contents of the crontab.txt file now added to the scheduled jobs. The first 0 implies that it'll run at the 0th minute, the */1 means every one hour (so you can easily change this), the other * mean 'every', day, month and day of the week. The first time you run this it should take a fair while (especially if you're backing up your whole ~) but afterwards it shouldn't take too long at all. To check what bup has done, run: $ bup -d pathtochosenharddrive ls That should return:
backupname/ and/or any other names of backups. If you want to see the actual backup snapshots:
$ bup -d pathtochosenharddrive ls backupname which will return a list of timestamped snapshots. This has been working pretty seamlessly for a week for me now and I'm probably going to set it up on my work Mac instead of timemachine.
A PhD students recently had a hard time placing floats (figures and table environments) where they wanted in their LaTeX document. I also have just finished teaching LaTeX to all our first years here at +Cardiff University so I thought I'd brush up on my own understanding of these things to make sure that I was explaining things correctly.
I stumbled on the following stackoverflow TeX.Stackexchange (thanks to +Torbjørn Taskjelle for pointing out this and other mistakes) answer: http://goo.gl/A9iJnP
Here's a +writeLaTeX document working through some examples showing the various options that allow you to control floats within the default restrictions: https://www.writelatex.com/read/qkjpvqptqrwd (at the moment that's a read only link but I've suggested it as a template to the writeLaTeX team in case it's useful to anyone). EDIT: Here's the link to the template: http://goo.gl/UmLFr3
I think that reading through the code (which explains how I understand these things to work) could prove helpful when trying to explain how the various options work. Once that's done I'd suggest playing with the following options on the rabbit figure:
Last week I read this blog post by +Patrick Honner. In the post +Patrick Honner plots a graph of a function with a removable discontinuity on Desmos and when zooming in enough he got some errors.
I was waiting around to start this (ridiculously fun) Hangout on Air with a bunch of mathematicians hosted by +Amy Robinson of +Science on Google+:
While waiting I rushed to write this blog post claiming that if you did the same thing with +Sage Mathematical Software System you did not get any errors. It was quickly pointed out to me on twitter and in the comments that I just had not zoomed in enough.
I edited the blog post to first of all change the title (it was originally 'When Sage doesn't fail' but now reads 'When Sage also fails') and also to include some code that shows that the exact same error appears.
On G+, +Robert Jacobson (who's the owner of the Mathematics community which you should check out if you haven't already) pointed out that you could surely use Sage's exact number fields to avoid this error.
He put together some code and shared it with me on +The Sagemath Cloud that does exactly this. Here's a slight tweak of the code Robert wrote (hopefully you haven't changed your mind and still don't mind if I blog this Robert!):
f(x) = (x + 2) / (x ^ 2 + 3 * x + 2) # Define the function
discontinuity = -1 # The above function has two discontinuities, this one I don't want to plot
hole = -2 # The hole described by Patrick Honner
def make_list_for_plot(f, use_floats=False, zoom_level=10^7, points=1001):
count = 0 # Adding this to count how many tries fail
z = zoom_level
xmin = hole - 10/z # Setting lower bound for plot
xmax = min(hole + 10/z, discontinuity - 1/10) # Setting upper bound for plot only up until the second (messy) discontinuity
x_vals = srange(start=xmin, end=xmax, step=(xmax-xmin)/(points-1), universe=QQ, check=True, include_endpoint=True)
# If we are using floating point arithmetic, cast all QQ numbers to floating point numbers using the n() function.
if use_floats:
x_vals = map(n, x_vals)
lst = []
for x in x_vals:
if x != hole and x != discontinuity: # Robert originally had a try/except statement here to pick up ANY discontinuities. This is not as good but I thought was a bit fairer...
y = f(x)
lst.append((x, y))
return lst
The code above makes sure we stay away from the discontinuity but also allows us to swap over to floating point arithmetic to see the effect. The following plots the functions using exact arithmetic:
exact_arithmetic = make_list_for_plot(f)
p = list_plot(exact_arithmetic, plotjoined=True) # Plot f
p += point([hole, -1], color='red', size=30) # Add a point
show(p)
We see the plot here (with no errors):
To call the plots with floating point arithmetic:
float_arithmetic = make_list_for_plot(f, use_floats=True)
p = list_plot(float_arithmetic, plotjoined=True) # Plot f
p += point([hole, -1], color='red', size=30) # Add a point
show(p)
We see that we now get the numerical error:
Just to confirm here is the same two plots with an even higher zoom:
To change the zoom, try out the code in the sage cell linked here: simply change the zoom_level which was set to $10^12$ for the last two plots.
(Going any higher than $10^14$ seems to bring in another error that does not get picked up by my if statement in my function definition: Robert originally had a tryexcept method but I thought that in a way this was a 'fairer' way of doing things. Ultimately though it's very possible and easy to get an error-less plot.)