CSCI 121: Scientific Computing (W18)

CSCI 121: Scientific Computing

General Information

Professor: Simon D. Levy
Lecture: M/W/F 8:30 – 9:30 Parmly 405
Lab: Tues 8:30 – 11:30 Parmly 405
Office: Parmly 407B
Office Hours: TWF 2:45-5:00 and by appointment

Textbook: D. Kaplan, S.D. Levy, and K. LambertIntroduction to Scientific Computation and Programming in Python. This textbook is available directly from the publisher, with a discounted rate for W&L students.


The goal of this course is to give you the skills and understanding to write simple, powerful programs for use in your scientific research. We use the SciPy tools of the Python programming language/environment, which is probably now the most popular (and certainly the fastest-growing) platform for this kind of work in the natural sciences (biology, psychology, neuroscience, geology). Ability to program in a language like Python is a skill that will put you in demand in both industry and graduate school in these fields.


This term we will be trying a new approach to labs in this course: pair programming. In other words, you will pick a lab partner on the first day, and work with that person on the labs throughout the course. This approach makes labs easier and more enjoyable, but also makes attendance even more crucial, because not just your lab grade, but the lab grade of your partner, depends on your participation. For this reason, I will take attendance at the beginning of every lab. Once the attendance sheet has come back to me, you will not have an opportunity to sign in for the lab that morning, resulting in an immediate loss of 50% for that lab grade.

Although I will not take attendance in lecture; however, with only 24 students in the class, it will soon be obvious to me who is showing up and who isn’t. Although all the lecture notes are online, and the exams are based on the lecture notes, I will also mention things in class that you will want to write down. So, as I’ve suggested above, your grade is going to suffer one way or another if you don’t show up on time for lecture.


  • Two major in-class (or take-home) exams: 15% each, total 30%
  • “Semi-comprehensive” final exam: 20%
  • Lab work, due at end of lab period: 50%

All work should be submitted through Sakai as PDF files (writeups) and Python .py files (program code). You will get no credit for Microsoft Word files, or for PDF files that do not have information in them identifying you and your lab partner as the authors. (A good way to do this is to create a sub-folder with your names and the lab number; for example: smith_and_jones_lab1. For those unfamiliar with sakai, we’ll do this together on the first lab day.) The fast pace of the course means that no late work can be accepted.The only three exceptions to this rule are:

  • Varsity sports commitments, with prior notice
  • Job, med-school, or grad-school interviews, with prior notice
  • Academic conference commitments, with prior notice
  • Serial medical / family / personal emergencies, with a adjustment from the Office of the Dean.

As a way of helping with unanticipated emergencies and bad days, I will drop your lowest lab or assignment grade.Given the size of the class and the amount of work involved, there will be no opportunity for extra credit if you are not happy with your grade as the end of the course approaches. Serious problems (health / family / personal emergencies) should be handled through the Office of the Dean.

The grading scale will be 93-100 A; 90-92 A-; 87-89 B+; 83-86 B; 80-82 B-; 77-79 C+; 73-76 C; 70-72 C-; 67-69 D+; 63-66 D; 60-62 D-; below 60 F.


The most important aspect of the course is the labs, which is where you learn to program. Unlike lab writeups in your other science courses, your submissions in this course will be programs, and the criterion for success is simple and unforgiving: does your program work or not?

Style and documentation (which we will discuss) are important. Like careful grammar and correct spelling they reflect and encourage good design and clear thinking. Ultimately, however, what matters in the real world is not how clever your solution is or how many comments it contains. What matters is getting the job done, without errors. You will get no credit for effort: your programs have to work. The most frustrating thing for both students and me is seeing you spend hours completing a lab, only to submit the wrong file, or something completed in haste, which crashes as soon as I try to run it. Giving you a zero on that program is the only way I can emphasize the importance of mature, repsonsible work habits, which is why that policy is non-negotiable. Further, this is good preparation for the professions like medicine, where such easily-avoided “honest mistakes” kill hundreds of thousands of people per year.

Many labs can be completed within the three-hour lab session, but if you need time to work outside class, that is fine. For each lab, there will be an absolute deadline of 11:59 PM Friday. For the first couple of labs, which involve a few simple exercises, everyone will simply get a yes/no credit (100% or 0%) for turning in the lab.

Final Exam

The final exam for this course will be given during the final exam week. You can take this exam during any of the regularly scheduled exam periods that week. You must supply an exam envelope to the instructor or the department administrative assistant no later than noon on the last day of class. You must specify a provisional day and time on the envelope, which you are free to change on the clipboard provided outside the door of Parmly 407 any time that week. Email or phone requests to reschedule will not be accepted.

The exam will be given in Parmly 405, and you should arrive promptly before the appointed time. If you are more than 15 minutes late, you will have to reschedule your exam. If you are more than 15 minutes late to the last exam period on Friday afternoon, you will receive a grade of 0 on your exam.

Students who have approved academic accommodations must make arrangements to use those accommodations directly with the instructor no later than the last day of class. Students approved for extra time will receive that time at the tail end of the morning exam period or before the beginning of the afternoon exam period (for example, ending at 1:30 PM for a morning exam or beginning at 12:30 PM for an afternoon exam). Students approved for a low-distraction testing location should reserve that space during the last week of classes, following instructions distributed by Dean McCoy (sophomores, juniors or seniors) or Director of Disability Resources Lauren Kozak (first-years).


Washington and Lee University makes reasonable academic accommodations for qualified students with disabilities. All undergraduate accommodations must be approved through the Office of the Dean of the College. Students requesting accommodations for this course should present an official accommodation letter within the first two weeks of the (fall or winter) term and schedule a meeting outside of class time to discuss accommodations. It is the student’s responsibility to present this paperwork in a timely fashion and to follow up about accommodation arrangements. Accommodations for test-taking should be arranged with the professor at least a week before the date of the test or exam.

Optional Final Project

If you are doing research with a mentor and you have a project in mind, you can use the last two lab periods of the course for that. The goal is to write one or more programs to solve an interesting problem in your field of study. Proposals for these projects will be due the previous week, but I encourage you to start thinking early on about a project that interests you. Most students usually elect not to do such a project, in which case there will be two ordinary labs to do instead.

Schedule, Including Due Dates and On-line Class Notes


Monday Tuesday Lab Wednesday Friday
08 Jan
Week 1
Course Outline

Chapter 1: What is Computation?
Article (FYI)

Python Intro Chapter 1: What is Computation? Chapter 2: Invoking a Computation
15 Jan
Week 2
Martin Luther King Day: No Class Discussion 3.7
Exercises 3.1-3.6, 3.8, 3.9, 3.10
Chapter 3: Simple Types Chapter 3: Simple Types
22 Jan
Week 3
Chapter 4: Collections and Indexing Exercises 4.1 through 4.8
Chapter 5: Files and Scripts Chapter 5: Files and Scripts
29 Jan
Week 4
Review Ch. 1-4 Ex. 5.2; 5.3; 5.6 Project (“Time for a Cup of Coffee”)

No PDF this time: upload your three Python scripts to Sakai.

mobydick.txt and

Exam Ch. 1-4 Exam follow-up
05 Feb
Week 5
Chapter 6: Functions E 6.1, 6.3 – 6.12 (skip E6.2)

General Instructions

Continue Chapter 7 Conclude Chapter 7
12 Feb
Week 6
Chapter 8: Loops E7.1 – 7.11. Hint on 7.7

Put all your functions in a script I will test your script using this script. You only need submit the final revision of each function.

Chapter 8: Loops Continue Chapter 8
26 Feb
Week 7
Conclude Chapter 8 E8.1, 3, 4, 5, 7, 13, 17

No lookin’ online for algorithms, please! Put all your functions in a script I will test your script using this script.

Chapter 11: Sounds & Signals Review Chapters 5-8
05 Mar
Week 8
Exam Ch. 5-8

Due: Final Project Proposals (Optional)

Instructions Chapter 11: Sounds & Signals Continue Chapter 11
12 Mar
Week 9
Finish Chapter 11 E11.1, E11.2, E11.3, E11.4, and this

Put your code in a script with the usual comments (your name, etc.) I will use this script to test your script.


Chapter 12: Images Chapter 12: Images
19 Mar
Week 10
Chapter 13: Sensors and Data Acquisition E12.1, E12.2, E12.3, E12.4

Chapter 13: Sensors and Data Acquisition Chapter 13
26 Mar
Week 11
Chapter 13 Sensor Lab Special Topic: Bayesian Modeling

Reading: What to Believe

Bayesian Modeling, continued
02 Apr
Week 12
Bayesian Modeling, concluded Special-topic lab:
Jupyter Notebooks
Monte Carlo Methods / Machine Learning Review for Final