Mathematical Models, Spring 2020
Installing Software

During this class we will be using the computer programming language Python which we will be interfacing with through Jupyter notebooks. Furthermore we will be working through some notebooks created by our book's author, Allen Downey. This page decribes how to get started with this software.

There are two ways to access Jupyter notebooks, depending on whether you want to run it on your personal computer or access it online. Installing it on your own computer gives you additional piece of mind that everything will be the way it is when you set it up and that it will be available even if you are offline, and it is a bit less clunky. Accessing it online is simpler, but we are at the mercy of internet access, website uptime, and the package "pint" needs to be loaded each time we use it. Here is how to access them in both ways.

Accessing Azure Notebooks and importing course content
  • Go to http://notebooks.azure.com and log in with your Queens College Office 365 account.
  • After you are logged in, navigate to https://notebooks.azure.com/qzzq/projects/modsimpy-fa19/tree/notebooks.
  • On the upper-right hand corner click on the "Clone" button
  • In the pop-up window click "Clone" again. In a minute or two you will have a copy of all the files in your account.
  • Then click the Import button to create a copy of the course content in your account. It will take a while! While you are waiting, go to the next step of setting up Google Classroom.
Working with course content in Azure Notebooks.
  • Go to http://notebooks.azure.com and log in with your Microsoft account.
  • Click on your "ModSimPy" library.
  • Go to the directory labeled "notebooks" to see the list of notebooks with course content. Choose the one you want to open.
  • The first time you open a notebook, make a copy of it so you'll always be able to go back! Go to "File..." and click "Make a copy." In the window that pops up, go to "File..." and "Rename", and give it a name, perhaps something like "chap01-XXXX.ipynb", where XXXX is your name.
  • In every new notebook, at the top of the cell of code that imports the "modsim" package, type in this line of code:
    !pip install pint
    This installs an important package that modsim needs. Run this block of code and now you are ready to start!
  • If you are creating a new notebook, always create it in this "notebooks" directory so that jupyter can find the "modsim" package.
Installing Python on your own computer and importing course content.
  • Install Python on your personal computer using the Anaconda Distribution.
    • Download the Anaconda Distribution installer for your operating system.
    • Run the installer that you downloaded, agreeing to the terms and clicking "Continue" as needed.
    • This will install the Anaconda Distribution on your computer and most recent version of Python.
  • Install the Python Package "Pint".
    • There is one package that we need to install on our computers that does not come standard with Anaconda. It is called Pint. The easiest way to install it is from the command line, AFTER you install Anaconda.
    • Open "Terminal" on a Mac or "Command Prompt Window" on a PC. In the window that opens type:
      pip install pint
      And press enter. It will install it on your computer and be accessible each time you want it.
  • Download the course content files. There are two options.
    • Option 1: You can use GitHub (see directions below) to create and maintain an online copy of your files. This option is more intense but is the way people in industry maintain files.
    • Option 2: You can download a static copy of your files to your computer here: http://modsimpy.com/zip. Unzip the files and save them in a directory where you will be able to find them easily. This option is simpler.
Working with course content on your computer.
  • Open the program Anaconda Navigator. Click on "Launch" under "Jupyter Notebook".
  • Navigate to the folder that has your files in it and into the folder "notebooks"
  • Click on the Chapter you want to open.
  • The first time you open a notebook, make a copy of it so you'll always be able to go back! Go to "File..." and click "Make a copy." In the window that pops up, go to "File..." and "Rename", and give it a name, perhaps something like "chap01XXXX.ipynb", where XXXX is your name.
  • Now you can work in the notebook. Don't forget to evaluate the cell that imports the "modsim" package each time you open your notebook. You do not need to use the !pip install pint at the beginning of every notebook.
  • If you are creating a new notebook, always create it in this "notebooks" directory so that jupyter can find the "modsim" package.
EXPERTS ONLY: GitHub
EXPERTS ONLY: You might wish to access the course content by creating your own GitHub repo.
  • Create your own online copy of the files.
    • Sign up for a GitHub for Education account. Click on "Request a discount". At the bottom it says "New to GitHub? Create an account." Follow the steps.
    • Now make sure you are logged in to GitHub and navigate to https://github.com/AllenDowney/ModSimPy.
    • Click on the "Fork" Button on the top right, which will create your own copy of this information on your account. I suggest using the same name "ModSimPy".
  • Suggested: Download a copy of the files to your computer.
    • Next we will bring it on to your own machine. Install the program GitHub Desktop.
    • Log in with your GitHub account. Go to File > "Clone Repository" and enter in the URL for your copy of "ModSimPy". For instance, it will look like: https://github.com/mathmodelstudent/ModSimPy. Choose the name "ModSimPy" for the folder on your computer.
    • The files are now on your computer, in the folder "Documents/GitHub/ModSimPy". We will learn how to use GitHub to backup the work that you do on the GitHub website. You are done with GitHub for now.