1 Function Approximation

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 23

Function Approximation

Taylor Series Expansion

Where: a is the center of the series


@ a=0, it is a Maclaurin Series
Example:
Approximate f(x)=sin(x)
using Taylor Series
expansion at a=0 and n=9.
Solution:
n 0 1 2 3 4
f(n)(a) sin(a) cos(a) -sin(a) -cos(a) sin(a)
f(n)(0) 0 1 0 -1 0

n 5 6 7 8 9
f(n)(a) cos(a) -sin(a) -cos(a) sin(a) cos(a)
f(n)(0) 1 0 -1 0 1
Its Taylor Series approximation at
n=9
Let’s graph the first two terms
Let’s add another term
Let’s add another term
Let’s graph the whole maclaurin
series at n=9
As we can see, as the degree of the taylor polynomial
increases, it converges to the true function
Practice on your own
scratch paper

Approximate the function ln(x)


using 4th order Taylor
Polynomial centered at a=1
Solution:

n 0 1 2 3 4
f(n)(a) ln(a) 1/a -1/a^2 2/a^3 -6/a^4
f(n)(1) 0 1 -1/2 2 -6

Ans:
Taylor’s Theorem
Let f(x) be differentiable function over
some open interval [x, a] and

there exist a remainder such that,


f(x)=pn(x)+Rn(x),
Where:
Example:

Use Taylor’s Theorem to find the


remainder when approximating
f(x)=cos(x) at x=4 centered at 1 and
n=4.
Using Taylor’s Theorem

So.... R4(4)=-1.8483
Interpretation of the Remainder or
Error
P4(x)

f(x) R4(4) is the error distance


between f(4) and p4(4)
Seatwork:

Find the remainder of the f(x)=sin(x)


when approximating it at x=4 using
the taylor series at 5th degree and
centered at a=1.
Absolute Error and Relative Error
Example:

Find the absolute error and the


relative error at the 5th decimal
place when approximating ln(1.2)
in the previous problem
Solution:
p4(1.2) is the approximate value
ln(1.2) is the true value

p4(1.2)=0.18233
ln(1.2)=0.18232
Ans.

Ans. R.E.=5.48486x10-5
A.E.=1x10-5
Seatwork: 1 Short Bond Paper

Find the 4th order Maclaurin


polynomial Expansion of the
following functions:
1. f(x)=ex
2. f(x)=ln(1-x)
Assignment: 1 Short Bond Paper
1. Find the 5th order polynomial of the
following functions centered at a=0.5:
1. f(x)=ln(1+x)
2. f(x)=1/(1-x)
2. Find the Absolute Error of the function
above when approximating it at x=0.5
using the remainder integral function

You might also like