Mathematical Models, Fall 2018
Installing Software
This page is for a past course. Find your current course here.
 

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 Microsoft account. (Create one if you do not have one.)
  • Click on "View All Libraries".
  • Click on "+ New Library".
  • In the pop-up window, go to the tab "From GitHub".
  • For the "GitHub Repository" type in "AllenDowney/ModSimPy", then for both the Library Name and Library ID you can use "ModSimPy". Then click the Import button to create a copy of the course content in your account.
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 "code" 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 "chap01XXXX.ipynb", where XXXX is your name.
  • In this 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!
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.
    • Go to http://modsimpy.com/zip. Unzip the files and save them in a directory where you will be able to find them easily.
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 "code"
  • 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.
GitHub
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.