How to program functions.
How do the built-in functions sqrt and diff
work?
What is the .^ operator?
Can a function return more than one array ?
Readings: Matlab by Gilat Chapter 6 (except 6.3)
3-2
1. Problem Definition
Write a function named trunc that t
Lecture 1
Introduction to Numerical Methods
T. Gambill
Department of Computer Science
University of Illinois at Urbana-Champaign
January 17, 2012
T. Gambill (UIUC)
CS 357
January 17, 2012
1 / 44
Course Info
http:/www.ews.uiuc.edu/cs357/
Book: Introduction
Lecture 13
Denite Integrals: Newton Cotes
T. Gambill
Department of Computer Science
University of Illinois at Urbana-Champaign
April 14, 2011
T. Gambill (UIUC)
CS 357
April 14, 2011
1 / 68
Theorem
The Fundamental Theorem of Calculus Given a continuous fun
CS 357
Numerical Methods - Homework 11
December 9, 2011
1. [25pt] Let be an eigenvalue of the n n matrix A and x = 0 be an associated eigenvector.
(a) Show that for any integer k 1, k is an eigenvalue of Ak with eigenvector x.
(b) Show that if A1 exists,
CS 357
Numerical Methods - Homework 9
November 16, 2011
1. [30pt] Consider the function f (x) = x and the interpolation points (xi , f (xi ), i = 0, 1, . . . n. Let xi be
evenly spaced over the interval [1, 2], that is, xi = 1 + i h, h = 1/n. For each thr
CS 357
Numerical Methods - Homework 10
December 8, 2011
1. [20pt] Derive the formulas for numerical dierentiation as well as the corresponding truncation errors for the
following cases:
(a) Approximation of f (x) using only the values f (x), f (x + h), f
CS 357
October 16, 2011
Numerical Methods - Homework 6
1. [25pt]
(a) [15pt] Using the sparse matrix data structures CSR, COO, MSR as dened in class, store the following
matrix A using each storage method.
1
2
A = 0
0
0
0
5
0
9
0
0
0
8
0
5
0
0
3
0
3
3
6
4
CS 357
Numerical Methods - Homework 8
November 3, 2011
1. [10pt] Given the equation f (x) = 0 where f is continuous on an interval [a, b] such that the bisection method
is guaranteed to converge to a root of f , determine a formula that relates the number
CS 357
Numerical Methods - Homework 7
October 26, 2011
1. [25pt]
(a) [15pt] Show that the iterative method
xk+1 =
xk1 f (xk ) xk f (xk1 )
f (xk ) f (xk1 )
is mathematically equivalent to the secant method for solving a scalar nonlinear equation f (x) = 0.
CS 357
Numerical Methods - Homework 5
October 3, 2011
1. [30pt] Let Pij be an elementary row permutation matrix, and Ak,l (m) be an elementary row addition matrix
(as dened in class). Prove or disprove that B = Pij Ak,l (m) Pij is always a lower triangula
CS 357
Numerical Methods - Homework 4
September 27, 2011
1. [35pt] Consider the following linear system of equations:
0.03x1 + 58.9x2 = 59.2
5.31x1 6.10x2 = 47.0
The actual solution is x1 = 10, x2 = 1. Consider the oating point system F = (10, 3, 9, 9).
(
CS 357
Numerical Methods - Solutions to Homework 2
September 14, 2011
1. [16pt] For the given oating point system
F (; t; L; U ) = F (2; 5; 2; 3).
(a) How many elements are in the system?
(b) What is the machine precision of the system?
(c) This system is
CS 357
Numerical Methods - Solutions to Homework 1
September 13, 2011
1. [20pt] Why does the function f (x) = |x| not possess a Taylor series at x = 0?
Solution:
The function is not dierentiable at x = 0. Therefore, it does not have a representation with
Lecture 4
Rootnding: Newtons Method in higher dimensions, secant method,fractals,
Matlab - fzero
T. Gambill
Department of Computer Science
University of Illinois at Urbana-Champaign
?, 2011
T. Gambill (UIUC)
CS 357
?, 2011
1 / 43
Newtons Method in higher
CS 357
Numerical Methods - Homework 10
November 10, 2011
1. [20pt] Derive the formulas for numerical dierentiation as well as the corresponding truncation errors for the
following cases:
(a) Approximation of f (x) using only the values f (x), f (x + h), f