Home » Python for matlab users

Python for MATLAB users

The information below is for the workshop given in 2014.

Welcome to this workshop on Python programming intended for researchers familiar with MATLAB. The course includes basic as well as advanced topics in Python programming. No previous knowledge in Python is necessary. The course will take place at KTH, Stockholm and is free of charge.

The course includes the following basic topics:

  • Numerical computation with NumPy, SciPy and matplotlib
  • Using the IPython notebook
  • Object oriented programming in Python
  • Testing numerical code with unit tests

We will also attempt to cover the following more advanced topics:

  • High performance directly in Python with Numba
  • Interfacing C with Cython


The workshop will take place 20–21 November at KTH. We will meet in D4448 on Thursday morning at 09:15.

Thursday 20 November
09:15-11:45, Lecture in D4448
11:45-13:15, Lunch
13:15-16:00, Exercises in Seminar room Faxén, in the mechanics building

Lecture 1

Exercise 1

Friday 21 November
09:15-11:45, Lecture in seminar room 3424, in the math building
11:45-13:15, Lunch
13:15-16:00, Exercises in seminar room 3424, in the math building

Lecture 2

Exercise 2


Please contact the lecturer Olivier Verdier for further information.

Installation Instructions

Before attending the course, you should install Python for scientific computing, in order to be able to do the exercises. Please install Python from the anaconda distribution.

You can then check that the installation works properly by following these steps:

  1. Fire up a terminal, and issue the following command:
    ~/anaconda/bin/ipython notebook --pylab=inline
  2. You should now be in an IPython session in your favorite web browser. Press the “New Notebook” button.
  3. You should now be inside a notebook. Choose the first cell, and paste the following code:
    for i in range(5): plot(cumsum(randint(2, size=1000) - .5), alpha=.7)

    Now press Shift+return.
    You should see a graph appearing in the cell, just below the Python code you just entered.

    If this doesn’t work: write the following in the beginning of the notebook, run that cell with Shift-Enter, and repeat the test above.

    %matplotlib inline

    Please contact me if any of those steps do not work as expected.


The workshop is free of charge, but please register with the form below, and please notify us in the case you are not able to come. The number of participants is limited, but there is still space for further participants.