Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F105206082
5_subspaces.tex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 15, 10:49
Size
12 KB
Mime Type
text/x-tex
Expires
Mon, Mar 17, 10:49 (2 d)
Engine
blob
Format
Raw Data
Handle
24940594
Attached To
R2653 epfl
5_subspaces.tex
View Options
\documentclass
[aspectratio=169]
{
beamer
}
%\documentclass[aspectratio=169,handout]{beamer}
\def\stylepath
{
../styles
}
\usepackage
{
\stylepath
/com303
}
\usepackage
{
pst-3dplot
}
%\setbeameroption{show only notes}\def\logoEPFL{}
\setbeameroption
{
show notes
}
\begin
{
document
}
\begin
{
frame
}
\frametitle
{
Vector subspace
}
\begin
{
center
}
a subset of vectors
\textit
{
closed
}
under addition and scalar multiplication
\end
{
center
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Example in Euclidean Space
}
intuition:
$
\mathbb
{R}^
2
\subset
\mathbb
{R}^{
3
}
$
\begin
{
center
}
\psset
{
unit=3cm
}
\begin
{
pspicture
}
(-1.5,-.8)(1,1)
\psset
{
Alpha=40,linewidth=1pt
}
\pstThreeDCoor
[linecolor=black,linewidth=1pt,
%
xMax=1.5,yMax=1.5,zMax=1,
%
xMin=-.2,yMin=-.2,zMin=-.2,
%
nameX=
$
\mathbf
{e}^{
(
0
)
}
$
,
nameY=
$
\mathbf
{e}^{
(
1
)
}
$
,
nameZ=
$
\mathbf
{e}^{
(
2
)
}
$
]
\pstThreeDLine
[linecolor=gray,linewidth=1.8pt]
{
->
}
(0,0,0)(1,.3,0)
\pstThreeDLine
[linecolor=gray,linewidth=1.8pt]
{
->
}
(0,0,0)(1,.7,0)
\pstThreeDLine
[linecolor=blue,linewidth=1.8pt]
{
->
}
(1,.3,0)(1,.7,0)
\pstThreeDPut
(1.25,.45,0)
{
$
\mathbf
{x
+
y}
$
}
\end
{
pspicture
}
\end
{
center
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Subspace of symmetric functions over
$
L_
2
[-
1
,
1
]
$
}
\begin
{
center
}
\begin
{
figure
}
\begin
{
dspPlot
}
[xticks=1,xout=true,yticks=2,sidegap=0]
{
-1, 1
}{
-2.2, 2.2
}
\moocStyle
\only
<1-2>
{
\dspFunc
{
x 180 mul cos
}}
\only
<2>
{
\dspFunc
[linecolor=orange]
{
x 180 mul 5 mul cos
}}
\only
<3>
{
\dspFunc
[linecolor=lightgray]
{
x 180 mul cos
}
\dspFunc
[linecolor=lightgray]
{
x 180 mul 5 mul cos
}
\dspFunc
[linecolor=blue]
{
x 180 mul cos x 180 mul 5 mul cos add
}}
\end
{
dspPlot
}
\end
{
figure
}
\only
<1>
{
$
\mathbf
{x}
=
\cos
(
\pi
t
)
$
}
\only
<2>
{
$
\mathbf
{y}
=
\cos
(
5
\pi
t
)
$
}
\only
<3>
{
$
\mathbf
{x}
+
\mathbf
{y}
$
, symmetric
}
\end
{
center
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Subspaces have their own basis
}
\centering
\[
\mathbf
{e}^{
(
0
)
}
=
\myvector
{
1
\\
0
\\
0
}
\qquad
\mathbf
{e}^{
(
1
)
}
=
\myvector
{
0
\\
1
\\
0
}
\]
basis vector for the plane in
$
\mathbb
{R}^
3
$
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Approximation
}
\begin
{
columns
}
\begin
{
column
}{
.4
\paperwidth
}
Problem:
\begin
{
itemize
}
[<+->]
\item
vector
$
\mathbf
{x}
\in
V
$
\item
subspace
$
S
\subseteq
V
$
\vspace
{
1em
}
\item
approximate
$
\mathbf
{x}
$
with
$
\hat
{
\mathbf
{x}}
\in
S
$
\end
{
itemize
}
\end
{
column
}
\begin
{
column
}{
.5
\paperwidth
}
\centering
\psset
{
unit=3cm
}
\begin
{
pspicture
}
(-1.5,-.8)(1.5,1.8)
\psset
{
Alpha=40,linewidth=1pt
}
\pstThreeDCoor
[linecolor=black,linewidth=1pt,
%
xMax=1.5,yMax=1.5,zMax=1.5,
%
xMin=-.2,yMin=-.2,zMin=-.2,
%
nameX=
$
\mathbf
{e}^{
(
0
)
}
$
,
nameY=
$
\mathbf
{e}^{
(
1
)
}
$
,
nameZ=
$
\mathbf
{e}^{
(
2
)
}
$
]
\pstThreeDLine
[linewidth=1.8pt]
{
->
}
(0,0,0)(1,.5,2)
\pstThreeDPut
(1,.5,2.15)
{
$
\mathbf
{x}
$
}
\only
<2->
{
%
\pstThreeDLine
[linecolor=darkred]
{
->
}
(0,0,0)(1.5,0,0)
\pstThreeDLine
[linecolor=darkred]
{
->
}
(0,0,0)(0,1.5,0)
}
\only
<3->
{
\pstThreeDLine
[linestyle=dashed,linewidth=0.5pt]
(0,.5,0)(1,.5,0)
\pstThreeDLine
[linestyle=dashed,linewidth=0.5pt]
(1,.5,0)(1,0,0)
\pstThreeDLine
[linestyle=dashed,linewidth=0.5pt]
(1,.5,0)(1,.5,2)
\pstThreeDLine
[linecolor=gray,linewidth=1.8pt]
{
->
}
(0,0,0)(1,.5,0)
\pstThreeDPut
(1.15,.65,0)
{
$
\hat
{
\mathbf
{x}}
$
}}
\end
{
pspicture
}
\end
{
column
}
\end
{
columns
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Least-Squares Approximation
}
\begin
{
itemize
}
[<+->]
\item
$
\{
\mathbf
{s}^{
(
k
)
}
\}
_{k
=
0
,
1
,
\ldots
, K
-
1
}
$
orthonormal basis for
$
S
$
\item
orthogonal projection:
\[
\hat
{
\mathbf
{x}}
=
\sum
_{k
=
0
}^{K
-
1
}
\langle
\mathbf
{s}^{
(
k
)
},
\mathbf
{x}
\rangle
\,
\mathbf
{s}^{
(
k
)
}
\]
\end
{
itemize
}
\vspace
{
2em
}
\centering
\uncover
<3->
{
orthogonal projection is the ``best'' approximation over
$
S
$
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Least-Squares Approximation
}
\begin
{
itemize
}
[<+->]
\item
orthogonal projection has minimum-norm error:
\[
\arg\min
_{
\mathbf
{y}
\in
S}
\|
\mathbf
{x}
-
\mathbf
{y}
\|
=
\hat
{
\mathbf
{x}}
\]
\vspace
{
1em
}
\item
error is orthogonal to approximation:
\[
\langle
\mathbf
{x}
-
\hat
{
\mathbf
{x}},
\,
\hat
{
\mathbf
{x}}
\rangle
=
0
\]
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Least Squares Approximation
}
\begin
{
center
}
\psset
{
unit=10mm
}
\begin
{
pspicture
}
(-1,0)(8,6)
\psline
{
->
}
(5,4)
\rput
[bl]
{
0
}
(5,4)
{
~
$
\mathbf
{x}
$
}
\psline
{
->
}
(10,2)
\rput
[tl]
{
0
}
(10,2)
{
~
$
\mathbf
{s}
$
}
\only
<2->
{
\pscircle
[linecolor=green,linewidth=0.5pt]
(5,4)
{
0.49
}}
\only
<3->
{
\pscircle
[linecolor=green,linewidth=0.5pt]
(5,4)
{
0.98
}}
\only
<4->
{
\pscircle
[linecolor=green,linewidth=0.5pt]
(5,4)
{
1.47
}}
\only
<5->
{
\pscircle
[linecolor=green,linewidth=0.5pt]
(5,4)
{
1.96
}}
\only
<6->
{
%
\pscircle
[linecolor=green,linewidth=0.5pt]
(5,4)
{
2.45
}
\pscircle
[linecolor=green,linewidth=0.5pt]
(5,4)
{
2.94
}
\psline
[linecolor=red]
{
->
}
(5.57,1.11)(5,4)
\rput
[bl]
{
0
}
(5.3,3)
{
~
$
\mathbf
{x}
-
\hat
{
\mathbf
{x}}
$
}
\psline
[linecolor=blue]
{
->
}
(5.57,1.11)
\rput
[tl]
{
0
}
(3,0.2)
{
~
$
\hat
{
\mathbf
{x}}
$
}
}
\end
{
pspicture
}
\end
{
center
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Example: polynomial approximation
}
\begin
{
itemize
}
[<+->]
\item
vector space
$
P_N
[-
1
,
1
]
\subset
L_
2
[-
1
,
1
]
$
\item
$
\mathbf
{p}
=
a_
0
+
a_
1
t
+
\ldots
+
a_{N
-
1
} t^{N
-
1
}
$
\item
a self-evident, naive basis:
$
\mathbf
{s}^{
(
k
)
}
=
t^k,
\quad
k
=
0
,
1
,
\ldots
, N
-
1
$
\item
naive basis is not orthonormal
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Example: polynomial approximation
}
\centering
goal: approximate
$
\mathbf
{x}
=
\sin
t
\in
L_
2
[-
1
,
1
]
$
over
$
P_
3
[-
1
,
1
]
$
\vspace
{
1.5em
}
\begin
{
itemize
}
\item
<2-> build orthonormal basis from naive basis
\item
<3-> project
$
\mathbf
{x}
$
over the orthonormal basis
\item
<4-> compute approximation error
\item
<5-> compare error to Taylor approximation (well known but not optimal over the interval)
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Building an orthonormal basis
}
\begin
{
center
}
Gram-Schmidt orthonormalization procedure:
\begin
{
figure
}
\begin
{
dspBlocks
}{
1
}{
0.2
}
$
\{
\mathbf
{s}^{
(
k
)
}
\}
$
~~
&
$
~~
\{
\mathbf
{u}^{
(
k
)
}
\}
$
\\
original set
&
orthonormal set
\\
\BDConnH
{
1
}{
1
}{
2
}{}
\end
{
dspBlocks
}
\end
{
figure
}
\end
{
center
}
\pause
Algorithmic procedure: at each step
$
k
$
\begin
{
enumerate
}
[<+->]
\item
$
\displaystyle
\mathbf
{p}^{
(
k
)
}
=
\mathbf
{s}^{
(
k
)
}
-
\sum
_{n
=
0
}^{k
-
1
}
\langle
\mathbf
{u}^{
(
n
)
},
\mathbf
{s}^{
(
k
)
}
\rangle
\,
\mathbf
{u}^{
(
n
)
}
$
\item
$
\mathbf
{u}^{
(
k
)
}
=
\mathbf
{p}^{
(
k
)
}
/
\|\mathbf
{p}^{
(
k
)
}
\|
$
\end
{
enumerate
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Building an orthonormal basis
}
\begin
{
center
}
\psset
{
unit=10mm
}
\begin
{
pspicture
}
(-1,0)(8,6)
{
\only
<2->
{
\psset
{
linecolor=lightgray
}}
\psline
{
->
}
(5,4)
\rput
[bl]
{
0
}
(5,4)
{
~
$
\mathbf
{s}^{
(
1
)
}
$
}
\psline
{
->
}
(10,2)
\rput
[tl]
{
0
}
(10,2)
{
~
$
\mathbf
{s}^{
(
0
)
}
$
}
}
\only
<2>
{
\psline
[linecolor=red]
{
->
}
(10,2)
\rput
[bl]
{
0
}
(10,2)
{
~
$
\mathbf
{p}^{
(
0
)
}
$
}}
\only
<3->
{
\psline
[linecolor=blue]
{
->
}
(3.9223, 0.7844)
\rput
[tl]
{
0
}
(3.9223, 0.7844)
{
\color
{
blue
}
~
$
\mathbf
{u}^{
(
0
)
}
$
}}
\only
<4-5>
{
\psline
[linecolor=gray,linestyle=dashed]
(5.57,1.11)(5,4)
}
\only
<4>
{
\psline
[linecolor=red!50]
{
->
}
(5.57,1.11)
\rput
[tl]
{
0
}
(5.57,1.11)
{
\color
{
red!50
}
$
\langle
\mathbf
{u}^{
(
0
)
},
\mathbf
{s}^{
(
1
)
}
\rangle
\mathbf
{u}^{
(
0
)
}
$
}}
\only
<5>
{
\psline
[linecolor=red!50]
{
->
}
(5,4)(-0.57,2.89)
\psline
[linecolor=red]
{
->
}
(-0.57,2.89)
\rput
[bl]
{
0
}
(-0.57,2.89)
{
~
$
\mathbf
{p}^{
(
1
)
}
$
}}
\only
<6->
{
\psline
[linecolor=blue]
{
->
}
(-0.7740, 3.9244)
\rput
[br]
{
0
}
(-0.7740, 3.9244)
{
\color
{
blue
}
~
$
\mathbf
{u}^{
(
1
)
}
$
}}
\end
{
pspicture
}
\end
{
center
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Building an orthonormal basis
}
\begin
{
center
}
Gram-Schmidt orthonormalization of the naive basis:
$
\{
\mathbf
{s}^{
(
k
)
}
\}
\rightarrow
\{
\mathbf
{u}^{
(
k
)
}
\}
$
\end
{
center
}
\begin
{
columns
}
\begin
{
column
}{
.5
\paperwidth
}
\begin
{
itemize
}
[<+->]
\item
$
\mathbf
{s}^{
(
0
)
}
=
1
$
\begin
{
itemize
}
\item
$
\mathbf
{p}^{
(
0
)
}
=
\mathbf
{s}^{
(
0
)
}
=
1
$
\item
$
\|\mathbf
{p}^{
(
0
)
}
\|
^
2
=
2
$
\item
$
\mathbf
{u}^{
(
0
)
}
=
\mathbf
{p}^{
(
0
)
}
/
\|\mathbf
{p}^{
(
0
)
}
\|
=
\sqrt
{
1
/
2
}
$
\end
{
itemize
}
\item
$
\mathbf
{s}^{
(
1
)
}
=
t
$
\begin
{
itemize
}
\item
$
\langle
\mathbf
{u}^{
(
0
)
},
\mathbf
{s}^{
(
1
)
}
\rangle
=
\int
_{
-
1
}^{
1
}t
/
\sqrt
{
2
}
=
0
$
\item
$
\mathbf
{p}^{
(
1
)
}
=
\mathbf
{s}^{
(
1
)
}
=
t
$
\item
$
\|\mathbf
{p}^{
(
1
)
}
\|
^
2
=
2
/
3
$
\item
$
\mathbf
{u}^{
(
1
)
}
=
\sqrt
{
3
/
2
}
\,
t
$
\end
{
itemize
}
\end
{
itemize
}
\end
{
column
}
\begin
{
column
}{
.5
\paperwidth
}
\begin
{
itemize
}
[<+->]
\item
$
\mathbf
{s}^{
(
2
)
}
=
t^
2
$
\begin
{
itemize
}
\item
$
\langle
\mathbf
{u}^{
(
0
)
},
\mathbf
{s}^{
(
2
)
}
\rangle
=
\int
_{
-
1
}^{
1
}t^
2
/
\sqrt
{
2
}
=
2
/
3
\sqrt
{
2
}
$
\item
$
\langle
\mathbf
{u}^{
(
1
)
},
\mathbf
{s}^{
(
2
)
}
\rangle
=
\int
_{
-
1
}^{
1
}t^
3
/
\sqrt
{
2
}
=
0
$
\item
$
\mathbf
{p}^{
(
2
)
}
=
\mathbf
{s}^{
(
2
)
}
-
(
2
/
3
\sqrt
{
2
}
)
\mathbf
{u}^{
(
0
)
}
=
t^
2
-
1
/
3
$
\item
$
\|\mathbf
{p}^{
(
2
)
}
\|
^
2
=
8
/
45
$
\item
$
\mathbf
{u}^{
(
2
)
}
=
\sqrt
{
5
/
8
}
(
3
t^
2
-
1
)
$
\end
{
itemize
}
\end
{
itemize
}
\end
{
column
}
\end
{
columns
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Legendre polynomials
}
\begin
{
center
}
The Gram-Schmidt algorithm leads to an orthonormal basis for
$
P_N
([-
1
,
1
])
$
\end
{
center
}
\begin
{
align*
}
\mathbf
{
u
}^{
(0)
}
&
=
\sqrt
{
1/2
}
\\
\mathbf
{
u
}^{
(1)
}
&
=
\sqrt
{
3/2
}
\,
t
\\
\mathbf
{
u
}^{
(2)
}
&
=
\sqrt
{
5/8
}
(3t
^
2-1)
\\
\mathbf
{
u
}^{
(3)
}
&
=
\ldots
\end
{
align*
}
\end
{
frame
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%\begin{align*}
% P_N(x) &= \sqrt{\frac{2N+1}{2}}p_N(x) \\
% p_0(x) &= 1\\
% p_1(x) &= x \\
% p_2(x) &= \frac{1}{2}(3x^2-1) \\
% p_3(x) &= \frac{1}{2}(5x^3-3x) \\
% p_4(x) &= \frac{1}{8}(35x^4 - 30x^2 + 3) \\
% p_5(x) &= \frac{1}{8}(63x^5 - 70x^3 + 15x) \\
%\end{align*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin
{
frame
}
\frametitle
{
Legendre Polynomials
}
\begin
{
center
}
\begin
{
figure
}
\begin
{
dspPlot
}
[yticks=1,xticks=1,height=5cm,sidegap=0,xout=true]
{
-1, 1
}{
-2.3, 2.3
}
\begin
{
dspClip
}
\only
<1->
{
\dspFunc
[linecolor=black]
{
1 2 div sqrt 1 mul
}}
%
\only
<2->
{
\dspFunc
[linecolor=red]
{
3 2 div sqrt x mul
}}
%
\only
<3->
{
\dspFunc
[linecolor=yellow]
{
5 2 div sqrt 3 x x mul mul 1 sub mul 2 div
}}
%
\only
<4->
{
\dspFunc
[linecolor=green]
{
7 2 div sqrt 5 x x x mul mul mul -3 x mul add mul 2 div
}}
%
\only
<5->
{
\dspFunc
[linecolor=blue]
{
9 2 div sqrt 35 x x x x mul mul mul mul -30 x x mul mul 3 add add mul 8 div
}}
%
\only
<6->
{
\dspFunc
[linecolor=cyan]
{
11 2 div sqrt 63 x x x x x mul mul mul mul mul -70 x x x mul mul mul 15 x mul add add mul 8 div
}}
%
\end
{
dspClip
}
\dspCustomTicks
{
-1 -1 0 0 1 1
}
%
\end
{
dspPlot
}
\end
{
figure
}
\end
{
center
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Orthogonal projection over
$
P_
3
[-
1
,
1
]
$
}
\[
\alpha
_k
=
\langle
\mathbf
{u}^{
(
k
)
},
\mathbf
{x}
\rangle
=
\int
_{
-
1
}^{
1
}u_k
(
t
)
\,\sin
t
\,
dt
\]
\begin
{
itemize
}
[<+->]
\item
$
\alpha
_
0
=
\langle
\sqrt
{
1
/
2
},
\sin
t
\rangle
=
0
$
\item
$
\alpha
_
1
=
\langle
\sqrt
{
3
/
2
}
\,
t,
\sin
t
\rangle
\approx
0
.
7377
$
\item
$
\alpha
_
2
=
\langle
\sqrt
{
5
/
8
}
(
3
t^
2
-
1
)
,
\sin
t
\rangle
=
0
$
\end
{
itemize
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Approximation
}
\begin
{
center
}
Using the orthogonal projection over
$
P_
3
[-
1
,
1
]
$
:
\[
\sin
t
\rightarrow
\alpha
_
1
\mathbf
{u}^{
(
1
)
}
\approx
0
.
9035
\,
t
\]
\vspace
{
3em
}
\uncover
<2->
{
Using Taylor's series:
\[
\sin
t
\approx
t
\]
}
\end
{
center
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Sine approximation
}
\begin
{
center
}
\begin
{
figure
}
\begin
{
dspPlot
}
[yticks=1,xticks=1,height=5cm,sidegap=0,xout=true]
{
-1, 1
}{
-1.2, 1.2
}
\dspFunc
[linecolor=blue]
{
x 3.14 div 180 mul sin
}
\dspFunc
[linecolor=red,linewidth=1pt]
{
x
}
\dspFunc
[linecolor=green,linewidth=1pt]
{
x 0.9035 mul
}
\dspLegend
(-0.9,1)
{
blue
{
$
\sin
t
$
}
red
$
t
$
green
$
0
.
9035
t
$
}
\end
{
dspPlot
}
\end
{
figure
}
\end
{
center
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Approximation error
}
\begin
{
center
}
\begin
{
figure
}
%\dspCustomTicks{-1 -1 0 0 1 1}
\begin
{
dspPlot
}
[yticks=1,xticks=1,height=5cm,sidegap=0,xout=true]
{
-1, 1
}{
0, 0.22
}
\dspFunc
[linecolor=red]
{
x 3.14 div 180 mul sin x sub abs
}
\dspFunc
[linecolor=green]
{
x 3.14 div 180 mul sin x 0.9035 mul sub abs
}
\dspLegend
(-0.5,0.2)
{
red
{
$
|
\sin
t
-
t|
$
}
green
{
$
|
\sin
t
-
0
.
9035
t|
$
}}
\end
{
dspPlot
}
\end
{
figure
}
\end
{
center
}
\end
{
frame
}
\begin
{
frame
}
\frametitle
{
Error norm
}
\begin
{
center
}
Orthogonal projection over
$
P_
3
[-
1
,
1
]
$
:
\[
\|
\sin
t
-
\alpha
_
1
\,\mathbf
{u}^{
(
1
)
}
\|
\approx
0
.
0337
\]
\vspace
{
3em
}
\uncover
<2->
{
Taylor series:
\[
\|
\sin
t
-
t
\|
\approx
0
.
0857
\]
}
\end
{
center
}
\end
{
frame
}
\end
{
document
}
Event Timeline
Log In to Comment