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 S-235S (computer lab in basement)

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

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". for the first few weeks to learn the basic commands. We will then do various topics in cryptography, probability, graph theory, approximation theory (and whatwever we can fit into the course) using materials I put on the website. There is a lot of interesting material in 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 three to do.

(4) Final exam (similar to quizzes, but longer)

During the last week of class I will post tentative grades based on the homework, quizes (best 4 or 5) and two projects. A percent will be compute for each of the three categories and the average of these three numbers taken. The letter grade will be based on this average. You will receive at least this grade for the class. If you are happy with this grade, then you need not hand in a third project or take the final. If you would like to improve the tentative grade then you can hand in a third project and take the final. Then your grade will be based on the average of the percents for homework, quizes (best 4 of 5), projects and the final (each of the four categories counts equally).

Histogram of over totals as of Nov 20, 2017. This includes the 3 homeworks, the best 4 out of 5 quizes, and Project 1. Each category was converted into a percentage (out of 100) and then I took the avergage of these (all weighted equally).

Send the lecturer (C. Bishop) email 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.

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 0n Decemeber 7 (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

Project 5 , -----
Weiesrstrass approximation theorem
, Chapter 5 in "Approximation theory and Approximation practice"
by Lloyd N. Trefethen

Project 6 , -----
Unexpected biases in the distribution of consecutive primes
, 2016 by R.J.K Oliver and K. Soundararajan

See also:
Article in Nature ,
Article in Quantum

Project 7 ,
-----
Volumes of n-balls -- Wikipedia
,

Project 8 , -----
Using letter counts to distinguish different languages

Project 9 , -----
Breaking a re-used one time pad

,
Project 10 , -----
Solving a random permutation substitution

Project 11 , -----
Fractal dimension and the Weierstrass function,
YouTube video explaining idea of fractalsa and dimension

Project 12 ,
-----
Gibbs phenomenon -- Wikipedia
,

The write-up is supposed to be a short report that
explains what the problem is and how you solved it,
including any samples of code or output (such as tables
or plots). Think of it like an essay for an English or
History class except that it is written about a math problem,
instead of about Jane Austin or the French revolution. There
should be an introduction that describes the problem, a
main body that gives the details of your solution and a
conclusion the briefly summarizes your results.

Some good things to do include:

Put titles on your plots

Insert comments into code saying what role
named arrays play and what loops are doing

supress intermediate calculations and
display a single table of results at end

when comparing two or more arrays, present
them as columns of a single table/array

when plotting an approximation to a function,
also plot the function so we can see how close they are. Also
consider plotting (separately) the difference of the two.

** 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

plot

** Tuesday, September 5 Labor day, NO CLASS **

** Thursday, September 7 ** More commands

cumsum

referencing elements, end, find, logical indexing

strings, char, num2str, str2num, strfind

syms, solve, vpasolve, root

anonymous functions

plot versus ezplot

scatter

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,

switch

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 ,

Instructions for downloading Chebfun onto a SINC site machine
and setting the correct path in MATLAB

Homepage for ** CHEBFUN**, download it here

Chebfun guide , Introduction, examples, how Chebfun works
how to use it. Try the examples in Chapter 1 to make sure your
installation of Chebfun is working.

First six chapters
of "Approximation Theory and Approximation Practice" by L.N. Trefethen

** Tuesday, October 3 ** Root finding

Scripts from October 3 class

Questions on Homework 2, fzero, cells, polyval

Root finding: bisection, Newton's method, secant methods, fzero

NCM - Chapter 4 ,

** Thursday, October 5 ** More root finding

Homework 2 (PDF) - Chebyshev polynomials ,

Homework 2 (TEX) ,

Scripts from October 5 class (used in Quiz 3)

** Tuesday, October 10 ** Quiaz 3 (30 minutes)
Secant method, Iteration, Julia set, Mandelbrot set

Practice Quiz 3 (PDF)

Practice Quiz Solutions (PDF)

** Thursday, October 12 ** Intro to Julia sets and
the Mandelbrot set

image, colormap

Scripts from October 12 class

The Mandelbrot set, EIM Chapter 13

Julia sets - Wikipedia

The Mandelbrot set - Wikipedia

Benoit Mandelbrot - Wikipedia

The Mandelbrot set -Wolfram MathWorld

** Tuesday, October 17 ** More about the Mandelbrot set

tic, toc, profiling, vectorization

** Thursday, October 19 ** More about Mandelbrot set

Homework 3 (PDF) - Area of Mandelbrot set ,

pre-allocation

** Tuesday, October 24 ** Review for Quiz 4,
Linear algebra, 60 minute class today

Scripts from October 24 class

** Thursday, October 26 ** Ceasar code, reading files

Scripts from October 25, for Prac Quiz 4

Directory of simple cryptography files This leads to a dirctory of
files that we will use over the next few weeks. You should creat your own directory and copy these into it. Clicking on each file, should open the file in a text editor, which should then allow you to save the file.

ASCII code - Wikipedia

Project Gutenberg , free out-of-print books

Pride and Prejudice , Project Gutenberg

A Tale of Two Cities , Project Gutenberg

** Tuesday, October 31 ** 2-grams, n-grams

Practice Quiz 4 (PDF)

Solutions (PDF)

** Thursday, November 2 **

link to about 60,000 English words

** Tuesday, November 7 ** letter frequencies,

** Thursday, November 9 ** one time pads, intro to RSA

One-time pad - Wikipedia

VENONA project - Wikipedia

Enigma machine - Wikipedia

Ultra - Wikipedia

RSA cryptosystem - Wikipedia

RSA factoring challenge - Wikipedia

** Tuesday, November 14 ** RSA

Revised Project 1 due.

Multiplicative group mod n - Wikipedia

RSA cryptosystem - Wikipedia

RSA factoring challenge - Wikipedia

Scripts for Nov 14 - RSA

Practice Quiz 5 (PDF)

m-file for problems 5 and 6 on practice quiz 5

Solutions (PDF)

** Thursday, November 16 ** random walk on integers

Scripts for Nov 16

Simple random walk - Wikipedia

Central Limit Theorem - Wikipedia

Brownian motion- Wikipedia

Bore-Cantelli lemmas - Wikipedia

** Tuesday, November 18 ** No class

** Thursday, November 23 ** Thanksgiving, no class

** Tuesday, November 28 ** harmonic measure, linear algebra

scripts for Nov 28

NCM- Chapter 11 Partial differential equations

** Thursday, November 30 ** DLA

Second Project Due

scripts for Nov 30

** Tuesday, December 5 **

Scripts for Dec 5

DLA --- Wikipedia

** Thursday, December 7 ** last class, continuation of Dec 5, DLA,
Paths inside Brownian motion

** 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: helpme@stonybrook.edu; Phone: 631.632.9602; Chat; http://www.stonybrook.edu/helpme 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: https://it.stonybrook.edu/students

**
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
http://studentaffairs.stonybrook.edu/dss/.
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
http://www.stonybrook.edu/uaa/academicjudiciary/

** 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.