| Least square Problem
* Suppose a polynomial
Yi = Bot Bix; + Pox? + st Bypt" + &; (E= 1,2,.44571)
* In matrix form
2
yy, Bax 4 - "! [A e
% Lom xm eo) |B &
M)=)1 x fo. ] [AL +] eI,
Jn 7 on ed Ba &,
* Itis a linear problem a
Y=Xfre.
Note that X is not square but rectangular because n is not equal to nSolve via Inverse
B = (AX) XS,
It means best parameters to fit (least square criteria), in
other word we are looking for the condition
arg niin lly — XB,
an L2 norm, note that this norm will be zero for
polynomial interpolation.Lets evaluate
* Calculate parameter Bo, B: and B2 (Regression problem)
co aLets evaluate
* Assembly the rectangular (not square) Vandermonde Matrix
Data
ew 111
4} 4 124
13 9 axm.=6x3, n data m unknown
2) 4 =
3110 15 25
4) 15 1 6 36
5 | 26
6 | 35First
+ Assembly the rectangular (not square) Vandermonde Matrix
B = (XTX) XTy,
M 111
.
1111141 ae
XT=/]123 4 5 6 X=], 3 46
14 9 16 25 36 13 95
1 6 36
6 21 91
M=/21 91 441 a 3x3 need to find the inverse
91 441 2275Lets evaluate Parameter
B = (XTX XTY,
Ms
6 21 OL
M=1]21 91 441 a 3x3 need to find the inverse M-?
91 441 2275
Using the LU decomposition above, resulted
6 0 0 1 3.5 15.17
L=/21 175 0 U=]0 1 7
91 122.5 37,33 0 0 1|
6 0
21 17.5
91 122.5 37.33
L
Upper Matrix
MM"! =I
My M2 Mis] [mi mis mis] fo 0
My, My Ma) [may min vty) = [0 1 (
Ms May Mga| [inj mig my mao 1.
LUM"! =I
~
D
a ' ,
0 1 3.5 15.17] [a M2 M3 100
0 0 1 7 mM, My, m3) = }0 1 0
0 0 1 my my my 001
a |
DLower Matrix
MM"! =I
My Miz Mis] [mi min ms 100
My, Mr Mrz) |i mi, my -|p 1 4
My My My; my may amy O01
LD=I1
6 0 0 - A
21175 «0 - [of
91 122.5 “ID-Matrix
6 oF 0 Tian do 4s 10
2117.5 0 | |do, dap de: - [pil
91 122.5 37.33] dy dyy das 00
dy dy ay sm 0 0 |
* By forward substitution
dy, doy dy -0.2000 0.0571 0
dy, day des 0.2500 -0.1875 0.0268The Inverse
UM
ei a a le Be)
* By backward substitution
=i
0.1667 0
—0.2000. 0
0.2500 0.0268
»
mi, mz My 3.2 -1.95 0.2500
My, My m3) = |-1.95 1.3696 -0.1875
ms, My mi; 0.25 -0,1875 0.0268Best Parameters
my, My Mx 32 -1.95 0.2500
=1.95 13696 —-0,1875
0.25 -0.1875 0.0268
M7! = |mj, my mg] =
My, My M3,
= [32 -195 02500] [1111 1 17/4
B=|-195 1.3686 -0.1875| 1 23 4 5 6| |9
0.25 -0.1875 0.0268 | [1 4 9 16 25 36] |5°
‘ 35
~ | 06
B = | 0.6357
0.8929Plug in into polynomial
a -0.6 y; =— 0.6 + 0.63574; + 0.8929x?
B = | 0.6357
0.8929
J
Y fo
A
A