One use of series is to find the Taylor series expansion of a function. Recall that the Taylor series of a function \(f(x)\) centred at \(x=a\text{,}\) is the sum
In Maple, the taylor() command outputs the first few terms of the Taylor series. It uses βbig Oβ notation as a placeholder to represent the remaining terms of higher degree. The number of terms displayed may be specified. In this example, we can see the Taylor series expansion of \(f(x)=sin(x)\) centred at \(x=5\text{,}\) with terms up to (but not including) degree four.
The first \(n\) terms of a Taylor series is known as an \(n\)th degree Taylor polynomial approximation of \(f(x)\text{.}\) Depending on the convergence of the series, this polynomial approximation will have a very similar shape to the function in an interval centred at \(x=a\text{.}\) The convert() command can be used to eliminate higher terms of the series and give a Taylor polynomial of a desired degree.
The function \(f(x)=e^x\) has a very simple pattern with its higher derivatives, particularly evaluated at \(x=0\text{,}\) so it provides for a very simple example of a Maclaurin series. Since a Maclaurin series is a Taylor series centred at \(a=0\text{,}\) we must specify \(x=0\) in the taylor() command.
By default, Maple has given \(7\) terms as an output here. The \(O(x^6)\) term in this expression means "plus a bunch more terms with power \(6\) and higher". We can specify the order (related to number of terms) of the Taylor series by adding a number as the final argument to the command.
Example17.2.Comparing a Function to its Taylor Polynomial.
We can see how closely the a Taylor polynomial resembles the original function by plotting them on the same axes. In this example, we will compare the graph of \(f(x)=\sin(x)\) to its Taylor polynomial approximation centred at \(x=0\text{.}\)
To begin, we construct the Taylor series expansion of \(\sin(x)\text{,}\) which will output the series using βbig Oβ notation. This needs to be converted to a polynomial with finitely many terms. The convert() command lets Maple know that we wish for the
Now that we have assigned a name to the Taylor polynomial, it can be plotted alongside \(\sin(x)\) to see how the shape of the Taylor polynomial expression converges to the function around \(x=0\text{.}\)