Rouben Rostamian

MATH 625:  Computational Mathematics
and C Programming

Fall 2022 Course information

Class Time/Place:    TuTh 11:30pm–12:45pm, MP 105
Office: MP 402
Phone: 410–455–2458
Email: rostamian@umbc.edu
Office hours: TuTh 1:30pm–2:30pm

Course content

This is a hands-on computational mathematics course with emphasis on programming in C. The goal is quickly to impart the necessary algorithmic and programming skills to enable the students build moderate- to large-scale application programs and gain a mastery of the C programming language in the context of scientific computing.

A working knowledge of basic C is assumed. If you are really interested in taking this course and have no experience with C, you should try to teach yourself some of it before the semester begins. The summer would be a good time for it. I recommend Kochan's book (see below) or something equivalent for that purpose.

A substantial part of the course deals with moderate to advanced topics in C with special emphasis on common idioms of scientific computing. Through the semester you gradually will build your own computing library and will apply it to solve increasingly complex computational projects.

Prerequisites

Math 221 (linear algebra), Math 251 (multivariable calculus), and a working knowledge of basic C.

Textbooks

The textbook Programming Projects in C is an outgrowth of my having taught this course for many years. You will find it at UMBC Bookstore, SIAM's bookstore, amazon.com, and possibly elsewhere. SIAM gives 30% discount to its members, and I think membership is free to students. The textbook's website provides resources such as supplementary files and other information that you may need to complete specific projects.

The textbook assumes a working knowledge of C; it is not a C primer. I recommend Kochan's, Programming in C (4th edition) for an introduction to C, or brushing up on your C skills, and as a reference. The older 3rd edition is just as good and you may be able to buy it for just a few dollars. But don't get an earlier edition.

Warning: Please stay away from C tutorials on the web. I haven't seen a decent one yet; most of them will teach you the wrong programming ideas and bad habits which you will struggle to correct later. You've been warned!

Grading method

I will collect and grade the programming assignments. Course grade will be based on cumulative performance on these assignments.

Computer requirements

We will be doing some heavy-duty C programming in this course. I will briefly sketch the history of the development of C in the first lecture where we will see that the C programming language and the Unix operating system where born alongside each other in the early 1970s. Although C programming is now possible on just about any operating system, it feels much more natural in the Unix environment than anywhere else. For that reason, we will be doing our programming under Unix throughout this course.

I suppose that your have a computer running one of Linux, Mac, or Windows operating systems.

If you have a computer running Linux (which is a variant of Unix), then you are all set. I use Linux myself. There are dozens of Linux distributions. They are cosmetically different but otherwise pretty much identical under the hood. I use the Ubuntu MATE (pronounced (MAH-te) distribution. Don't worry if your Linux distribution is different.

If you have a Mac, you may already know that its operating system is variant of Unix. You should be able to do essentially everything that I do in Linux. You will need to know how to install a few large software packages when the time comes.

If you have Windows, unfortunately you will find it entirely unsuitable for our purposes. You will need to get access to Linux. Go to Help for Windows Users to see your options.

Programming advice

There is some good advice for writing good code in the Scientific Software Development blog. Its author advocates the (recently developed) Julia programming language, but much of that advice applies to scientific computing in any programming language. Have a look and revisit that page once in a while as you progress through this course.

A half-baked idea: My first impression after looking through Julia's documentation is quite positive. If I were to learn a new programming language today, chances are that I will pick Julia.

Sample projects

Simulated Evolution

[evolution.gif]

Bugs (red dots) evolve into two distinct species in response to environmental factors. A region where food (green dots) is plentiful (near the center) leads to the emergence of a sluggish species that tends to stay in one place. A region where food is scarce (away from the center) leads to the emergence of a species that tends to move about a lot.

The Nelder-Mead minimization algorithm

[nelder-mead.gif] [energy.png]

The Nelder-Mead algorithm is a gradient-free method for minimization of functions of the type f : Rn → R. It works through a moving and deforming adaptive simplex (a triangle in 2D) that “sniffs around” for the location of the minimum.

Large deformations of trusses

The large deformations of a Pratt truss under variable load

[pratt.gif]

The large deformations of a cantilever truss under variable load

[cantilever.gif]

Our truss solver handles statically indeterminate trusses with nonlinear elastic members and large deformations (assuming that no buckling occurs).

A finite element solver

[l-shaped.png] [annulus.png]

Solutions of Poisson's PDE (2 u + f = 0) on: (a) an L-shaped domain with zero Dirichlet boundary data; and (b) on an annular domain with mixed Dirichlet and Neumann boundary data. This finite element solver uses linear elements on an unstructured triangular mesh.

Images filtered through Haar wavelets

A grayscale image sample

[aya_mtsuura-animated.gif]

A color image sample

[vivian000.jpg]
Original image
[vivian000.jpg]
...with 10% of the original information
[vivian000.jpg]
...with 5% of the original information
[vivian000.jpg]
...with 1% of the original information

The original 256×256 image was transformed via Haar wavelets. Then the least significant coefficients were dropped and the image was reconstructed with the remaining coefficients. The relative L2 errors of truncation in the three reconstructed images are 2, 3, and 6 percent. The information from the original image retained are 10%, 5%, and 1%, respectively.

Course calendar and activity log

Calendar
Thu Sep 1  
Tue Sep 6  
Thu Sep 8  
Tue Sep 13  
Thu Sep 15  
Tue Sep 20  
Thu Sep 22  
Tue Sep 27  
Thu Sep 29  
Tue Oct 4  
Thu Oct 6  
Tue Oct 11  
Thu Oct 13  
Tue Oct 18  
Thu Oct 20  
Tue Oct 25  
Thu Oct 27  
Tue Nov 1  
Thu Nov 3  
Tue Nov 8 Tomorrow is the last day to withdraw with a grade of W
Thu Nov 10  
Tue Nov 15  
Thu Nov 17  
Tue Nov 22  
Thu Nov 24 Thanksgiving Day — no class today
Tue Nov 29  
Thu Dec 1  
Tue Dec 6  
Thu Dec 8  
Tue Dec 13  

Notes & Comments

Registrar's info
Registrar's Office Dates and Deadlines

 

Safety rules during the pandemic

UMBC requires you to wear a KN95 mask that covers your nose and mouth in all classrooms regardless of your vaccination status. This is to protect your own health as well to assure others around you that you respect their health and safety concerns.

Anyone attending class without a mask or wearing one improperly will be asked by the instructor to put on a mask or fix their mask in the appropriate position. A student that refuses to comply with this directive will be asked to leave the classroom. The failure to do so will result in the instructor requesting the assistance of the University Police.

UMBC’s on-campus safety protocols, including masking requirements, are subject to change in response to the evolving situation with Covid-19.

UMBC Honors Code

By enrolling in this course, each student assumes the responsibilities of an active participant in UMBC's scholarly community in which everyone's academic work and behavior are held to the highest standards of honesty. Cheating, fabrication, plagiarism, and helping others to commit these acts are all forms of academic dishonesty, and they are wrong. Academic misconduct could result in disciplinary action that may include, but is not limited to, suspension or dismissal.

The PDF document UMBC Policy for Undergraduate Student Academic Conduct spells out the official academic integrity policies for undergraduates.

Student Disability Services (SDS)

Services for students with disabilities are provided for all students qualified under the Americans with Disabilities Act of 1990, the ADAA of 2009, and Section 504 of the Rehabilitation Act who request and are eligible for accommodations. The Office of Student Disability Services is the UMBC department designated to coordinate accommodations that would allow for students to have equal access and inclusion in their courses.