3rd order Polynomial approximation to `e^x ` , `x in [0,1] ` using Calculus.   Let `V ` be the vector space of all continuous functions  `f:[0,1] -> RR `  with the standard inner product...

3rd order Polynomial approximation to `e^x ` , `x in [0,1] ` using Calculus.

 

Let `V ` be the vector space of all continuous functions 

`f:[0,1] -> RR `  with the standard inner product

`(f,g) = int_0^1 f(x)g(x) dx ` 

Let `W ` = Span {`1,x,x^2,x^3 ` }

Find the best approximation to `f(x) = e^x ` that exists in `W `, that is, find the

function `g in W ` such that the Euclidean distance between the functions `f ` and `g ` , ||f-g||, is minimized.` `

Images:
This image has been Flagged as inappropriate Click to unflag
Image (1 of 1)

2 Answers | Add Yours

mathsworkmusic's profile pic

mathsworkmusic | (Level 2) Educator

Posted on

The equation after 'I will rewrite this as' didn't display for some reason.

Anyway, it should have been

`||f-g||= int_0^1 (e^x - a_0-a_1x-a_2x^2-a_3x^3)^2 dx`

You need to square the term under the integral sign before applying the formula they give at the end of the question.

mathsworkmusic's profile pic

mathsworkmusic | (Level 2) Educator

Posted on

The problem is to find the best approximation to the function

`f(x)=e^x `  where `x in [0,1] `

using a function `g ` that is in W, where W is the span of `{1,x,x^2,x^3} ` ie the first 4 powers in `x ` (including the zeroeth power).

A span of a set of elements is the set of all possible linear combinations of those elements.

A potential near solution that should come easily to your mind is the Taylor series approximation to the function `f `, about `x_0=0` for example:

`g_T = 1 + x + x^2/2 +x^3/6 `

This is a good benchmark to work from, and noticing this near solution would gain some marks I think.

Now, the measure we are told to use to judge the quality of the approximation is the Euclidean distance, `||f-g|| `. That measure is equivalent to the standard inner product of `(f-g) ` with itself (its Euclidean 'norm'), which we are nearly given in the question.

Adapting the formula they give a bit we have that

`||f-g|| = int_0^1 (f(x)-g(x))^2dx`

I will rewrite this as``

``

We are then interested in solving this equation to find `{a_0,a_1,a_2,a_3} `

Using the integral formula given in the question for each of the terms in `g ` you should arrive at

`||f-g|| = 1/2(e^2-1)-2a_0(e-1)-2a_1-2a_2(e-2)-2a_3(6-2e) `

` ``+a_0^2+a_0a_1+2/3a_0a_2+a_1^2/3+1/2a_0a_3+1/2a_1a_2+2/5a_1a_3+1/5a_2^2`

`+1/3a_2a_3 + a_3^2/7 `

To minimize this with calculus, we collect the four partial derivative equations in `{a_0,a_1,a_2,a_3} ` which leaves us with a 4D linear system to solve. The method is to reduce the following matrix to row reduced Echelon Form:

2     1     2/3  1/2  |  2(e-1)

1     2/3  1/2  2/5  |  2

2/3  1/2  2/5  1/3  |  2(e-2)

1/2  2/5  1/3  2/7  |  2(6-2e)

After 8 row operations (!) I get (math editor broken now for some reason)

a_3 = (1/20)*(311-117*e)*(-1400/1749) = 0.2817199

a_2 = 135*e - 345 -(153/2)*a_3 = 0.4164714

a_1 = 363 - 141*e + (756/10)*a_3 = 1.02029

a_0 = (53/2)*e - 135/2 - (251/20)*a_3 = 0.9988832

Plugging this solution into the distance measure ||f-g|| gives a value of

1.132644e-07

Whereas, plugging in the Taylor series approx about 0 discussed above gives a value of

0.0002831481

which is about a 2500 times larger error! Remember the Taylor series approximation is only good in the region close to where it is centered (x_0).

Best approximation obtained according to Euclidean distance measure:

g(x) = a_0 + a_1*x + a_2*x^2 + a_3*x_3

where {a_0,a_1,a_2,a_3} as given above.

Sources:

We’ve answered 318,982 questions. We can answer yours, too.

Ask a question