Comp 116 Fall 2018

Introduction to Scientific Programming

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

Today's notebook

Getting Started

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

  2. 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.

Warning Currently, off-campus connections to may require the Onyen VPN.

After you get Anaconda installed, start by entereing the command jupyter notebook (case sensitive) and a new tab should open in your web browser. The first time you run it there may be a long delay while it does some one-time work. This is the Dashboard. It will 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 and enter the jupyter notebook command from that directory. 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. After a few seconds, 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 by holding the Shift key while pressing the Enter key.

You'll get a prompt to login. Use your Onyen and password to login. At this point you are logging in to a university web server.

We will use this Fetcher notebook nearly every day to fetch class notes, assignments, and exams. Most of the time you will not have to enter your login information because it will remember you.

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.

  • Hannah Cao
  • Jennifer Chen
  • Joey Glasser
  • Rachel Gloer
  • Suvrat Jhamb
  • Vincent Li
  • Sagar Shetty
  • Graham Trogdon
  • Bryan Truong
  • Acacia Zhao

Teaching Assistant

  • Tianxiang Gao

Office hours

John Majikes (SN256)

M/W/F 10:00 AM to 11:30 AM
Tuesday 9:00 AM to 10:00 AM
Thursday 10:00 AM to 11:00 AM

Reserve a 15 minute time slot

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.

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, or 116.

General Course Info

Term: Fall 2018
Department: COMP
Course Number: 116
Section Number: 001
Time: MWF 9:05-9:55
Location: Genome Sciences G100

Instructor Info

Name: John Majikes
Office: Sitterson Hall 256
Phone: 919-590-6093
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.

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 gather, 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: Wednesday, 26 September
Midterm 2: Friday, 2 November
Final Exam: Saturday, 8 December 8:00 AM

Grading Criteria

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

You may earn 3 bonus points by completing all of the optional worksheets. These points will be added to your total numerical grade before calculation of letter grades.

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 all corrections completed. On the final exam there will be no partial credit.

There will be no makeup exams. If you miss a midterm exam with a valid excuse, the weight of your final exam in your total grade will be increased to 50%.

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.

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 %40 or higher 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 adjustment 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 one 8" x 11" sheet of paper with 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 have 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.