Processing math: 100%

Least Squares - Using a Lower Degree Monomial

Thomas J. Kennedy

Contents:

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 0x4 using a monomial of degree 2… using a continuous approximation.

1 Setting Up

Let us start with what we know:

Since ˆφ is a monomial… the single basis function is

which leads to…

ˆφ=c0π2=c0x2

Since we have one basis function… Ac=b takes the form…

[4x=0π0π0dx][c0]=[4x=0π0fdx]

Note how A is a 1-by-1 matrix. We have one constant to compute.

2 Plugging Everything In

We know that

Let us plug everything in and use basic Algebra

c04x=0x4dx=4x=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)2Rˆφfdλ(x)+Rˆφ2dλ(x)=Rˆφ2dλ(x)2Rˆφfdλ(x)+Rf2dλ(x)

Since we have a continuous approximation… with the domain 0x4

E2(x)=Rˆφ2dλ(x)2Rˆφfdλ(x)+Rf2dλ(x)=4x=0ˆφ2dx24x=0ˆφfdx+4x=0f2dx

4.1 Plugging Everything In

Now… we plug in f and ˆφ (after preparing ourselves for some Calculus, Algebra, and Arithmetic).

E2(x)=4x=0ˆφ2dx24x=0ˆφfdx+4x=0f2dx=4x=0(807x2)2dx24x=0(807x2)x4dx+4x=0(x4)2dx=4x=0(807x2)2dx24x=0(807x2)x4dx+4x=0x8dx=4x=0(807x2)2dx24x=0(807x2)x4dx+1949=4x=0(807x2)2dx16074x=0x6dx+1949=4x=0(807x2)2dx1604947+1949=4x=0(807)2(x2)2dx1604947+1949=(807)24x=0(x2)2dx1604947+1949=(807)24x=0x4dx1604947+1949=(807)21545dx1604947+1949=(807)21545dx16×104947+1949=(807)21545dx104949+1949=640049×545104949+1949=640049×545104949+1949=12804945104949+1949=256×54945104949+1949=54949104949+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=1441410=1441(410)12=1441(410)12=144145=1441(22)5=1441210=1024441=10242148.76

E(x) can be though of as the area between f(x) and ˆφ(x).

Let us examine the area under f(x)=x4

4x=0x4dx=15x5|4x=0=1545=10245204.8

We are off by 50 when the know value is 200. We are essentially off by 25%.