while Ivana watches “My Love from the Star“… “The” star? Which star?
This list of links is mainly for my future reading. It’s roughly a list of future research directions that I might want to consider.
I’ve added a new page with links to certain (preprints of) articles in the Princeton Companion to Mathematics.
Ivana calls it the “Princeton Companion to Mathematicians”, because I can often be found in its company. I guess I set up this page so that those without access to the book will not be deprived of the companionship it provides 😛
I personally own a copy of this wonderful book, and would encourage anyone interested in math to buy a copy. It’s my first stop whenever I’m exploring a new area of math. The articles are very insightful, and succinctly highlight the key ideas in a field or theorem. The downside is that it’s very heavy! Even though I lugged it in my bags from Cornell to Singapore, I am now very reluctant to carry it around. Which is a pity because this resource is really worth sharing. With this page, I can now refer my friends to certain articles, rather than having them come over to my place, or bringing the book out to meet them.
Click here to get to the links!
Cooking is one of my girlfriend’s favourite hobbies, and shortly after we got together, I was invited to help out in the kitchen. That was 3 years ago, and I could barely cook an egg. Needless to say, I was more a hindrance than a help. 3 years later, I still can’t cook a decent meal on my own, but I’m useful enough in the kitchen that she would rather have me in the kitchen than out of it.
Looking back, here’s what’s changed over the years, in Python:
She invites me over to cook spaghetti bolognese.
import boyfriend as bf
The bolognese sauce needs diced carrots. Should be an easy thing to let me do, so she calls the function:
To her horror, she gets the following error:
AttributeError: 'boyfriend' object has no attribute 'dice'
She takes over the dicing, and I observe, trying hard to remember what she’s doing so I can replicate it next time.
I’ve been observing in the kitchen a few more times since day 2, and now I feel confident that I can dice carrots. Today, we’re baking carrot cake, perfect for a newly trained carrot dicer like me.
However, I’m thrown off by what happens:
and immediately raise a type error:
TypeError: dice() takes at most 1 argument (2 given)
She doesn’t read the error message carefully and thinks I’m tripping up over ‘fine’, so she tries:
which, of course, raises the same error. Realizing her mistake, and seeing that I didn’t raise an attribute error this time, she tries
This works, but the carrot pieces, being for bolognese, are far too big for carrot cake, and she takes over once again, dicing them to the required size.
Many weeks have passed, and the ‘boyfriend’ module has acquired many more functions, such as ‘peel’, ‘slice’, ‘boil’ etc. I have also learned to apply these functions to tomatoes, onions, garlic, cucumber and many more vegetables. Further, my ‘dice’ function now looks like:
def dice(vegetable,size): ...
where size can be one of ‘fine’,’small’, ‘regular’ or ‘large’. She’s always careful to specify which, and so everything goes along swimmingly.
Today, she’s just going to stir-fry some simple dishes at my place. The groceries are already in my fridge and, wanting to give her a pleasant surprise, I look for some simple stir-fry recipes online and head to the kitchen to prepare the raw ingredients before she arrives.
After converting the recipe into machine(i.e. me)-readable code, I proceed to do what it says, washing the vegetables, peeling the onions… so far so good. And then it happens:
This used to work, but now I raise:
TypeError: Required argument 'size' (pos 2) not found
I’ve been so used to being told how finely to dice that carrots that I’ve lost my default value for ‘size’! Well, nothing to worry about; I’ll just wait till she comes.
Later, after dinner’s over (carrots diced, seasoned, fried, eaten), I pick her brain to find out how she deals with the ambiguity in recipes. My hypothesis is that she has default values for all her arguments, but, peering into the code for her ‘dice’ function, I realize that that barely scratches the surface. I see a whole train of if-elif-else chains specifying a million possibilities for ‘size’ when ‘size == None’, conditioned on the cuisine, the subcuisine (!), the occasion, who’s coming over to dinner and a tonne of other factors I would never have dreamed of considering.
At which point I give up and decide that I’ll just stick to washing the dishes in the future.
Farewell gift for a friend who did math at Cambridge,UK and is now going off Cambridge, MIT, to do his PhD. One of my favourite equations, brought to life by Hubbard’s text. The text for the drawing is mainly from the French Wikipedia article on Stoke’s Theorem. This was done a couple of months ago. I did another one today, this time for a Physics PhD send-off, but like this one, that will have to wait till I’ve given it to him.
Scientific research nowadays almost always requires programming. As a researcher, however, programming is just a tool, not my livelihood, and if I’m going to have to spend time and effort learning how to use this tool, it better be a good one. Some other things I would want from a programming language:
I’m really pleased that Python has been able to do all the above. Python(x,y) works right out of the box, and inlcudes two great IDEs: Spyder and the IPython notebook. Spyder has the same feel as Matlab (editor, console, variable explorer), while the IPython notebook is like the notebook interface of Mathematica. But Matlab and Mathematica cost a lot, whereas Python(x,y) is free!
Another thing that amazes me about Python is the number and quality of packages written for it. By learning just one language, I have access to all the tools I could possibly want. As an example: before learning about Pandas, I tried learning R, which is very powerful for statistical computing. However, I only had to use it once in a while, for one of my many projects, and every time I went back to my code, it took me a while to understand what I had written. With the Pandas library for data analysis, all my projects are now in Python, and I can switch between projects seamlessly without having to do a mental reboot.
Some of the packages I use: Numpy, Scipy, and Matplotlib (all included in Python(x,y)), Sympy, Pandas, scikit-learn (part of a larger family of scientific python libraries), and of course, SAGE (which is not really a library, but I can use it like one). I’m still amazed that I can get all that functionality by only learning one language.
Finally, Python is great for communicating ideas. The IPython notebook, with the ability to type LaTex, is great for explaining and demonstrating snippets of code. But the Python language itself is so readable that some have called it executable pseudocode.
All in all, I’m really happy to have learnt Python. It wasn’t the first language I’ve had to learn, but I sure hope it’s my last.