## Sunday, 20 November 2011

### Installing Sage

My girlfriend and I have recently bought a new computer which has resulted in our old mac moving up to my home office.

A student of mine has supposedly had a few problems installing sage on his mac so this blog post is going to be a full and detailed description of me attempting to install it myself from scratch including all the mistakes I make along the way.

For those of you who are unfamiliar with sage it is an open source math package built on python. I've discovered it over the past 6 months or so and can't speak highly enough of it. It's a brilliant open-source alternative to Maple, Mathematica, Matlab etc...

For info I have a modest understanding of computing. I run ubuntu on my box at work (and have installed sage without a problem there) but in no way consider myself a computer expert... So hopefully this post will be an "idiot's walkthrough" of the installation process (or failure there of).

10:13 am

Here's a screen shot of my computer's system:

10:15 am

First things first I navigate to www.sagemath.org:

and choose intel (as my mac is old but not very old):

10:21 am

Now for my first choice. This is perhaps where I show my ignorance a bit. Based on my comfort with the command line I don't think I need to download the *app.dmg package but as I'm hoping to send my student towards this blog post I'll try it anyway. The problem I do have though is that I'm not sure which package to download.  I found this page to help me figure out what bit system I'm running (32 or 64):

Following the instructions gives this result:

Based on the instructions (the last part of the output reads "i386" as opposed to "x86_64") I'm running a 32 bit system (as I thought given that this is an old mac). There are still a few choices that remain however, including what version of the OS I should be pointing at:

Focusing on the 32 bit installs there's still some confusion over the 10.x. I supposedly have a 10.6.8 version of Mac OS X but the only 10.6 install is a 64 bit. I'm deciding to try the 10.5 32 bit install:

10:31 am

In the mean time I'm going to run my dmg for inkscape (another great piece of open source software).

10:46 am

The download is complete (I expect it took longer than usual as we're running a huge back up of our new computer so that's taking up a bit of the router's effort...).

I'm now double clicking on the dmg file:

(I'm realising that I've perhaps chosen the wrong install package as this is sage 4.7 and not the newer release 4.7.2 but let's see what happens)

10:53 am

This just popped up:

I'm clicking on the README file to see what's next. It seams pretty straightforward:

[Update: my first mistake this is actually the readme file for the .dmg install if you're using the *.app.dmg install then you should scroll down the readme file where there are instructions for that. This is all clear in the readme, I just didn't read the whole thing. Note that the install still works if you follow what I did as the instructions from the readme are basically the same.]

10:55 am

I'm dragging the sage icon in to the applications folder now:

11:00 am

(sorry for the irrelevant picture but I'm bored)
11:01 am

The copy is done and so now according to the above instructions I'm double clicking on the sage icon. This (which is standard) pops up:

I click on "Open".

11:05 am:

After a bit of a wait (this is an old box), all sorts of things happen:

• Firstly a neat little sage icon popped up:

• Then the sage icon turned up in my dock:
•  Finally a browser window appeared:
The above is basically telling me to wait, which I do and then a terminal window opens with the first run of sage:

This is now pretty familiar as it's exactly what happens everytime I've installed sage on a linux box. I type in a password and press enter (this password setup only happens the first time):

After retyping my password I press enter and then the next bit of code is basically sage starting a GUI ("notebook") session which looks like this:

It's all working :) :

Bizarrely it seems that I have to launch a notebook GUI no matter what I do and then open up a terminal session but perhaps this is due to me picking the *app.dmg package (I seem to have missed step 3 of the readme file). Note that this comment is irrelevant if all you're interested in is using the GUI. I'm now going to uninstall this and see what installing one of the *.dmg packages does (I won't document that process...).

This all seemed very straightforward to me so I'm not too sure what my student's problem was but hopefully this little write up will help him (and perhaps others).

## Wednesday, 9 November 2011

### The cooperation game underlying social networks

I have recently been a lot more active on social networks. First I joined twitter (@drvinceknight), then I got a G+ invite and subsequently closed my Facebook account down and now I'm writing my first blog post!

The actual point of this post is to discuss the game that we're all playing with these social networks. Namely we're all playing a coordination game.

The most commonly taught coordination game is the battle of the sexes. Consider the following scenario: a couple are going on a date. They have to decide where to go:

- Alice would rather go to the movies.
- Bob would rather go to see a rugby match.

It is assumed that both Alice and Bob would rather attend the same event. This game can be represented with the following bi-matrix:

$$\begin{pmatrix}(2,1)&(0,0)\\ (0,0)&(1,2)\end{pmatrix}$$

We see that if they both choose to go to the rugby match then Alice receives a utility of 1 and bob a utility of 2 etc... It can be shown that there are 3 equilibria to this game:

- Alice and Bob go to the rugby
- Alice and Bob go to a movie
- Alive goes to the rugby with probability $1/3$ and a movie with probability $2/3$, while Bob goes to the rugby with probability $2/3$ and a movie with probability $1/3$.

How does this relate to social networks? Well let's say that Alice and Bob where no longer choosing what to do on their date but where in fact choosing social networks. Bob prefers G+ whilst Alice prefers Facebook. Obviously they both want to be on the same network as there's no point in being on a social network alone (this assume that the only people in our little world are Alice and Bob). Under these assumptions the same previous equilibria apply.

This game can be extended/modified to $n$ players and let us assume that the utility to any player is give by the following function:

$$u_i(s_i)={\sqrt{|\{1\leq j\leq n\;|s_i=s_j\}|}\over n}$$

I.e. the utility to players choosing G+ is the (somewhat) normalised square root of the number of people choosing G+ (and similarly for Facebook). Why choose a concave function? This simply allows us to say that the difference between having 2 and 3 people on the network is a lot bigger (in terms of utility) than the difference between having 2000 and 2001. If we assume that prior to G+ everyone was on Facebook then when G+ appeared the game was already at an equilibria. This implies that our utility function is somewhat lacking (since some people did indeed move over to G+). Thus we modify it to include a term $\beta_i(s)$ meant to represent a personal preference.

$$u_i(s_i)={\sqrt{|\{1\leq j\leq n\;|s_i=s_j\}|} + \beta_i(s_i)\over n}$$

This utility function justifies that some people (like myself) were happy enough to move from the one equilibria (everyone on Facebook) to a potential unstable strategy (G+). Indeed for me the privacy settings (which I am to understand are now available on Facebook), hangout facilities and overall clean user interface was enough to lure me away from Facebook even though there was not a large amount of people on G+ to start. The assumed utility function looks somewhat like this:

Let us consider an example with 5 people. Each with the following preferences:

• Alice - $\beta_A(G+)=2$ and $\beta_A(FB)=4$
• Bob - $\beta_B(G+)=2$ and $\beta_B(FB)=4$
• Charles - $\beta_B(G+)=2$ and $\beta_B(FB)=4$
• Danielle - $\beta_D(G+)=6$ and $\beta_D(FB)=1$
• Erin - $\beta_E(G+)=6$ and $\beta_E(FB)=1$

If everyone choose $FB$ then the utility gained by Alice, Bob and Charles is ${\sqrt{5}+4\over 5}\approx 1.25$ whereas the utility to Danielle and Erin is ${\sqrt{5}+1\over 5}\approx .65$. It's pretty easy to see that Danielle and Erin can both improve their utility by deviating from $FB$. Indeed if first Danielle chooses the strategy $G+$ then Alice, Bob and Charles gain a utility of ${\sqrt{4}+4\over 5}=1.2$, Danielle gains a utility of ${\sqrt{1}+6\over 5}=1.4$ and Erin gains a utility of ${\sqrt{4}+1\over 5}=.6$.

If Erin then deviates as well we see that we arrive at a new equilibrium:
• Alice, Bob, Charles choose $FB$ each gaining a utility of  ${\sqrt{3}+5\over 5}\approx 1.35$
• Danielle, Erin choose $G+$ each gaining a utility of ${\sqrt{2}+6\over5}\approx 1.48$
This is an equilibrium as it is in no player's interest to deviate from their strategy.

A very important assumption that I've made so far is that every individual can only choose to use a particular network. In fact I know that a lot of people have ended up using both. For example I know that my girlfriend uses G+ to blog about her research and uses Facebook to keep in touch with friends and family. A game theoretical interpretation of this is simply that they're playing mixed strategies.

This game and concept is very similar to most of my research but it is in fact fundamentally different. In the games I model, players don't like congestion...

If I had the time I would perhaps actually do some work on this, developing a more realistic game and various algorithms to solve it as well as using evolutionary game theory. I am currently reading and really think every researcher should read:

The book (and above talk) is all about open research and encourages researchers to invite other researchers to start open research projects. On that note and given the subject of this post (social networking) I am very humbly suggesting that if there are any Game Theorists, Applied Graph Theorists etc... who might be interested in working on an open research project on the above subject (collaboration games applied to online social networks) then please leave a comment on this currently empty googledoc.

For now I'm giving commenting rights to the world but if anyone would like to contribute then please let me know and I'll give you editing rights. I don't expect to be able to give too much time to this project as it is currently just a small idea (pretty much summed up in this blog post) and I have various other research projects that I'm not really brave enough just yet to make open research projects but who knows what will happen if there is indeed a little bit of interest...