CPSC 303, Term 2, 2015, Assignment #1
Due Wednesday, January 21, in class
Posted on Saturday, January 10
Solution will be posted on Friday, January 23 (one delay allowed)
0. Please read carefully the Homework and Grading section of the course webpage, inc
CPSC 303, 2014/2015, Assignment #6 Solution
1. Below, see a program that does the job. Notice that we need to use here 2 2 matrices, and
in the case of the implicit methods (backward Euler and implicit trapezoidal), a matrix needs
to be inverted. The code
CPSC 303, 2014/2015, Assignment #3 Solution
1. (a) Here is the code for this question. In the code we are using Matlabs standard builtin
functions for spline and piecewise Hermite. Bonus marks were given to students who
wrote their own code.
function asgn
CPSC 303, 2014/2015, Assignment #1 Solution
1. (a) We have f (x) = ln(1 + x), f (x) =
1
1+x , f
1
(x) = (1+x)2 , f (x) =
Therefore f (0) = 0, f (0) = 1, f (0) = 1 and f (0) =
ln(1 + x) = x
1
2
1
,. . .
2(1+x)3
and we have:
x2 x3
+
+ .
2
3
(x)
(b) The con
CPSC 303
Midetrm Exam 1
CPSC 303, 2014/2015: SOLUTIONS TO MIDTERM EXAM 1
Question 1.
1 pt
(5 points)
(a) Circle the correct answer; no need to justify.
In modern oating point systems, the relative error in the four basic arithmetic operations
(addition, s
CPSC 303, Term 2, 2014/2015, Practice Questions for Midterm 1
1. Determine whether the following statements are true or false.
(a) Relative errors are often more meaningful than absolute errors, in
particular when the exact result is large.
(b) If a probl
CPSC 303, Term 2, 2014/2015, Solution of Practice Questions for Midterm 1
1. (a) True
(b) False (integral evaluation example in lecture)
(c) False (numerical dierentiation example in lecture)
(d) True (cancellation error)
(e) False (smallest positive numb
The following essay appeared in the November, 1992 issue of SIAM News and the March, 1993 issue of the Bulletin of the Institute for Mathematics and Applications.]
THE DEFINITION OF NUMERICAL ANALYSIS
Lloyd N. Trefethen Dept. of Computer Science Cor
CPSC 303
Term 2, 2014-2015
Instructor: Chen Greif
UBC Computer Science
http:/www.cs.ubc.ca/greif/cs303/
Chapter 1: Numerical Algorithms
Slides for the book
A First Course in Numerical Methods (published by SIAM, 2011)
Uri Ascher and Chen Greif
http:/books
CPSC 303
Term 2, 2014-2015
Instructor: Chen Greif
UBC Computer Science
http:/www.cs.ubc.ca/greif/cs303/
Chapter 2: Roundoff Errors
Slides for the book
A First Course in Numerical Methods (published by SIAM, 2011)
Uri Ascher and Chen Greif
http:/bookstore.
CPSC 303, Term 2, 2014/2015, Solutions of Practice Questions
1. (a) F (cancellation errors and other bad things may happen)
(b) T (Horners method has linear complexity, which means that doubling the degree approximately doubles the work)
(c) T (Newtons ba
CPSC 303, Term 2, 2014/2015, Practice Questions for the Final Exam
Note: Please do not read too much into what is covered by these practice
questions and what is not covered. The purpose of these practice questions
is, as advertised, to practice, and they
CPSC 303, 2014/2015, Bonus Assignment Solution
1. (a) We make use of the trigonometric identities given on p. 385. First, observe that because
of their periodicity
sin(kx)dx = 0
all k integer
cos(kx)dx = 0
all k = 0 integer.
Now, by these trigonometric id
Numerical Approximation and Discretization
CPSC 303, Term 2, Winter 20162017
Copyright 2017 by Jessica Bosch
Notes reused and adapted from Ian M. Mitchell
Numerical Linear Algebra Review
Notation:
Matrix (denoted by capital letters) A Rmn has m rows and
CPSC 303, Term 2, Winter 20162017
2017 by Jessica Bosch
Numerical Approximation and Discretization
Assignment 2 Polynomial Interpolation
Due 1 Feb 2017, beginning of class
Reminder: When submitting your hard copy assignment, you must also include all you
CPSC 303, Term 2, Winter 20162017
2017 by Jessica Bosch
Numerical Approximation and Discretization
Assignment 1 Numerical Algorithms & Errors
Due 25 Jan 2017, beginning of class
Reminder: When submitting your hard copy assignment, you must also include a
CPSC 303, Term 2, Winter 20162017
2017 by Jessica Bosch
Numerical Approximation and Discretization
Assignment 0 Review
Due 18 Jan 2017, beginning of class
Reminders:
1. When submitting your hard copy assignment, you must also include all your code and ou
CPSC 303, Term 2, Winter 20162017
2017 by Jessica Bosch
Numerical Approximation and Discretization
Assignment 0 Review
Due 18 Jan 2017, beginning of class
Reminders:
1. When submitting your hard copy assignment, you must also include all your code and ou
CPSC 303, Term 2, Winter 20162017
2017 by Jessica Bosch
Numerical Approximation and Discretization
Assignment 1 Numerical Algorithms & Errors
Due 25 Jan 2017, beginning of class
Reminder: When submitting your hard copy assignment, you must also include a
UBC CPSC 303, Term 2, Winter 20162017
SAMPLE MIDTERM EXAM
No reproduction or distribution without express written permission.
February 2nd, 2017
Instructor: Jessica Bosch
TIME: 50 minutes
Name:
Signature:
Student number:
Do not open the exam until you ar
CPSC 303, 2014/2015, Assignment #2 Solution
1. (a) The Vandermonde matrix and the
1
1
A=
1
1
right hand side vector are
1 1 1
1
1
0 0 0
; y = .
2
1 1 1
2 4 8
0
We thus solve the
linear system Ac = y using Matlabs backslash, c = A\y, and obtain
1
7/6
CPSC 303, 2014/2015, Assignment #5 Solution
1. (a)
i. Here is a script that generates the plot; see also Figure 1. The computed max-norm
is 0.0943.
t=l i n s p a c e ( 0 , 1 , 1 0 0 ) ;
e=exp ( 1 ) ;
v=(e1)+e (3 e ) ( 2 t 1)+5(7 e 1 9 ) . ( 6 t .2 6 t +1)
CPSC 303
Term 2, 2014-2015
Instructor: Chen Greif
UBC Computer Science
http:/www.cs.ubc.ca/greif/cs303/
Chapter 10: Polynomial Interpolation
Slides for the book
A First Course in Numerical Methods (published by SIAM, 2011)
Uri Ascher and Chen Greif
http:/