Python

In order to run a Python script, on a terminal at the location of your file, type in:

python FileName.py

If you are using the class virtual machine, you can use the Ninja-IDE interface to do this:

  • Start Ninja-IDE by double clicking on its icon on the desktop
  • File -> Open -> Select the file
  • Right click on the tab with files name on:

  • Running a Python script from Ninja IDE

  • Select "Run this File!"
  • A message panel, where the script will print its output must appear below and figure windows will pop up if the script produces any figures:

    Output of a Python script on Ninja IDE

We designed the programming exercises such that you can figure the Python syntax by looking at previous code and tried to explain what each line of code does via comments. If you have no familiarity to Python and/or NumPy/SciPy, we hope that by working the examples of this course, you can get a hands-on introduction to Python.

If you would like to learn more, here are some handy links (we welcome suggestions for any additional links that you found helpful):

Heikki Arponen writes: I think it would be immensely useful for the students to use Sage Math Cloud (cloud.sagemath.org) for this course. SMC is a cloud service for all kinds of mathematical programming and analysis... you can write Python code and use almost all open source symbolic math software. No installation required: just log in and you're ready to go! +Sage Mathematical Software System