first two pages of theano tutorial in an ipython nb
further work, to the end of the differentiation section