Comp 116 Fall 2016

Introduction to Scientific Programming

Scientists use computers to analyze, collect, and visualize data. In our class you'll learn to do all three using free tools that are widely used in the sciences.

We will use Poll Everywhere for responses in class.

Today's notebook

Getting Started

  1. Sign up for Poll Everywhere. We will use it for interaction in class.

  2. Join our class on Piazza. We will use it for questions and help outside of class.

  3. Install the free Anaconda Python software package we will use for participation in class, homework, and exams. You'll need a laptop running a recent version of Windows, OS X, or Linux. Installation is simple. Download the installer, double click the resulting file, and follow the on-screen instructions. You can find the installers for the versions we have tested here:

Warning Install these versions above rather than what you may find as the latest on the Anaconda website. They will likely update the packages and some of our custom software may have problems with things that have changed.

After you get Anaconda installed, start it up and a new tab should open in your web browser. This is the Dashboard. It is likely display some files and folders from your home folder. One of the best things you can do to practice safe computing this semester is create yourself a working folder for our class somewhere that gets automatically backed up. Then you won't lose your work if your computer dies. I suggest a free Dropbox account but One Drive or any other such service will be fine. I suggest you use whatever means you normally use to create a Comp116 folder inside your backed up folder. Then browse there by clicking on the links in the Dashboard.

Once you get where you want to work, open a new notebook by clicking the New button in the upper right and choosing Python 3 from the dropdown list. A new tab should appear. Now copy and paste the bootstrap code below into an empty cell and run it by the Shift key while pressing the Enter key. The empty square brackets should change to [1].

import urllib.request, zipfile, io
fp = urllib.request.urlopen("")
zf = zipfile.ZipFile(io.BytesIO(
print('Now go back to the Dashboard tab to see your new files')

If it is successful you should have a new file named Fetcher.ipynb in your Dashboard. Click on it to open the notebook. Now run it's first cell. We will use this notebook nearly every day to fetch class notes, assignments, and exams.

If you have problems ask questions on Piazza.


We are here to help you succeed! Here are some resources that are available to you.


The best way to get answers fast is to look on Piazza and if you don't find the answer, ask your question there. The learning assistants and I will be monitoring Piazza for questions and will answer as quickly as possible. You and your classmates can also answer questions. I will consider Good Answers and Good Questions when deciding on grades.

Learning Assistants

Normally in SN006 unless a different location is shown on the calendar below.

  • Qidi Chen.
  • Elijah DeLee
  • Megan Dupriest
  • Joey Glasser
  • Bryan Iddings
  • Emily Newman
  • Ria Pan
  • Kerry Scott
  • Liang Zhao

Office hours

Gary Bishop (SN255)

Monday/Thursday 9-11 and by appointment.

Click the button below to display the office hours for our learning assistants.

Outside office hours

You can arrange to meet with me outside of office hours by sending email. I keep my calendar online linked off my home page. Check it and pick an open looking time between 9AM and 4:30PM week days. Propose that time to me via email and I'll confirm if I can meet you then.

Study Groups

You are encouraged to help one another and study groups are a great way to meet friends and to learn; I commend them to you highly. Find some folks in the class who would like to work together and do it. You are, of course, responsible for your own work.

Free Resources

Because Python is insanely popular there are tons of FREE resources on the web to help you learn it. In fact, you don't even need my help! But, I'm going to be teaching the class anyway, so you might as well come along for the ride.

Simply Google Python tutorial, getting started with Python, and numpy tutorial to find many useful resources.


Bulletin description

COMP 116 Introduction to Scientific Programming (3). Prerequisite, MATH 231. An introduction to programming for computationally oriented scientists. Fundamental programming skills, using MATLAB or Python. Problem analysis, algorithm design, plotting and visualizing data, with examples drawn from simple numerical and discrete problems. Students can receive credit for only one of COMP 110, 116, or 121.

General Course Info

Term: Fall 2016
Department: COMP
Course Number: 116
Section Number: 001
Time: MWF 2:30-3:20
Location: Genome Sciences G200

Instructor Info

Name: Gary Bishop
Office: Sitterson Hall 255
Phone: 919-590-6186
Office hours: See the help section.

Teaching Assistants

See the help section.

Textbook and Resources

No textbook but a world of free information available on the web.

The software will be a free download but will require nearly ½ gigabyte of free disk space on your CCI compatible (Windows, Mac, or Linux) computer.

We will use Piazza for questions and announcements. You will need to sign up and check it regularly.

We will use Poll Everywhere in class. Bring a compatible device to play along. I recommend bringing your computer. The best way to learn is to do. I will give you many opportunities in class to repeat after me and try variations.

Homework and exams will be downloaded and submitted on the class website.

Course Description

In this course you will learn to basics of programming using problems from the sciences as motivation. You will learn to use computers to collect, analyze, and visualize data.

Target Audience

This course is intended to meet the computing needs of students majoring in the sciences and to introduce computer programming to students who have no experience.


MATH 231. We assume familiarity with univariate differential and integral calculus, and the ability to manually solve a system of simultaneous linear equations.

Goals and Key Learning Objectives

To teach problem analysis, algorithm design, and the elements of programming, with emphasis upon mastery of concepts, using a limited number of well-chosen language features and physically motivated driving problems. Although Python is used for instruction, the emphasis is on learning to program rather than learning a specific language.

Course Requirements

About every other week there will be an assignment to write a program and submit it for grading. You will need a CCI compatible (Windows, Mac, or Linux) computer.

Key Dates

Midterm 1: 26 September
Midterm 2: 2 November
Final exam: 9 December at 4pm

Grading Criteria

25% Assignments
25% Midterm 1
25% Midterm 2
25% Final Exam

You may earn up to 3 bonus points by completing all of the optional worksheets.

All exams are cumulative.

Assignments and exams will include code to automatically check your answer and give you instant feedback. If it tells you the answer is wrong, you can be certain that you need to fix something. On the other hand, if it tells you the answer is correct it may still be incorrectly computed. When grading I will use a different dataset that will produce different numerical results. For example, suppose I ask you to write code that adds the numbers in an array. Instead of writing code, you might look at the numbers, add them on your calculator, and enter the sum. The checker in your assignment will tell you that the answer appears correct because it is correct for that particular data. But when I grade the assignment, the array will have different numbers with a different sum. If you simply entered the number you got off your calculator, it will be marked wrong and you'll get zero credit. The point is: you must write code that computes the answer from the given data.

On assignments, no partial credit will be given. With all of the help available you should get 100% on every assignment. Late assignment submissions will be accepted with a penalty of 2% of the maximum score per hour or part of an hour after they are due. The way to avoid this penalty is to start and submit early, then if you get an error back from the grader you can resubmit before the deadline without penalty. Assignments may only be submitted via the class website.

Exams will work just like assignments except you will work on your computer in class to answer the questions. You will get immediate feedback on the apparent correctness of your answer with the same caveats as above. On the midterm exams you will have the chance to earn partial credit by resubmitting the exam with corrections. On the final exam there will be no partial credit.

Points for assignments and exams will first be normalized to 100% and then weighted as described above. The resulting numerical score will be converted to a letter grade using the following ranges.

95  ≤ A  ≤ 100  
90  ≤ A- < 95  
86⅔ ≤ B+ < 90  
83⅓ ≤ B  < 86⅔  
80  ≤ B- < 83⅓  
76⅔ ≤ C+ < 80  
73⅓ ≤ C  < 76⅔  
70  ≤ C- < 73⅓  
65  ≤ D+ < 70  
60  ≤ D  < 65  
      F  < 60

The instructor reserves the right to adjust these ranges down if the grades are skewed too low.

Final exam special considerations

After taking all of the above into consideration, you must score higher than %40 on the final exam to get a grade above D for the course. In other words, if you score less than 40% on the final exam after any curving of the grades you will not receive higher than a D for the course grade regardless of your course average.

On the plus side, since all exams are cumulative, if you show signs of improvement through the semester, your earlier grades may receive lower weight resulting, potentially, in a higher course grade than predicted by the above formulas.

Course Policies and Honor Code

All exams will require you to bring your computer to class. You may use your book, notes, and anything stored on your computer disk (including Python) but no Internet resources besides using the class website to download and submit your exam. During exams your computer must be in airplane mode with wireless access disabled. I will instrument the exam with code to detect violations.

My computer and I will do all grading. The learning assistants sole function is helping you learn. If you have issues with grades bring them to me.

Collaboration on assignments is encouraged. However, what you hand in must be your own work. Good scholarship requires that all collaboration must be acknowledged. Thus, if you collaborate on the solution of a problem set, we expect you to list your collaborators in the space provided at the top of the assignment. Turning in someone else's code as your own is an Honor Code violation. Failing to acknowledge a collaborator is an Honor Code violation.

Collaboration on exams is a violation of the Honor Code. This includes discussion of questions on a quiz, midterm, or final with students who have not yet taken that evaluation. No outside help of any kind is allowed on exams.

Honor code violations will be prosecuted.


The professor reserves to right to make changes to the syllabus, including dates. These changes will be announced as early as possible.