CS127-Introduction to Scientific Computation

Fall, 2009


General Course Information
Course Content
Required Background
Software
Textbooks
Required Work
Scientific Computing Minor
Grading
Detailed Course Schedule






General Course Information


Instructor:
Howard Straubing
Computer Science Department
21 Campanella Way, Room 571
tel.:617-552-3977
e-mail: straubin@cs.bc.edu
Office Hours: MW 1-3, and by appointment.

The course will meet Tuesdays and Thursdays at 10:30, in Fulton 453.


Course Content

This is a course on the kind of numerical computations that are performed in scientific work.  It is aimed primarily at students in the natural sciences and social sciences who will use  a computer in their research, and at students in computer science and mathematics who have had little exposure to numerical methods in their studies.  While most researchers will rely on existing software packages to perform this work, the situation often arises where a new program has to be written.  Moreover, all numerical computations are subject to errors resulting from  the rounding off of intermediate results and the use of methods that yield only approximate answers.  It is thus important to understand how standard numerical methods are implemented, as well as the potential sources of errors in their use.

Most of the course will be devoted to a survey of widely-used numerical methods, their applications, accuracy, efficiency and implementation.  The precise topics vary from year to year, and depend to some extent on the group of students present.  In 2008 these included



As the emphasis is on applications rather than on theory, you probably won't see many formal proofs in this course.  On the other hand,  intelligent use of these methods requires a good feel for how and why they work (and sometimes don't work) so I will push for a precise understanding of notions like roundoff error and rate of convergence, and will not ignore theoretical issues entirely. Since the students in the course come from a variety of backgrounds, I will draw the applications from a wide assortment scientific and engineering disciplines.

This is also an introductory course in computer programming.  While we will work in a very specialized programming environment , the traditional programming issues of understanding control structures and data structures, subroutine linkage, and scope of variables still arise, and we will attend to these as well.



Required Background

No prior programming experience is required.  You should have had at least a year of calculus.  Some of the mathematical methods we study are focused on linear algebra, which you may not have studied.  I will try to make this unit of material self-contained, so that  you will not need to have taken a linear algebra course.


Software


We will use MATLAB as our programming language.  MATLAB provides an integrated scientific computing environment:  It is highly interactive, it facilitates production of very nice 2- and 3-dimensional plots, one can do quite a lot without any programming at all, and the programming details that one must learn at the outset are very few, so we can dive into interesting content very quickly.


A disadvantage is that the specialized audience for this product makes MATLAB somewhat quirky as a programming language:  This is not the course in which to learn a general-purpose programming language with the intention of designing a variety of non-numeric software applications. Some practitioners with high performance requirements complain that MATLAB is slow,  this will not be an issue in our course.

Boston College's license for this ordinarily expensive software now allows students to download MATLAB onto their personal computers at no charge.  



Textbooks

I am appalled at the high price of textbooks, and this has complicated my search for a book that serves both for teaching the
subject matter of Scientific Computing as well as the MATLAB language while not busting the budget.  I finally settled on Numerical Computing with MATLAB, by Cleve B. Moler, who, as it turns out, is the inventor of MATLAB.  The book is very reasonably priced.  It will be available at the BC bookstore, but if you want to shop around, check out what they charge for this at Amazon. For the most part, I like the selection of topics, but am likely to skip around in the book and treat certain topics a bit differently from the way the author does.  While the book requires no prior familiarity with the language, it presumes more programming experience on the part of the reader than I would like, and so is not really adequate as either a reference or a tutorial for neophyte programmers.  For that purpose, I have ordered, as an optional text, A Guide to MATLAB, by Brian R. Hunt, Ronald L. Lipsman, and Jonathan M. Rosenberg.



Required Work

There will be a homework assignment approximately every week. More involved assignments may require two weeks to complete, but in such instances I will  break the assignment into week-long tasks.  (This is designed to combat the student tendency to put everything off until the last minute.)  Every assignment will involve work with MATLAB, and most will include a pencil-and-paper component.  I strongly advise you to start every assignment within a few days of receiving it, so that you will be able to find out where the troublesome parts are and ask meaningful questions in class.

Assignments will be posted on this web site.  I will try to post solutions to assignments in a timely fashion.  For this reason (and others) late homework assignments will not be accepted.

There will also be an in-class midterm exam, a couple of quizzes, and a final exam, although I have yet to decide whether this will be during the normally scheduled time slot for final exams, or will instead be a take-home exam.

Academic Integrity

While I encourage you to discuss homework problems both among yourselves and with me, when it comes down to finally sitting down and preparing the completed assignment, you are required to work alone.  Thus it is acceptable to learn from another student the general idea for writing program code to perform a particular task, but unacceptable to  take an extended piece of code written by another person and incorporate it into your submitted assignment as your own work.  Similarly, you may get ideas from additional reading that you do both in books and on the Web, but you may not import large pieces of code wholesale into your own work. If you have any uncertainty about the application of this policy, please check with me.

 In the case of a take-home exam, there is to be no discussion of the exam among the students during the period from the distribution of the exam until they are all collected. 

Failure to comply with these guidelines will be considered a violation of academic integrity. Please make sure that you are familiar with the University policies on academic integrity, which are posted at http://www.bc.edu/offices/stserv/academic/resources/policy.html#integrity.

Flu

Because of growing concern about the H1N1 flu virus, the University community has been asked to do what it can to prevent the spread of disease.  If you are ill, you should not come to class.  I ask you to inform me as promptly as possible when you know that you will miss classes due to illness.  If you need to be absent for a prolonged period, you will still be able to obtain course materials through this website, and we will meet to discuss how to make up missed work when you return to classes.  For the University's guidelines on the symptoms, treatment, and prevention of flu, go to http://www.bc.edu/offices/uhs/education/H1N1_flu.html.

Scientific Computing Minor


CS127 is the first required course in the minor program in Scientific Computing.



Grading

To be eligible for  a passing grade in this course, you must complete at least 60% of the assignments in a satisfactory manner. Your grade will then be computed from your performance on assignments, quizzes and midterm, and final exam.  The assignments will account for about 40% of the grade, the midterm and quizzes for about 25%, and the final exam for about 35%.  (These ratios are subject to minor adjustments, hence all the "abouts".)


Detailed Course Schedule


Date
Handouts
Programs discussed in the lectures
Homework
September 8
Lecture 1: MATLAB Basics, Plotting

Lecture 2: Floating Point Arithmetic
M-file script for drawing a sphere

sphere.m

Assignment 0: Due immediately

Assignment 1: Due Thursday, September 17.

Assignment 1 Solutions.
September 15
Lecture 3: Branching and Looping
The MATLAB for statement:

harmonic1.m
randomwalk1.m

Nested for statements:

pascaltriangle.m

The MATLAB if statement and its variants:

randomwalk2.m

The MATLAB while statement:

randomwalk_while.m

Function M-files.:

collatz.m
Assignment 2: Due Thursday, September 24

Solutions:

gamblersruin.m

archi_approx.m

dayofweek.m

find_day_of_week.m
September 24
Lecture 4: Linear Algebra

Assignment 3: Due Tuesday, October 6

Solutions:

matrixtimes.m

plot of times for A\b and U\(L\b)

plot of ratio of times (values for smaller matrices not shown)

myinverse.m

resistor_solve.m
October 1
Polynomial Interpolation:  Almost all the material is in Chapter 3 of Moler, in far more detail than we need.  The demo program posted on this page shows how to invoke the various interpolation methods in MATLAB.
Interpolation demo (interp_demo.m), similar to the text's interpgui.
Assignment 4: Due Tuesday, October 13

Solutions

M-file for Problem 1
October 8
Nonlinear Equations
bisection.m  (a robust implementation of the bisection method)

bisectdeomo.m (an illustration of how to use bisection.m)
Assignment 5, due Tuesday, November 3.

Solutions

M-file for Problem 3
October 12
Review for Midterm
Topics

Last year's midterm (Solutions are blacked out---there's a very simple software trick for removing the blackout, but I wanted you to work the problmes first and not turn to the answers prematurely.)

Another midterm prep problem.
The midterm, with solutions.
October 26


Lecture Notes: Least Squares and Data Fitting

Recursion
matrixtimes2.m  (used to generate data used in Least Squares example)

A function to convert integers to binary, written the iterative (non-recursive) way:

it_convert_to_binary.m

A recursive version:

convert_to_binary.m

A version that avoids certain kinds of nasty input errors:

convert_to_binary2.m

Recursive graphic example:

kochcurve.m

kochsnowflake.m
Assignment 6-Due Tuesday, November 10

Solutions

drawtree.m
November 9
Lecture Notes: Numerical Integration
Demonstration programs:

quadrature.m

Si.m (integrand to be used with the quadrature demo).

montecarlo.m
Assignment 7:  Due November 17.
November 16
Lecture Notes: Ordinary Differential Equations
pendulum_pp.m (phase portraits for pendulum)

pendulum_animated.m (animation pendulum)
Assignment 8. Due December 3