Final Flashcards
Function? x,y:
n: 1,2,3…
time: e1,e2,e3…
linear-log plot straight line
Complexity, exponential
y = a.b^{x} - O(a.b^{x})
log y = log(a) + x.log(b)
^y = ^a + ^b.x
Function? x,y:
h: e1,e2,e3…
error: e1,e2,e3…
log-log plot straight line
Error, power function y = ax^b - O(ax^b) log y = log(a) b.log(x) ^y = ^a + b.^x Algebraic convergence (n^-a) / growth (n^a)
Pseudo random numbers
o Random pattern o Long period
o Efficiency
o Repeatability
o Portability
Monte Carlo Methods
- Approximation based on repeated randomized sampling
- Nondeterministic problems / complicated or high dimensions)
- Slow convergence of error O(n^{-.5}), but efficiency does not degrade with dimension of pb
Relative error bound
|x-^x|/|x| ≤ 10^{-n+1} if n significant digits
Taylor Series approximation x0 of degree n
^f(x) = sum(i=0:n) f^(i)(x0)/i! (x-x0)^i
Taylor error of degree n
O(h^{n+1}) where h=(x-x0)
Indeed R = f(x)-^f(x) = sum(i=n+1:∞) f^(i)(x0)/i! (x-x0)^i ≤ f^(n+1)(ξ)/(n+1)! h^{n+1}
Normalized floating point numbers representation
x = ± 1.b1b2…bn ⨉ 2^m
m in [L,U]
precision p = n+1
UFL, OFL, ϵm
UFL 2^L
OFL 2^{U+1}(1-2^{-p})
ϵm = distance 1/next = 2^-n
Subnormal floating point numbers representation
m = L, leading digit = 0
Hence smallest = 2^-n.2^L
Roundoff error
erel = |fl(x)-x|/|x| ≤ ϵm abs = |fl(x)-x| ≤ ϵm.|x|
Single/double precision ϵm
Single: ϵm = 2^{-23} ≈ 1e-7
Double: ϵm = 2^{-52} ≈ 1e-16
Loss of significance
Substraction/rounding errors, leads to loss of significant digits.
1.000001000 - 1.000000000 with 10 sig digits gives = 1.000000000 with 4 sig digits Divisions work better!
Vector norm properties
||x|| > 0 iff x ≠ 0
||ax|| = |a| ||x|| for all scalars a
||x+y|| ≤ ||x|| + ||y||
Matrix norm properties
||A|| > 0 iff A ≠ 0 ||aA|| = |a| ||A|| for all scalars a ||A+B|| ≤ ||A|| + ||B|| \+ submultiplicativity: ||Ax|| ≤ ||A|| ||x|| ||AB|| ≤ ||A|| ||B||
||v||_p, ||v||_1, ||v||2, ||v||∞
||v||_p = (|v1|^p + ... + |vn|^p)^{1/p} ||v||_1 = |v1| + ... + |vn| ||v||_2 = √(v1^2 + ... vn^2) ||v||_∞ = max(i) |vi|
||A||, ||A||1, ||A||∞, ||A||_2
||A|| = max(||x||=1) ||Ax|| ||A|| = max(||x||) ||Ax||/||x|| ||A||_1 = max |column sum| ||A||_∞ = max |row sum| ||A||_2 = max σi
Linear system of equations LU solve?
Factorize A = LU O(n^3)
LUx = b (forward sub Ly=b O(n^2))
Ux = y (backward sub O(n^2))
L with ones diagonal
Linear system of equations partial pivoting?
Avoids division by zero: find largest |entry| in the column and swap it with top row. If not possible anyway, singular matrix.
A = PLU
PLUx = b
Solve y: Ly=P^Tb
Solve x: Ux = y
(a11 a12 a21 A22) = ( u11 u12 u11.l21 l21.u12+L22U22) l21 = a21/u11
Solving KU=F when K(100,100), LU factorization ≈ 1 sec and each solve (forward + backward substitution) ≈ 0.01 sec How long find 10 different U when (1000,1000)?
factorisation x=(1000/100)^3 = 1e3 sec
solve y=(1000/100)^2 0.01 = 1 sec
total = 1e3 + 10 ≈ 1e3 sec