Professional Documents
Culture Documents
ST 2018
Tobias Neckel
Scientific Computing in Computer Science
TUM
Repetition of Previous Lecture
• Interpolation concepts
• every continuous function can be interpolated uniquely
• interpolation with Lagrange cardinal polynomials
• interpolation error ⇔ Lebesgue constant
• uniform grid not always a good choice
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 2
Repetition of Previous Lecture
• Interpolation concepts
• every continuous function can be interpolated uniquely
• interpolation with Lagrange cardinal polynomials
• interpolation error ⇔ Lebesgue constant
• uniform grid not always a good choice
• Quadrature concepts
• weighted inner product spaces
• orthogonal polynomials
• examples: Lagrange (uniform weight), Hermite (Gaussian weight)
polynomials
• Gaussian quadrature
• nodes: zeros of the underlying orthogonal polynomial
• weights: integral of the Lagrange cardinal polynomial evaluated at the nodes
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 2
Concept of Building Block:
• Time: ≈ 90 minutes
• Content
• Polynomial Chaos: Basic concept & pseudo-spectral approach
• Example: Damped linear oscillator
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 3
Concept of Building Block:
• Time: ≈ 90 minutes
• Content
Polynomial Chaos: Basic concept & pseudo-spectral approach
•
Example: Damped linear oscillator
•
• Expected Learning Outcomes
• The participants can describe the basic idea of generalized
polynomial chaos (gPC) methods and underlying reasons.
• They are able to list several ways to compute the gPC coefficients
and to describe and relate the pseudo-spectral approach in this
context.
• They can give rough estimates for the dependency of the
approximation orders N and K .
• The participants are able to derive the formulas relating expectation
and variance to the coefficients of the gPC approach.
• They can indicate the relevant changes in the concept if several
instead of one parameters are uncertain, i.e. in the multivariate
context.
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 3
Agenda
Topic
Methods based on polynomial chaos approximation
Content
• polynomial chaos expansion
• orthogonal polynomials
• the pseudo-spectral approach
• example: damped linear oscillator
• extension to multivariate polynomials
• summary
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 4
Forward Propagation of Uncertainty
stochastic
model f (t, ω)
Problem
• assumption: f computationally expensive or available as a black-box
• deterministic independent variable: t (placeholder for t, x, . . .)
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 5
Forward Propagation of Uncertainty
stochastic
model f (t, ω)
Problem
• assumption: f computationally expensive or available as a black-box
• deterministic independent variable: t (placeholder for t, x, . . .)
What we want
• a good approximation of f (or statistical moments of its output Y ) that is
cheap to evaluate
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 5
Forward Propagation of Uncertainty (2)
stochastic
model f (t, ω)
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 6
Polynomial Chaos Methods
∞
X
s(t) = ŝn sin(. . . )
n=0
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 7
Polynomial Chaos Methods
∞
X
s(t) = ŝn sin(. . . )
n=0
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 7
Polynomial Chaos Methods (2)
• φn (ω) orthogonal
• type of polynomials chosen w.r.t. input distribution ρ(ω)
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 8
Polynomial Chaos Methods – Checklist
What we need to do
• specify type of polynomials φn (ω)
• compute coefficients f̂n (t)
• choose maximum order N
• compute statistical properties of f (t, ω) based on this approximation
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 9
Polynomial Chaos Methods – Checklist
What we need to do
• specify type of polynomials φn (ω)
• compute coefficients f̂n (t)
• choose maximum order N
• compute statistical properties of f (t, ω) based on this approximation
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 2018 9
Inner Product of Functions
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201810
Orthogonality
Orthogonal functions
• inner product is zero
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201811
Univariate Orthogonal Polynomials
Orthogonal basis
• degree 0 to N − 1: φ0 , φ1 , . . . , φN−1
• orthogonal w.r.t. weight ρ(ω)
Z
< φi (ω), φj (ω) >ρ = φi (ω) φj (ω) ρ(ω) dω = γi δij
(
1, if i = j,
• Kronecker delta δij =
0, if i 6= j.
• normalization constants γi =< φi (ω), φi (ω) >ρ
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201812
Univariate Orthogonal Polynomials (2)
Orthogonal basis
Z
< φi (ω), φj (ω) >ρ = φi (ω) φj (ω) ρ(ω) dω = γi δij
Orthonormal basis
• Normalization constants are 1
1
φei = √ φi
γi
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201813
Type of Polynomials
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201814
Legendre Polynomials
• orthogonal w.r.t. integral from -1 to 1 with weight function ρ(ω) = 1
2
Z 1
2
φi (ω) φj (ω) ρ(ω) dω = δij
−1 2i + 1
1.0
• φ0 = 1
• φ1 = ω
Legendre polynomials
1 0.5
3ω 2 − 1
• φ2 = 2
1
5ω 3 − 3ω
• φ3 = 2 0.0
1
35ω 4 − 30ω 2 + 3
• φ4 = 8
• ... −0.5
φ0
φ1
φ2
φ3
−1.0 φ4
−1.0 −0.5 0.0 0.5 1.0
x
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201815
Hermite Polynomials
• orthogonal w.r.t. integral from −∞ to ∞
2
• weight function ρ(ω) = √1 exp(− ω2 )
2π
Z ∞
φi (ω) φj (ω) ρ(ω) dx = i! δij
−∞
8
• φ0 = 1
6
• φ1 = ω
Hermite polynomials
4
• φ2 = ω 2 − 1
2
• φ3 = ω 3 − 3ω
0
• φ4 = ω 4 − 6ω 2 + 3 −2
• ... φ0
−4 φ1
φ2
−6 φ3
φ4
−8
−3 −2 −1 0 1 2 3
x
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201816
Three-Term Recursion
Computation of polynomials
• Stieltjes’ three-term recursion relation
φ−1 (ω) ≡ 0
φ0 (ω) ≡ 1
φn+1 (ω) = (An ω + Bn ) φn (ω) − Cn φn−1 (ω) n≥0
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201817
Polynomial Chaos Methods – Checklist
What we need to do
• specify type of polynomials φn (ω) X
• compute coefficients f̂n (t)
• choose maximum order N
• compute statistical properties of f (t, ω) based on this approximation
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201818
Computation of Coefficients
The pseudo-spectral approach
• exploit orthonormality of underlying basis
N−1
X
f̂n (t) φn (ω) = f (t, ω)
n=0
N−1
X
< f̂n (t) φn (ω), φm (ω) >ρ = < f (t, ω), φm (ω) >ρ
n=0
N−1
X
f̂n (t) < φn (ω), φm (ω) >ρ = < f (t, ω), φm (ω) >ρ
| {z }
n=0
δnm
Computation of coefficients
Z
f̂n (t) =< f (t, ω), φn (ω) >ρ = f (t, ω) φn (ω) ρ(ω) dω
Ω
• possible difficulties:
• f (t, ω) computationally expensive
• f (t, ω) available only as a black box
• solution: use quadrature
• Gaussian quadrature optimal in one dimensional settings
K
X −1
f̂n (t) = f (t, xk ) φn (xk ) wk
k =0
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201820
The Pseudo-spectral Approach (2)
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201821
Polynomial Chaos Methods – Checklist
Polynomial chaos expansion and the pseudo-spectral approach
N−1
X
f (t, ω) ≈ f̂n (t) φn (ω)
n=0
K
X −1
f̂n (t) = f (t, xk ) φn (xk ) wk
k =0
What we need to do
• specify type of polynomials φn (ω) X
• compute coefficients f̂n (t) X
• choose maximum order N and number of number of quadrature terms K
• compute statistical properties of f (t, ω) based on this approximation
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201822
Number of Terms and Nodes
Number of quadrature nodes K
• expensive: evaluate f (t, xk )
• K determines computational effort
10 0
10 -1
Number of expansion terms N 10 -2
10 -3
10 -4
• f̂n (t) decay exponentially 10 -5
10 -6
|ci |
• few coefficients sufficient 10 -7
10 -8
• low computational effort once 10 -9
f (t, xk ) known 10 -10
10 -11
• rule of thumb: use N ≈ 1
2K
10 -12 0 1 2 3 4 5 6 7
i
N−1
X
f (t, ω) ≈ f̂n (t) φn (ω)
n=0
K
X −1
f̂n (t) = f (t, xk ) φn (xk ) wk
k =0
What we need to do
• specify type of polynomials φn (ω) X
• compute coefficients f̂n (t) X
• choose maximum order N and number of quadrature terms K X
• compute statistical properties of f (t, ω) based on this approximation
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201824
Expectation and Variance
Expectation
• remember: φ0 (ω) ≡ 1
• E[φ0 (ω) φn (ω)] = < φ0 (ω), φn (ω) >ρ
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201825
Expectation and Variance
Expectation
• remember: φ0 (ω) ≡ 1
• E[φ0 (ω) φn (ω)] = < φ0 (ω), φn (ω) >ρ
"N−1 #
X
E[f (t, ω)] ≈ E f̂n (t) φn (ω)
n=0
N−1
X
= f̂n (t) E[1 · φn (ω)]
n=0
N−1
X
= f̂n (t) E[φ0 (ω) φn (ω)] = f̂0 (t)
| {z }
n=0 =δ0n
Expectation and Variance
Expectation
• remember: φ0 (ω) ≡ 1
• E[φ0 (ω) φn (ω)] = < φ0 (ω), φn (ω) >ρ
"N−1 #
X
E[f (t, ω)] ≈ E f̂n (t) φn (ω)
n=0
N−1
X
= f̂n (t) E[1 · φn (ω)]
n=0
N−1
X
= f̂n (t) E[φ0 (ω) φn (ω)] = f̂0 (t)
| {z }
n=0 =δ0n
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201825
Expectation and Variance
Variance
h i
2
Var [f (t, ω)] = E (f (t, ω) − E[f (t, ω)])
N−1
!2
N−1
!2
X X
≈E f̂n (t) φn (ω) − f̂0 (x) = E f̂n (t) φn (ω)
n=0 n=1
N−1
X N−1
X
f̂n2 (t) E φn (ω)2 = f̂n2 (t)
=
n=1 n=1
| {z }
=1
Variance
h i
2
Var [f (t, ω)] = E (f (t, ω) − E[f (t, ω)])
N−1
!2
N−1
!2
X X
≈E f̂n (t) φn (ω) − f̂0 (x) = E f̂n (t) φn (ω)
n=0 n=1
N−1
X N−1
X
f̂n2 (t) E φn (ω)2 = f̂n2 (t)
=
n=1 n=1
| {z }
=1
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201826
Polynomial Chaos Methods – Checklist
Polynomial approximation and the pseudo-spectral approach
N−1
X
f (t, ω) ≈ f̂n (t) φn (ω)
n=0
K
X −1
f̂n (t) = f (t, xk ) φn (xk ) wk
k =0
What we need to do
• specify type of polynomials φn (ω) X
• compute coefficients f̂n (t) X
• choose maximum order N and number of quadrature terms K X
• compute statistical properties of f (t, ω) based on this approximation X
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201827
Model Problem – Damped Linear Oscillator
2
d y dy
dt 2 (t) + c dt (t) + ky (t) = f cos(ωO t)
y (0) = y0
dy
dt (0) = y1
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201828
Model Problem – Damped Linear Oscillator
2
d y dy
dt 2 (t) + c dt (t) + ky (t) = f cos(ωO t)
y (0) = y0
dy
dt (0) = y1
• c – damping coefficient
• k – spring constant
• f – forcing amplitude
• ωO – frequency
• y0 – initial position
• y1 – initial velocity
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201828
Damped Linear Oscillator (2)
• c = 0.100, k = 0.035, f = 0.100, ωO = 1.000, y0 = 0.500, y1 = 0.000
• t ∈ [0, 30]
0.8
displacement
0.6 velocity
0.4
0.2
0.0
0.2
0.4
0 5 10 15 20 25 30
time
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201829
The Pseudo-spectral Approach – Example
N−1
X
y (T , ω) ≈ ŷn (T )φn (ω)
n=0
K
X −1
ŷn (T ) = y (T , xk ) φn (xk ) wk
k =0
• ŷn (T ) – coefficients
• φn (ω) – Legendre polynomials
• xk , wk – Gauss-Legendre quadrature nodes and weights
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201830
The Pseudo-spectral Approach – Example (2)
• T = 15
Deterministic result
• y (T ) = −1.51e − 01
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201831
The Pseudo-spectral Approach – Example (3)
Convergence
• sufficient to use small K and N = 12 K
• oscillator example: stoch. Galerkin with 10 terms as reference
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201832
The Pseudo-spectral Approach – Example (3)
Convergence
• sufficient to use small K and N = 12 K
• oscillator example: stoch. Galerkin with 10 terms as reference
10 -2 10 -2
10 -3 10 -3
relative error in variance
10 -5 10 -5
10 -6 10 -6
10 -7 10 -7
10 -8 3 4 5 6 7 10 -8 2 3 4 5 6 7
K N
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201832
Multivariate Polynomial Chaos Expansion
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201833
Multivariate Polynomial Chaos Expansion (2)
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201834
Multivariate Polynomial Chaos Expansion (2)
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201835
Summary
T. Neckel | Algorithms for Uncertainty Quantification | L6: PC approx. 1: pseudo-spectral approach | ST 201836