CS371/AM242
Introduction to
Computational Mathematics
Winter 2016
Module 01
Starting Tuesday, January 5, 2016
05/01/2016
CS371/AM242 Winter 2016
1
Course Information
Basic Information on course web page
https:/www.student.cs.uwaterloo.ca/~cs371/
Most in

Module 02: Interpolation
Starting Thursday, January 14, 2014
14/01/2016
CS371/AM242 Winter 2016
1
What is interpolation?
According to wikipedia:
In the mathematical field
of numerical analysis,
interpolation is a method
of constructing new data
points wit

Error bound on Lagrange Interpolation
Theorem: Assume that
x0, x1, x2, , xn are distinct values of [a,b]
f is (n+1) times continuously differentiable
over [a,b]
Then, for all x [a,b], () [a,b] such that
() ( )
( )( ) ( )
= +
+1 !
for the Lagrange int

Module 02: Interpolation
Starting Thursday, January 14, 2016
11/02/2016
CS371/AM242 Winter 2016
1
What is interpolation?
According to wikipedia:
In the mathematical field
of numerical analysis,
interpolation is a method
of constructing new data
points wit

Cubic Spline Interpolation
21/01/2016
CS371/AM242 Winter 2016
30
Set the scene spline S(x)
= for , , where
= + +
+
Since j=0:n-1, we have 4n unknowns.
What "knowns" do we have?
21/01/2016
CS371/AM242 Winter 2016
31
Knowns: for k=0:n-1
The functio

Module 03: Fourier Analysis
Working with periodic data and
some cool algorithms
Starting Tuesday, January 26, 2016
26/01/2016
1
Fourier Analysis
The process of approximating periodic
functional data (from observations or a known
function) with a (possibl

Ax = b, where
=
,b= ,x=
If n<m: Underdetermined system
If n>m: Overdetermined system
We will concentrate on square systems with
unique solutions
22/02/2016
Module 03: Linear Systems
25
How to solve Ax=b
Use the inverse matrix: = ()

We have so far assumed
Unique soln to Ax = b, and
Well-conditioned system.
It can be shown (see course notes) that the
conditioning of solving Ax=b depends primarily
on properties of A.
For example, consider (A) (x+ x) = b+b, what
x
x
can we say about

Module 06:
Finding roots
Started Tuesday, March 22, 2016
30/03/2016
CS371/AM242 Winter 2016
1
Given a function f(x), computationally
find x* such that f(x*) = 0.
Possible computational problems:
fl(x*) may not be exact
fl(f(x*) may not be exactly 0
Ad

Discrete Fourier Transform (DFT)
() not usually known exactly
Periodic data, period T, ( ) = ()
Assume N evenly spaced observations at
= (/), = 0: 1
Our "known" values are: , = 0: 1
We will assume = , due to periodic data
02/02/2016
24
Di

Bzier Curves
What if we drop the requirement that the
interpolating curve must travel through all
points, but only required it to go through the
first and last points?
The remaining points will still influence the
shape of the curve, but won't necessari

CS371:
Winter 2016
Last Lecture
Thursday, March 31, 2016
31/03/2016
1
The Big Event
Final Exam
Friday, April 22 @ 9:00-11:30pm in PAC 11,12
See Piazza announcement for more details
Additional information such as exam seating and
additional office hour

Module 04:
Numerical Linear Algebra
Starting
Thursday, February 11, 2016
10/03/2016
Winter 2016 CS371/AM242
1
Google PageRank Algorithm:
An application of
Numerical Linear Algebra
We will look at a very simplified version of this
algorithm
Involves seve

Background: Complex Numbers
= 1
Complex value = +
Complex Conjugate: =
For = + and = + :
+ =
=
= z =
28/01/2016
16
Visually
28/01/2016
17
Background: Alternate representation
Euler's Identity: = cos + sin
For any complex number =

Module 05:
Numerical Integration
Starting Thursday, March 10, 2016
30/03/2016
CS371/AM2142 Winter 2016
1
The Definite Integral
Given a continuous function f(x) and an interval
[a,b], determine:
=
Solution:
Find F such that
=
30/03/2016
=
CS371/

Module 02: Interpolation
Starting Thursday, January 14, 2016
26/01/2016
CS371/AM242 Winter 2016
1
What is interpolation?
According to wikipedia:
In the mathematical field
of numerical analysis,
interpolation is a method
of constructing new data
points wit

Module 04:
Numerical Linear Algebra
Starting
Thursday, February 11, 2016
11/02/2016
Winter 2016 CS371/AM242
1
Google PageRank Algorithm:
An application of
Numerical Linear Algebra
We will look at a very simplified version of this
algorithm
Involves seve

Newton-Cotes Methods for
Approximate f(x) by a polynomial of degree n
Integrate the interpolating polynomial
Evaluate f(x) at n+1 evenly-spaced points
Can we reduce the error further by
considering other choices of points and
approaches?
17/03/2016
CS371/

Composite Rules
Divide the interval into n equal pieces
= ( )/
,
= , = ,
= + = 0:
#
= $
=
!"
=
Each of the formulas can be used in this manner
14/03/2016
CS371/AM2142 Winter 2016
30
Composite Midterm Rule
14/03/2016
CS371/AM2142 Wint

Solving the Least Squares Problem
Another matrix decomposition approach:
Factor = , where
is orthogonal ( =
)
is upper triangular with > 0
Use factorization in Normal Equations
08/03/2016
Module 03: Linear Systems
90
How to find QR?
Assuming A i

Module 03: Fourier Analysis
Working with periodic data and
some cool algorithms
Starting Tuesday, January 26, 2016
11/02/2016
1
Fourier Analysis
The process of approximating periodic
functional data (from observations or a known
function) with a (possibl

Inverse DFT: How to we convert back?
Recall,
M=
=
1
1
1
1
()
=
Show that
04/02/2016
1
()
()()
37
IDFT Continues
= which implies =
,
so
=
04/02/2016
38
Important Note: Matlab's DFT
Uses fast version of the algorithm (FFT) coming soon

Module 05:
Numerical Integration
Starting Thursday, March 10, 2016
10/03/2016
CS371/AM2142 Winter 2016
1
The Definite Integral
Given a continuous function f(x) and an interval
[a,b], determine:
=
Solution:
Find F such that
=
10/03/2016
=
CS371/

What if the system is overdetermined?
(More equations than unknowns)
=
And x =
03/03/2016
b=
where m > n.
Module 03: Linear Systems
77
How many solutions are there?
No solutions
x1 + x2 = 2, x1 x2 = 0, x1 + 2x2 = 5
One solution
x1 + x2 = 2, x1

Consider the double integral:
,
Use simple Simpson's Rule to approximate
over each variable individually
Follow-up:
How many function evaluations are needed
for composite rule, if we want to divide xinterval into n pieces, and y-interval into n

Module 02:
Finding roots
Started Tuesday, March 22, 2016
21/03/2016
CS371/AM242 Winter 2016
1
Given a function f(x), computationally
find x* such that f(x*) = 0.
Possible computational problems:
fl(x*) may not be exact
fl(f(x*) may not be exactly 0
Ad