Polynomials - Examples

Does the algorithm work for actual polynomials? Any such exercise is going to seem like a tautology if it works, but lets do it one time, just to show that it is consistent. Consider the quadratic given by \(p(x)=3-2x+x^2.\) If the algorithm works, it should just give the same polynomial back.

Thus, we suppose that \(p(x)=a_0+a_1x+a_2x^2+R(x)x^3\). Note that \(R(x)\) should be zero, but we'll just treat it formally for the moment. Steps one and two of the algorithm say that \(a_0=p(0)\). We can see that \(p(0)=3-2(0)+(0)^2=3,\) so \(a_0 = 3.\). The next step of the algorithm says we should solve for \(a_1\) in terms of \(x\) and take its limit as \(x\to0\). This looks like \begin{align*} a_1 &= \lim_{x\to0}\frac{p(x)-3-a_2x^2-R(x)x^3}{x}\\ &=\lim_{x\to0}\left(\frac{(3-2x+x^2)-3}{x}-a_2x-R(x)x^2\right)\\ &=\lim_{x\to0}(-2+x)\\ &=-2. \end{align*}

Ok, so now our polynomial approximation to \(p\) looks like \(3-2x+a_2x^2+R(x)x^3\). We repeat step 3 of the algorithm for \(a_2\): \begin{align*} a_2 &= \lim_{x\to0}\frac{p(x)-(3-2x+R(x)x^3)}{x^2}\\ &=\lim_{x\to0}\left(\frac{(3-2x+x^2)-(3-2x)}{x^2}-R(x)x\right)\\ &=\lim_{x\to0}\left(\frac{x^2}{x^2}\right)\\ &=1. \end{align*} This leaves our polynomial approximation looking like \(3-2x+x^2+R(x)x^3\). At this point we can see that \(p(x)-(3-2x+x^2)=0\) only if \(R(x)=0\).

Example: [ExponentialPolynomial] Find a polynomial approximate near \(x_0=0\) to the function given by \(\exp(x)=e^x.\)

We suppose that we know the value of \(e\), it is approximately \(2.718281828459045235360287\). We also know \(e^0=1\). We can do some numerical calculations using those numbers - we have no other way of attacking the problem at this stage. We suppose, as usual, that \(\exp(x)=a_0+a_1x+a_2x^2+R(x)x^3.\) Also as usual we find that \(a_0 = \lim_{x\to0}\exp(x)=\exp(0)=1.\) The next step is to evaluate \[\lim_{x\to0}a_1=\lim_{x\to0} \left(\frac{\exp(x)-1}{x}-a_2x-R(x)x^2\right).\] We don't really have any means of doing that analytically, but we can run some numerical experiments. Table 1 shows values of \(\frac{\exp(x)-1}{x}\) as \(x\) approaches zero, using 25-digit arithmetic. We see that the numbers appear to be approaching 1. We conclude that \[a_1=\lim_{x\to0}\frac{\exp(x)-1}{x}=1.\] It is no proof, but convincing nonetheless.

Table 1: Numbers illustrating \(\lim_{x\to0}\frac{\exp(x)-1}{x}=1\).

Now we do this again to find \(a_2.\) We have \[a_2 = \left(\frac{\exp(x)-1-x}{x^2}-R(x)x\right). \]

Table 2: Numbers illustrating \(\lim_{x\to0}\frac{\exp(x)-1-x}{x^2}=\frac12\).

It looks like this limit goes to \(\frac12\). We conclude that our numerical experiments show that \[\exp(x)\approx 1+x+\frac{x^2}2.\] Figure 1 illustrates this and shows the error. The exponential function is shown in blue; the quadratic is green.

Choose \(x_0\):

Figure 1: Polynomial approximation to \(\exp(x)\)