MAT 331: Computer-Assisted Mathematical Problem Solving

Fall 2017

Christopher Bishop

Professor, Mathematics
SUNY Stony Brook

Office: 4-112 Mathematics Building
Phone: (516)-632-8274
Dept. Phone: (516)-632-8290
FAX: (516)-632-7631

TuTh 11:30-12:50 Math Tower S235S (computer lab in basement)

Office hours 10-11:20, Tuesday and Thursday.

Final Exam 5:30-8:00pm Wednesday, December 13

This is a course in problem solving using MATLAB. This is commercial software produced by the company Mathworks, and is commonly used throughout academia and industry. We will start by going through most of Tobin Driscoll's short book "Learning MATLAB" is the first few days to learn the basic commands. We will then do read selected sections of Cleve Moler's books "Numerical Computing in MATLAB: revised reprint" and "experiments in MATLAB", as well a few articles and blog entries by Moler from the Mathworks site. Moler is the original creator of MATLAB. Moler's books can be purchased as hard-copies, but there are also a free online versions provided by MathWorks (the company the produces MATLAB); you will need to create a MathWorks Account.

The university has a WRTD writing requirement that can be fulfilled by submitting two of the projects from this class. If you intend to fulfill the requirement this way, you should register for the zero-credit course MAT 459, and let me know you want to use your MAT 331 projects for this requirement. I will post possible projects as the semester proceeds and we will discuss a few in class two.

MATLAB is installed on machines in the SINC sites and is available from any computer via the virtual SINC site Virtual SINC site. .

Scripts and functions should be saved in your MySBFiles directory; other dirctories on the SINC site machines are erased after 48 hours. These MySBFiles can be accessed directly from any machine with an internet connection at MySBFiles .

The university license also allows you to download a copy to your home computer (if you are currently a student or faculty member): Information on downloading a copy of MATLAB This page also has instructions on how to create a MATHWORKS account,which you will need to access MATLAB programs and textbooks, even if you don't download a personal copy of MATLAB.

Numerical Computing in MATLAB: revised reprint by Cleve Moler. Our main textbook. Chapters can be downloaded individually. There is also a collection of MATLAB code to download and that is used in the text.

SIAM site for buying hardcopy of "Numerical Computing in MATLAB: revised reprint by Cleve Moler.

Experiments with MATLAB by Cleve Moler. Another textbook on MATLAB, but assuming less math than "Numerical Computing with MATLAB". We will use some chapters from this, such as the one on the Mandelbrot set.

Cleve's Corner articles related to the text and MATLAB in general.

Getting started in MATLAB Introduction by the makers of MATLAB

Learning MATLAB by Toby Driscoll. A very good, very short and inexpensive introduction to MATLAB, by a real expert.

SIAM site for buying of "Learning MATLAB" by Tobin Driscoll.

The not too short introduction to LaTex

Grades will be based on:
(1) In-class quizzes. I provide practice quizzes to do at home.
(2) Homework. These will usually involving writing a short report stating the problem, describing how to solve it, giving the MATLAB code you used, and table or pictures that illustrate your results.
(3) Projects: just like homework, but a little longer and often involving some outside reading. I will make up several of these and you will choose at least two to do.
(4) Final exam (similar to quizzes, but longer)

Send the lecturer (C. Bishop) email at: bishop - at -

Link to history of mathematics There are a lot of iteresting articles here. If you know of other math related sites I should link to, let me know.

A link to MathSciNet (Online Mathematical Reviews). These gives access to reviews of about 3 million mathematical papers and links to some of the actual articles. You will need a NETID and password to access this.

A link to the Stony Brook virtual SINC site . You will need a NETID and password to access this.

A link to the installer for TexMaker. on the SINC site machines. You can also download for use on the virtual SINC site. This is special editor for TeX files that incorporates several steps into one. You will need a NETID and password to access this.

A link to BlackBoard . You will need a NETID and password to access this.

Class Projects

Projects are longer versions of the homework assigments, but I will give several and you need to choose any three to hand in. If you are enrolled in MAT 459, then two of these can be used to satisfy the university WRDT requirement, as described above.

The first project is due October 31, the second November 30 and the third pn Decemeber 13 (last day of class). You may submit eithe a hardcopy or electronic version (but I would prefer a hardcopy to make sure it is printed just as you intend).

Each listed project has two components for you to look at. The first is a one page description of what I want you to do. This will often include an itemized list of computations I want you to make, based on the reading the second part. The second will usually be a some notes written by myself, or a short recent paper by some mathematician describing a calculation or algorithm. Usually there will be more material here than you need to do the project; I generally only want you to do and describe experiments that test the claims of the paper, and you generally don't have to understand the proofs in the paper to do this.

List of projects (more will be added later):
        Project 1 , ----- Gauss-Jacobi quadrature and Legendre polynomials , notes by C.Bishop
        Project 2 , ----- Points of increase for random walks , by Yuval Peres, Microsoft Research
        Project 3 , ----- Uniformly discrete forests with poor visibility , by Noga Alon, Tel Aviv University
        Project 4 , ----- Is Gauss quadrature better than Clenshaw-Curtis? ,----- by Lloyd N. Trefethen, Oxford University and NYU

Tentative Lecture Schedule

Tuesday, August 29 Introduction, Driscoll Chapters 1 and 2
        Cleve's Corner - The origin of MATLAB ,
        Homework 0 (PDF)
        Homework 0 (TEX)
        Homework 0 with Solution (PDF)
        Homework 0 with Solution (TEX)
        Topics covered: course administration, the class webpage,
        how to access the virtual SINC site,
        how to open MATLAB, open documentation,
        basic arithmetic, digits, vpa
        writing a MATLAB script,
        for loops,
        entering vectors and matrices

Thursday, August 31 Driscoll Chapters 3 and 4

        Topics covered:
        save, load
        basic functions: sin, cos, log, exp, rand, round, floor, ceil
        arrays: size,length, the colon operator, zeros, ones

Tuesday, September 5 Labor day, NO CLASS

Thursday, September 7 More commands
        referencing elements, end, find, logical indexing
        strings, char, num2str, str2num, strfind
        syms, solve, vpasolve, root
        anonymous functions
        plot versus ezplot
        Scripts from Sept 7 class
        NCM - Chapter 1, Read Section 1.7 on floating point numbers and precision

Tuesday, September 12 Quiz, last 30 minutes of class
        Cleve's Corner - Computing pi , I thought you might like to read this, but I will not be testing you on this material.
        Due to a problem with cetain MATLAB commands like "solve", "vpa" and "root" on the virtual SINC site, I will remove these commands from Quiz 1. I have posted a new practice Quiz 1 that reflects these changes.
        NEW Practice Quiz 1 (PDF)
        NEW Practice Quiz 1 (TEX)
        Old Practice Quiz 1 (PDF)
        Old Practice Quiz 1 (TEX)
        Practice Quiz Solutions (PDF)
        Quiz 1 scores
        scripts versus functions
        if, else, elseif,
        for loops, while loops,
        Scripts from Sept 12 class

Thursday, September 14
        profiling, tic, toc, preallocation
        Numerical integration: endpoint rule, midpoint rule, trapezoid rule, Simpson's rule
        Using logarithmic plots to measure convergence
        Scripts from Sept 14 class

Tuesday, September 19 Homework 1 due
        Homework 1 (PDF) - comparing methods of computing e=2.71... ,
        Homework 1 (TEX) ,
        Polynomial interpolation, equally spaced points versus Chebyshev points, Gauss-Jacobi quadrature
        Scripts from Sept 19 class
        Wikipedia - Polynomial interpolation
        Wikipedia - Chebyshev nodes
        Wikipedia - Gauss quadrature ,
        Wikipedia - Legendre polynomials ,

Thursday, September 21 Primes and factoring
        Commands: factor, primes, isprime, if/else,
        Scripts from Sept 21 class

Tuesday, September 26 Quiz 2 (last 30 minutes of class)
        Practice Quiz 2 (PDF)
        Practice Quiz 2 (TEX)
        Practice Quiz Solutions (PDF)
        Topics: Chebyshev polynomials and points,
        Wikipedia - Chebyshev polynomials ,

Thursday, September 28 Guest Lecture: Prof L.N. Trefethen
        The webpage of Professor L.N. Trefethen, FRS . Professor Trefethen is head of the numerical analysis group at Oxford, Global Distinguished Professor at NYU and former president of SIAM. His webpage contains numerous links to papers, essays, lectures and videos related to computational mathematics and MATLAB.
        Wikipedia - Chebfun ,
        'Six myths of polynomial interpolation and quadrature' by Lloyd N. Trefethen ,
        Homepage for CHEBFUN, download it here
        First six chapters of "Approximation Theory and Approximation Practice" by L.N. Trefethen

Tuesday, October 3 Root finding: bisection, Newton, secant methods
        Homework 2 (PDF) - Chebyshev polynomials ,
        Homework 2 (TEX) ,
        NCM - Chapter 4 ,

Thursday, October 5 Optimization

Tuesday, October 10 Random walks on the integers
        profiling, tic, toc, preallocation
        NCM- Chapter 2

Thursday, October 12 Random walks on a grid, simulating Brownian motion,

Tuesday, October 17 Harmonic measure

Thursday, October 19 Conformal maps, SCToolbox

Tuesday, October 24 Graphs

Thursday, October 26 Markov chains

Tuesday, October 31 Mixing times

Thursday, November 2 Language models

Tuesday, November 7 Simple codes

Thursday, November 9 One time pads

Tuesday, November 11 Random numbers
        NCM- Chapter 9

Thursday, November 16 Public key exchange, RSA

Tuesday, November 18 No class

Thursday, November 23 Thanksgiving, no class

Tuesday, November 25 Least squares and QR
        NCM- Chapter 5

Thursday, November 30 Fast Fourier transform
        NCM- Chapter 8
Tuesday, December 5 Signal analysis

Thursday, December 7 last class

Wednesday, December 13 Final exam, 5:30pm-8:00pm

Technology Support: Student Technology Services. TLT provides academic technology support to all students. If you require assistance with Blackboard or other academic technologies, please contact TLT at:; Phone: 631.632.9602; Chat; or visit a SINC Site.
Students who need assistance with their personal devices can contact DoIT's service desk at: 631.632.9800, submit an online request, or visit the Walk In Center on the 5th floor of the Melville Library (West Campus), Room S-5410. For more information, visit:

The University Senate Undergraduate and Graduate Councils have authorized that the following required statements appear in all teaching syllabi (graduate and undergraduate courses) on the Stony Brook Campus.

DISABILITY SUPPORT SERVICES (DSS) STATEMENT: If you have a physical, psychological, medical, or learning disability that may impact your course work, please contact Disability Support Services at (631) 632-6748 or They will determine with you what accommodations are necessary and appropriate. All information and documentation is confidential.

ACADEMIC INTEGRITY STATEMENT: Each student must pursue his or her academic goals honestly and be personally accountable for all submitted work. Representing another person's work as your own is always wrong. Facultyare required to report any suspected instances of academic dishonesty to the Academic Judiciary. Faculty in the Health Sciences Center (School of Health Technology and Management, Nursing, Social Welfare, Dental Medicine) and School of Medicine are required to follow their school-specific procedures. For more comprehensive information on academic integrity, including categories of academic dishonesty, please refer to the academic judiciary website at

CRITICAL INCIDENT MANAGEMENT: Stony Brook University expects students to respect the rights, privileges, and property of other people. Faculty are required to report to the Office of Judicial Affairs any disruptive behavior that interrupts their ability to teach, compromises the safety of the learning environment, or inhibits students' ability to learn. Faculty in the HSC Schools and the School of Medicine are required to follow their school-specific procedures.