Least Squares - Using a Lower Degree Monomial
Thomas J. Kennedy
Note that this is not a good approximation. This example is intended to demonstrate the impact of a poorly selected basis function.
Suppose that we want to approximate f(x)=x4 for the domain 0≤x≤4 using a monomial of degree 2… using a continuous approximation.
1 Setting Up
Let us start with what we know:
- f(x)=x
- x∈[0,4]
- ˆφ=c0x2
Since ˆφ is a monomial… the single basis function is
- π0=x2
which leads to…
ˆφ=c0π2=c0x2
Since we have one basis function… A→c=→b takes the form…
[4∫x=0π0π0dx][c0]=[4∫x=0π0fdx]
Note how A is a 1-by-1 matrix. We have one constant to compute.
2 Plugging Everything In
We know that
- π0=x2
- f(x)=x
Let us plug everything in and use basic Algebra
c04∫x=0x4dx=4∫x=0x6dxc0455=477c0=477545c0=42751c0=807
3 The Result
Now that we have c0… we can write the approximation function as
ˆφ=807x2
4 What is the Error
Now… for the important question: How “bad” is our approximation?
The error can be evaluated using
E2(x)=||f(x)−ˆφ(x)||=∫R(f−ˆφ)2dλ(x)=∫Rf2dλ(x)−2∫Rˆφfdλ(x)+∫Rˆφ2dλ(x)=∫Rˆφ2dλ(x)−2∫Rˆφfdλ(x)+∫Rf2dλ(x)
Since we have a continuous approximation… with the domain 0≤x≤4…
E2(x)=∫Rˆφ2dλ(x)−2∫Rˆφfdλ(x)+∫Rf2dλ(x)=4∫x=0ˆφ2dx−24∫x=0ˆφfdx+4∫x=0f2dx
4.1 Plugging Everything In
Now… we plug in f and ˆφ (after preparing ourselves for some Calculus, Algebra, and Arithmetic).
E2(x)=4∫x=0ˆφ2dx−24∫x=0ˆφfdx+4∫x=0f2dx=4∫x=0(807x2)2dx−24∫x=0(807x2)x4dx+4∫x=0(x4)2dx=4∫x=0(807x2)2dx−24∫x=0(807x2)x4dx+4∫x=0x8dx=4∫x=0(807x2)2dx−24∫x=0(807x2)x4dx+1949=4∫x=0(807x2)2dx−16074∫x=0x6dx+1949=4∫x=0(807x2)2dx−1604947+1949=4∫x=0(807)2(x2)2dx−1604947+1949=(807)24∫x=0(x2)2dx−1604947+1949=(807)24∫x=0x4dx−1604947+1949=(807)21545dx−1604947+1949=(807)21545dx−16×104947+1949=(807)21545dx−104949+1949=640049×545−104949+1949=640049×545−104949+1949=12804945−104949+1949=256×54945−104949+1949=54949−104949+1949=−54949+1949=−54949+1949=(−45441+49441)49=444149=1441410
5 How Bad is It?
Since E2(x)=1441410 we know that…
E(x)=√1441410=√1441√410=√1441(410)12=1√441(410)12=1√44145=1√441(22)5=1√441210=1024√441=102421≈48.76
E(x) can be though of as the area between f(x) and ˆφ(x).
Let us examine the area under f(x)=x4…
4∫x=0x4dx=15x5|4x=0=1545=10245≈204.8
We are off by ≈50 when the know value is ≈200. We are essentially off by 25%.