OCN 681: Introduction to the Jupyter Notebook

[DOWNLOAD]

This notebook serves as a basic introduction to working with Jupyter Notebooks. In this introduction, you will see how to:

  • Run Jupyter Notebook on your machine
  • Get this notebook running on your machine
  • Manipulate Cells
  • Format text and mathematical symbols
  • Enter and Execute Code
  • Plot Figures

The Jupyter Notebook is an excellent new way of conducting experiments, performing dynamical analysis, data analysis, and general science lab notebook. It allows you to combine formatting, code, data, and results in one common place that can be used on any other machine. From experience, this will help you in the long-run by keeping all of your work together in a single place. No more searching for how you created a figure that you presented 2 years ago, etc.

Run Jupyter Notebook on your Computer

You should have already downloaded and installed Anaconda to your machine (be sure to download the 64-bit Python 3.5 installer). Once you have completed the install, you should be ready start the Jupyter Notebook server. The Notebook server begins a web server on your machine that—by default—only you can connect to. To start the Jupyter Notebook server depends on the machine you are running:

Macintosh

On the Macintosh, you have two options:

  1. Anaconda installs the “Launcher”. The installation will most likely place a link on your desktop to this application; otherwise, it will be located in your Home directory, within the anaconda directory. Double-click the Launcher, and a list of services will be shown. Click on “Launch” next to “jupyter-notebook”. This will start the server and open your default web browser. The problem with the Launcher method is that the Notebook server will be started in your home directory, requiring you to traverse your file structure to find the notebook you wish to work with.

  2. You can also start the Jupyter Notebook server directly within a specific directory by using the command-line. Go to the “Terminal” application and change to the directory you wish to work in. Type:

    jupyter notebook

This will start the server and launch your default web browser.

Linux

For Linux, start the Jupyter Notebook server directly within a specific directory by using the command-line. Go to your terminal and change to the directory you wish to work in. Type:

jupyter notebook

This will start the server and launch your default web browser.

Windows

The Anaconda installer will place the “Launcher” application in the Start Menu. Double-click the Launcher, and a list of services will be shown. Click on “Launch” next to “jupyter-notebook”. This will start the server and open your default web browser.

Getting THIS Notebook to run

  1. Once you have the Jupyter Notebook server running on your machine, download this notebook to your machine, and place the file somewhere in your file structure that the server started above can see. For instance, if you started your server at your Home directory, you can put this file anywhere in your Home directory.
  2. Now that this file is loaded onto your machine, go the Notebook webpage that was opened when you started the server and navigate through the directories (by clicking the links) until you get to the directory you downloaded this notebook to. If you copied to the same directory that the Notebook server is running in, you may need to refresh its file list (click the little refresh arrow button).
  3. Once, you see the file name you downloaded, click on it, and it will open a new webpage with the Jupyter Notebook running.

For the rest of this exercise, you must switch to that document with its exercises.