Lecture1 6 PDF
Lecture1 6 PDF
Martin Berzins
School of Computing
What is Scientific Computing?
Scientific
Computing “The purpose of
(scientific)computing is not
Computer numbers but (meaningful)
Science
insight” Hamming 1960s
Physical
Mathematics Domain
Science
2
What is Data Science?
Data science is a multi-
disciplinary field that uses
scientific methods,
processes, algorithms and
systems to extract knowledge
and insights from structured
and unstructured
data.Wikipedia
• Syllabus
• Grading
– Practicum
– Homeworks / Mid term and Final Exams
• Class website: Canvas
• Canvas used for submissions
• Office hours 4.30-5.30pm on Monday (with
some exceptions)
Essential Course Text
13
Enough About Me …
• Tell me About You
Modeling Approaches
• Predictive Capability / Decision-Making
• Approaches
– Discrete Models
– Continuous Models
– Statistical Models
• Introduction (Chp 1)
• Interpolation / Integration (Chp 5 & 6)
• Root Finding and Optimization (Chp 2 & 8)
• Initial Value Problems (Chp 7)
• Computational Linear Algebra applied to Sci Comp
– Solving Linear Systems (Chp 3)
• Computational Linear Algebra Applied to Data Science
– Decomposition Methods (Chp 4)
– Data Science Techniques (Chp 9)
Chapter 1
• Finite precision arithmetic used by the
computer generates errors that are significant
enough that they may affect the final result.
Unexpected Results Example 2 Summing a Polynomial
Why? Well we may not always know what the factors are
of a polynomial.
18
Method A
(x-1)^6
19
Method B
Expansion
of (x-1)^6
into its polynomial
terms
Rounding Errors
give not one zero
but many close to1
20
The Inexact Nature of Floating Point Arithmetic
% The Kahan example. In exact arithmetic f/e = 0/0:
h = 1./2.;
x = 2./3. - h; 1.0/6.0
y = 3./5. - h; 1.0/10.0
e = (x+x+x) - h; 0= 3.0/6.0 – 1.0/2.0
f = (y+y+y+y+y)-h; 0= 5.0/10.0- 1.0/2.0
qq = f/e;
Matlab Results
>e = -1.11022e-16, f= -1.11022e-16
> qq = 1.00000
21
Floating Point Number System
where
b1 b2 b3 bN −1
m =1 + + 2 + 3 + + N −1
2 2 2 2
and
bk = 0 or 1
Floating Point (continued)
• Properties
– m: This is the mantissa. The bi’s are either zero or
one, and for this reason:
– E: This is the exponent and it is an integer that
satisfies:
– Double-precision:
– IEEE:
Floating Point (continued)
• In Practice:
– Specify two numbers, N and M
– Double-precision: M=53 and N = 11 (i.e. 64 bits)
• Machine “Zero”
• Rule of thumb:
– Single-precision: 1e-7
– Double-precision: 1e-16
Floating Point (continued)
• Realmax
• Realmin
• Rounding
Floating Point Errors
Exact Calculated
𝑥𝑥1 = 3.1415927 × 100 𝑥𝑥1 = 3.1415927 × 100
𝑥𝑥2 = 1.2345678 × 10−4 𝑥𝑥̅2 = 0.0001234 × 100
𝑥𝑥1 + 𝑥𝑥2 = 3.14171615678 × 100 𝑥𝑥1 + 𝑥𝑥̅2 = 3.1417161 × 100
27
FLOPS
• Relative Error
• Iterative error