MATH36061 - Convex Optimization

Martin Lotz – School of Mathematics – The University of Manchester

Setting up Jupyter

These notes contain contain instructions on how to get started with Jupyter notebooks on either SageMathCloud or using Anaconda Python.

  • A Jupyter notebookis a web-based document that combines Python code, explanatory text, equations, media and links to content.
  • Anaconda Python is a Python distribution. In addition to providing the Python interpreter, it comes with an extensive collection of packages and tools to manage these.

 

Setting up Anaconda Python

If you want to work with Python on your own computer, you should set up Anaconda Python. You can download it here.

download-anaconda

Make sure you download Python 2.7 for your platform (for example, Linux, Windows, or Mac). The installer will guide you through the process. After installation, make sure to run the command conda update anaconda in a terminal. To open a terminal in Windows 10, type cmd into the search field on the bottom left and then click on the Command Prompt.

cmd1

On a Mac, go to Applications -> Utilities -> Terminal. If you use a Linux system, I probably don’t need to tell you how to open a terminal.

To run Jupyter, open a terminal again and type “jupyter notebook”.

cmd2

The Jupyter notebook directory will then open on your preferred web browser.

jupyter-dir

You will see the contents of the directory from which you started the notebook, so make sure that you start it from where you want to work in. We next open a notebook. For this, go to the “New” dropdown menu and select the Python option.

new-notebook

You are now ready to start writing Python code! For an introduction, see the notes here.

Installing CVXPY

In the lecture we will use the Python package CVXPY. If you use Jupyter on SageMathCloud you don’t need to worry, as everything is preinstalled for you. If you just installed anaconda, then you will have to install CVXPY. The instructions, depending on you platform, can be found here.