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.
  • SageMathCloud is a web-based cloud computing and course management platform that allows you, among other things, to create, edit, and run Jupyter notebooks without having to install a Python distribution on your own computer.
  • 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 SageMathCloud

In addition to the text description you can find a video introduction to getting started with SageMathCould.

http://www.youtube.com/watch?v=JKwBP9Omclg

You will have gotten an email invitation to join SageMathCloud (if not, check your spam folder or contact me!). It looks something like this.

smc-invite

Once you follow the link, you should see the entry page to SageMathCloud.

smc-entry

Register with your name and your uni email address. After that, you will see the following.

smc-project

Click on the entry with your email address and math36061. You will land on the main area from where you can get going with Jupyter.

smc-precreate

Next, click on “Create or upload file…” or on the New icon. You will have the choice of creating a directory (folder), opening a unix terminal, or creating various types of documents.

smc-createdoc

Click on the jupyter notebook icon. You can now get started with jupyter. Make sure you read the introduction here!

 

smc-notebook

To change settings or to log out,

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.