Professional Documents
Culture Documents
References
1/40
2/40
Introduction
Introduction
Scientific Computing
Survey on lecture
1. Introduction
2. Roundoff errors
3. Nonlinear equations in one variable (2 lectures)
4. Linear algebra review
5. Direct methods for linear system (2)
6. Linear least squares problems (2)
7. Iterative methods for linear system (2)
8. Eigenvalues and singular values (2)
9. Nonlinear systems and optimization (3)
10. (Piecewise) polynomial interpolation (3)
11. Best approximation
3/40
4/40
Introduction
Introduction
Focus
No emphasis on
I
5/40
6/40
Introduction
Introduction
Goals
Literature
Uri Ascher & Chen Greif: A First Course in Numerical
Methods. SIAM, 2011.
http://www.siam.org/books/cs07/
Excellent reference.
7/40
8/40
Introduction
Introduction
Literature (cont.)
Prerequisites
Essential prerequisite for this course is a solid knowledge in linear
algebra and calculus. Familiarity with the topics covered in the
first semester courses is taken for granted, see
rigorous mathematical treatment; Target audience: undergraduate students in science and engineering.
Available through Nebis.
9/40
10/40
Organization
Organization
Organization
Venue
Lecturer:
Prof. Peter Arbenz
arbenz@inf.ethz.ch
Assistants:
Stefan Pauli
Daniel Hupp
Christian Sch
uller
Robert Carnecky
Laura Scarabosio
Jonas Sukys
Cecilia Pagliantini
Alexander Lobbe
Sebastian Grandis
Sharan Jagathrakashakan
stefan.pauli@inf.ethz.ch
huppd@inf.ethz.ch
schuellc@inf.ethz.ch
crobi@inf.ethz.ch
laura.scarabosio@sam.math.ethz.ch
jonas.sukys@sam.math.ethz.ch
cecilia.pagliantini@sam.math.ethz.ch
alobbe@student.ethz.ch
grandiss@student.ethz.ch
sharanj@student.ethz.ch
Classes:
Tutorials:
11/40
12/40
Organization
Organization
Assignments
Examination
13/40
Organization
Examination (cont.)
Topics of examination:
I All topics, that have been addressed in class or in a
homework assignment.
I One exam question will be one of the homework
assignment.
I
I
I
I
14/40
15/40
16/40
x = 0; h = 1/10;
while x<1,
x=x+h;
% do something depending on x
end
NumCSE, Lecture 1, Sept 19, 2013
17/40
1
1
1.5
100
100
0.99
1.01
1.2
99.99
99
Absolute
Error
0.01
0.01
0.3
0.01
1
Relative
Error
0.01
0.01
0.2
0.0001
0.01
18/40
Approximation example
Types of errors
I
2n
n n
19/40
Discretization error.
Convergence error in iterative methods.
Discretization/convergence errors may be assessed by an
analysis of the method used.
Roundoff errors
I
Approximation errors
I
20/40
f 0 (x0 ) Dx0 ,h (f ) =
f (x0 + h) f (x0 )
h
21/40
22/40
Results
x0 < < x0 + h.
h
0.1
0.01
0.001
104
107
Absolute error
4.71667 102
4.666196 103
4.660799 104
4.660256 105
4.619326 108
23/40
24/40
h
108
109
1010
1011
1013
1015
1016
If we wanted
cos(1.2) sin(1.2 + h) sin(1.2) < 1010 .
h
We have to set h 1010 /0.466.
Absolute error
4.36105 1010
5.594726 108
1.669696 107
7.938531 106
6.851746 104
8.173146 102
3.623578 101
25/40
26/40
Algorithm properties
Algorithm properties
Performance features that may be expected from a good numerical
algorithm.
I
Accuracy
Relates to errors. How accurate is the result going to be when
a numerical algorithm is run with some particular input data.
Efficiency
I
I
I
27/40
Robustness
(Numerical) software should run under all circumstances.
Should yield correct results to within an acceptable error or
should fail gracefully if not successful.
28/40
Algorithm properties
Algorithm properties
Complexity I
description
(x Rn , y Rn ) 7 xH y
(x Rm , y Rn ) 7 xyH
#mul/div
n
nm
#add/sub
n1
0
O(n)
O(mn)
(A Rmn , B Rnk ) 7 AB
mnk
mk(n 1)
O(mnk)
w = O(n log n)
means that there is a constant C > 0 such that
|w | Cn log n
29/40
as n .
30/40
Algorithm properties
Algorithm properties
Complexity II
More abstract:
Class O(f ) of functions is defined as
One may argue that the memory accesses are more decisive for run
times than floating point operations. In general there is a linear
dependence among the two. So, there is no difference in the O
notation.
31/40
32/40
Elementary operations
Elementary operations
Scaling
Elementary matrices
Matrices of the form A = I + uvT are called elementary.
Again we can apply A to a vector x in a straightforward and a
more clever way:
Ax = (I + uvT )x
vs. AD
or
Ax = x + u(vT x)
Cf. exercises.
33/40
34/40
Elementary operations
Elementary operations
An unstable algorithm
Qualitatively speaking:
I
35/40
36/40
Elementary operations
Elementary operations
A stable algorithm
Unstable algorithm
Problem statement: evaluate the integrals
Z 1
xn
dx, for n = 0, 1, 2, . . . , 30.
yn =
0 x + 10
Algorithm development: observe that analytically, for n > 0,
Z 1 n
Z 1
x + 10x n1
1
yn + 10yn1 =
dx =
x n1 dx = .
x + 10
n
0
0
Also,
Z
y0 =
0
1
dx = log(11) log(10).
x + 10
Algorithm:
I Evaluate y0 = log(11) log(10).
I For n = 1, 2, . . . , 30, evaluate yn =
37/40
1
n
10yn1 .
38/40
Elementary operations
Elementary operations
39/40
40/40