CSCI 121 : Scientific Computing

General Information

Description: H:\public_html\csci121w2012\kaplan.jpg

Professor: Simon D. Levy
Lecture: M/W/F 10:10 - 11:05 Parmly 307
Simon D. Levy
Lab 1: Tues 9:05 - 12:10 Parmly 405
Lab 2: Thurs 9:05 - 12:10 Parmly 405
Office: Parmly 407B
Office Phone: 458-8419
  Office Hours: M/W/F 11:15-12:10 / 2:30-3:25 and by appointment

Textbook: Daniel Kaplan, Introduction to Scientific Computation and Programming, 2009 (ignore the remark about calculus, which you don't need for this course). The original printing of this book is more expensive and harder to find, so the campus bookstore may only have a few copies of it.


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 Matlab programming language/environment, which is currently the most popular platform for this kind of work in the natural sciences (biology, psychology, neuroscience, geology) and in engineering. Ability to program in a language like Matlab is a skill that will put you in demand in both industry and graduate school in these fields.

Attendance and Preparation

It is very important that you attend class. There will be considerable information given in class that is not available elsewhere. I will not take "official" attendance, but I will not help students who miss class for no good reason. The textbook is well-written and easy to follow, so I encourage you to keep up with the chapters as we cover them in class.


The fast pace of the course means that no late work can be accepted. As a way of helping with unanticipated emergencies and bad days, I will drop your lowest lab or assignment grade.

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 little or no credit for effort: your programs have to work!

Unless stated otherwise, all labl work will be done without assistance from other students. Although scientific research is mostly collaborative, working with a lab partner in an introductory course like this makes it difficult to assess how well you are understanding the material.

Final Project

The last two lab periods of the course will be devoted to individual final programming projects of your own choosing. 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. If you decide not to do your own final project, there will be a default project you can do instead.

Schedule, Including Due Dates and On-line Class Notes

Lab assignments are to be done in lab during lab hours. Problem sets (homework) should be submitted by email as PDF attachments, before midnight of the due date.


Tuesday Lab



09 Jan
Week 1

Course Outline Intro to Matlab Chapter 1: What is Computation? Chapter 2: Invoking a Computation

16 Jan
Week 2

Chapter 3: Simple Types

Due: Exercises (be careful not to do the Discussion problems!) 1.2, 1.3, 1.5, 1.6, 2.1-2.4

Discussion 3.9
Exercises 3.1-3.6, 3.8, 3.9, 3.11, 3.12

23 Jan
Week 3

Chapter 4: Collections and Indexing

Discussion 4.2, 4.3
Exercises 4.1, 4.2, 4.3, 4.5, 4.6, 4.7.1, 4.8
Hintsall   D4.2   E4.3   E4.6.2   E4.8  

Due: Discussion 3.1, 3.3, 3.4, 3.5, 3.8

30 Jan
Week 4

Review Ch. 1-4 Chapter 5: Files and Scripts

Ex. 5.2, 5.3;
Project (pp. 110-111) mobydick.txt

Exam Ch. 1-4
Due: D4.4, D4.5

Chapter 6: Functions

06 Feb
Week 5

Chapter 7: Conditionals General Instructions
E 6.1, E 6.3, 6.4 6.6, 6.7, 6.8, 6.9, 6.10, 6.11, 6.15,
E 6.2
Mock Convention; no class

Due: D6.1, E6.5

13 Feb
Week 6

Continue Chapter 8 E 7.1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12 Chapter 8: Loops

Due: D7.1 and these

27 Feb
Week 7

Continue Chapter 8 E8.1, 2, 4, 5, 6, 8, 9, 10, 11, 12, 15, 17, 18, 19, 20. If you have time, download this and complete 8.7 Continue Chapter 8 Review Chapters 5-8

05 Mar
Week 8

Exam Ch. 5-8

Due: Final Project Proposals

Project 8.13 (pages 188-194, 241-242)

Project 8.12 (pages 184-187)
Finish Chapter 8

Chapter 9: Scope

12 Mar
Week 9

Chapter 9

Do one of these exercises:
  • For math types: Exercise 9.5 (p. 224) on prime numbers. The program you want to modify is smallestfactor.m. You can test this program directly, or via primeFactors.m. For more credit, get help on the tic and toc functions and use them to generate a plot comparing run-times for the prime-factors program with and without the "time-saving" persistence feature. Use the clear command to reset the persistent variables for re-testing.

  • For medical types: Project/Exercise 9.10 (pp. 225-230) on ECG (EKG) First download the EKG data, saving it as ecg.dat. Make the graph look nice for more credit!

ΦΒΚ Convocation:
Class meets 9:50 - 10:35

Chapter 9

Chapter 9

19 Mar
Week 10

Chapter 13: Sounds & Signals General Instructions
E13.1   E13.2   E13.3   E13.6   E13.7
whistle.wav     fh.wav     g_fugue_mono.wav     stairway.wav  
Chapter 13 Chapter 13

26 Mar
Week 11

Bayesian Modeling 1:
Reasoning Under Uncertainty
Final Project Lab, Part I Bayesian Modeling 2:
Bayesian Networks
Bayesian Modeling 3:
The Junction-Tree Algorithm

02 Apr
Week 12

Bayesian Modeling 4:
Bayesian Learning
Final Project Lab, Part II Bayesian Modeling 5:
Dynamics Bayes Nets
Review for Exam #3