2.5 Approximating Functions
This section is dedicated to methods of rewriting non-polynomial functions in a polynomial form. We will review two ways of doing this: the Taylor Series Expansion, and the Inner Product Method.
2.5.1 Taylor Series Expansion
The Taylor Series Expansion involves choosing constants of a polynomial in a manner that ensures that derivatives of said polynomial
to the
degree equal the non-polynomial function at a given point. As can be deduced, in order for this to work we must assume that
our non-polynomial function can be written as a standard series with unknown constants. This assumption is shown in
equation 2.238.
| (2.238) |
Our solution lies in finding the appropriate value for ,
, etc. In order to
find , we can
simply set .
Doing this, we get the equation 2.239.
| (2.239) |
In order to find ,
we simply take the derivative of equation 2.238. Differentiating and again setting
, we get
equation 2.240.
| (2.240) |
We can find by repeating the
differentiating exercise and again setting .
Doing this we get equation 2.241.
| (2.241) |
If we repeat differentiation
times, we will find that function
will be equal to equation 2.242.
| (2.242) |
In equation 2.242, we were able to easily find our desired constants because we fixed our
location
at .
For this reason, we say that our polynomial approximation is centered at
. In order to center our polynomial
approximation at arbitrary point ,
we start can start out with equation 2.243. This is a modified version of equation 2.238.
| (2.243) |
Finding the
values using differentiation, we get equation 2.244.
| (2.244) |
As can be easily deduced, our polynomial approximation for
is most
accurate at
(our function
and the polynomial approximation give exactly the same output at this point). The further away we get from
,
the more the output of our polynomial function diverges from the original non polynomial function
. In addition, the
more terms we consider within our theoretically infinite polynomial approximation, the more accurate the polynomial approximation is
at outputting an equivalent value as the original function. This phenomenon can be observed in Figure 2.8, which shows the function
along with a Taylor polynomial
approximation (centered at )
given different amounts of terms.
It is quite time consuming to calculate a Taylor Series of any non-polynomial function
. In
order to shortcut this process, the Taylor approximations of common non-polynomial functions centered at
are
provided in Table 2.4.
Example: Euler’s Identity
In this example, we will generate a Taylor series approximation centered at
for the
function provided in equation 2.245.
| (2.245) |
In equation 2.245, is the
imaginary number
introduced in section 2.8.3. Plugging equation 2.245 into equation 2.244 (assuming
), we get
equation 2.246.
| (2.246) |
We can regroup equation 2.246 as shown in equation 2.247.
| (2.247) |
Now, you may notice from Table 2.4 that the left series in equation 2.247 is the Taylor series for
. The right series in equation
2.247 is the Taylor series for .
Therefore, we can rewrite equation 2.247 as shown in equation 2.248.
| (2.248) |
Equation 2.248 is called Euler’s formula. Plugging in
into equation 2.248, we are able to get Euler’s identify, shown in equation 2.249.
| (2.249) |
We can use a similar process as presented in this example to prove equation 2.250 is true.
| (2.250) |
Expansion on Euler’s Identity
In this example, we will use above equations 2.248 and 2.250 to simplify equation 2.251.
| (2.251) |
Algebraically rewriting equation 2.251 and plugging in equations 2.248 and 2.250 we get equation 2.252.
| (2.252) |
Now, we can define two constants as shown in equations 2.253 and 2.254.
Plugging in equations 2.253 and 2.254 into equation 2.252 we are left with equation 2.255.
| (2.255) |
2.5.2 Inner Product Approximation
The Inner Product Approximation is an alternative way to fit a polynomial function to a non-polynomial function.
As in the Taylor series method, we start out with a standard polynomial to be fitted to a target function
. This
“problem statement” is shown in equation 2.256.
| (2.256) |
Again, as with the Taylor Series Method, our solution lies with finding the appropriate values for
,
, etc. In the Taylor Series Method,
it was possible to solve for ,
,
etc. and then look for patterns. In this method, we need to decide from the start to which maximum value
our
fitting polynomial goes out to. Essentially, we need to start out with a finite term fitting function.
As the name of this method suggests, we will be using a mathematical construct called the inner
product in order to find these values. The definition of the inner product between two functions
and
on the
interval
is provided in equation 2.257.
| (2.257) |
The inner product can be thought of as analogous operator for continuous functions as the dot product (section 2.3.2) is for
vectors. You may remember from the vectors section (section 2.3.2) that if the dot product of two vectors is 0, the vectors
are considered orthogonal. In following this, equation 2.258 provides the definition of orthogonal functions
and
.
| (2.258) |
Given equation 2.258, we can make a mental extrapolation to the curve fitting methodology presented in section 2.4. As a
reminder, in this procedure, our target modeling function provided us with vectors within a given vector space (shown
in equation 2.207). We used the Gram-Schmidt Orthogonalization Procedure to orthogonalize the vectors
within this vector space with the goal of deriving an orthogonal basis. We then projected the given vector
onto this
new vector space (shown in equation 2.209). Within the process of projecting, we got the closest vector to
that exists within this vector space (this closest vector is defined within section 2.4 as
). Our
mental extrapolation consists of thinking of our target modeling function (equation 2.256) as a span of functions
{,
,
, ...,
}. We are
trying to find the combination of functions within this span that makes this span best fit our given function
on the interval
(although I am using
slightly different terminology here to drive the connection between function fitting and curve fitting, this best fit manifests itself in simply
finding the correct ,
,
etc). Therefore, we can follow the general procedure laid out in section 2.4, but tweak it for functions
(replace every dot product with an inner product). Our first step is to derive a set of orthogonal functions
{,
,...,
} for our
span of functions. We can do this my mimicking the Gram-Schmidt Orthogonalization Procedure out to desired function
as shown
in the following sequence.
In following the curve fitting procedure, our next step is to project our given function
onto our
derived orthogonal set of functions. We can do this my mimicking equation 2.209 for functions as shown in equation 2.259.
In doing this, we will get a polynomial with coefficients. We have essentially found the points
,
,
etc. that cause our original function (equation 2.256) to most closely match
on the given
interval .
Short Example
In this example, we will fit the equation
to a polynomial. We will limit our fitting polynomial to the first 3 terms of the general equation provided in 2.256 on the
interval .
Therefore, our problem statement resembles equation 2.260.
Our goal is to find ,
, and
that make this as true as possible.
Our modeling function span is .
Our first step is orthogonalize these functions using the Gram-Schmidt Orthogoanliztaion Procedure for functions laid out
previously. Doing this, we get the following orthogonal function basis.
Now we simply project
onto the orthogonal basis using equation 2.259. Doing this, we get equation 2.261.
The function
along with the polynomial approximation shown in equation 2.261 is shown in Figure 2.9.