Introduction Classroom Tips and Techniques: Series Expansions Robert J. Lopez Emeritus Professor of Mathematics and Maple Fellow Maplesoft Maple has the ability to provide various series expansions and their truncations, as well as complete formal series for a variety of elementary and special functions. In this month's article, we examine the relevant commands and interface devices that access these functionalities. The Series Construct In Maple, the output of the taylor command appears to be a polynomial to which a "big Oh" term has been attached. The series command produces a generalized series expansion that could be a Taylor or Laurent series, or a more general series. In particular, the results of these commands can be seen in Table 1. Table 1 Application of taylor and series commands to In Table 1, the output of the taylor command is not just a polynomial to which has been added. It is a special series construct that can be converted to a polynomial with the convert command, as in The default value of the Order variable in Maple is 6. It can be changed by assigning it another integer value. However, it can also be temporarily (i.e., locally) changed inside either of the taylor or series commands by simply including an integer as a third argument. For example,
Order can be set temporarily to 7 as follows. This output suggests that care should be taken in interpreting the "big Oh" term produced by these commands. The outputs in Table 1 are technically correct in that they indicate the remainder term is "big Oh" of to the power of Order. In fact, the remainder terms in Table 1 are, that is, "little oh" of. Thus, the commands in Table 1 do not produce the tight bound that would apply if some form of the remainder were analytically examined for its true order. The situation is further compounded by the Maple "remember table," an internal table that stores certain calculations to reduce the time it takes to access the calculation again. We see the effect of this table in the following calculation. The second time the command is called with the default value of Order, namely, six, the remember table comes into play, and now, Maple indicates that the remainder term is. The contents of the remember table can be emptied with the forget command, as in Thus, it is useful to think in terms of "series order" as an integer that Maple uses to keep track of the truncation of a series, and it is not necessarily the precise analytic order of the remainder term. Moreover, it is clearly not the degree of the truncated polynomial obtained after converting to a polynomial. It is unfortunate that Maple uses "order" in many places where "degree" would be the more appropriate term or construct. When the output of the series command contains fractional exponents, it is not the special series construct, but rather, an expression in the form of a sum of products to which the "big Oh" term has been added. The "big Oh" term can be removed by the same convert option that works for the output of the taylor command. Interfaces to the taylor and series Commands The series command can be accessed directly, as in Table 1, or from the Context Menu. The taylor command can be accessed directly, as in Table 1, from several Task Templates, or from
the TaylorApproximation command in the Student Calculus 1 package. Figure 1 shows the dialog that results from selecting Series Series from the Context Menu applied to an expression such as or, the BesselJ function of index. Figure 1 Series option in the Context Menu The term "Series order" is the value that will be assigned to the Order option or variable. If the "Truncate to polynomial" checkbox is checked, a polynomial of degree at least one less than "Series order" will result. Figure 2 shows the Taylor Approximation tutor with its default settings. The default function is and the default "series order" is four. The TaylorApproximation command shown at the bottom of the tutor provides a Taylor polynomial as an approximation to the input function, but Maple declares this polynomial approximation to be of "order," that is, of "series order," rather than of "degree." The TaylorApproximation command is merely an interface to the underlying taylor command.
Figure 2 Taylor Approximation tutor accessing the TaylorApproximation command Table 2 provides the path to a Task Template that invokes the TaylorApproximation command and/or launches the Taylor Approximation tutor. The syntax for implementing the TaylorApproximation command is provided by this Task Template. Note that the local setting of the Order variable must be done in the form of an equation whose left-hand side is the word "order." As in Figure 2, "order" means the degree of the resulting polynomial, a usage that conflicts with that of the underlying taylor command. Tools Tasks Browse: Calculus Taylor Approximation of a Univariate Function Taylor Approximation Calculate the Taylor approximation of a specified degree for a univariate function. Enter the function as an expression. Specify the order, and then calculate the Taylor approximation.
Alternatively, you can use the Taylor Approximation tutor, a point-and-click interface. There are two ways to launch this tutor. From the Tools menu, select Tutors, Calculus - Single Variable, and then Taylor Approximation. Enter the function in one variable to be approximated below, then click the following Taylor Approximation button. Table 2 The Task Template "Taylor Approximation of a Univariate Function Pressing the "Taylor Approximation" button will launch the Taylor Approximation tutor pre-loaded with the function in the box to the right of the button. Alternatively, if the Student Calculus 1 package is first loaded into Maple's memory, the Context Menu for an expression will contain the option "Tutors" from which the Taylor Approximation tutor can be selected. This would be more direct than accessing the tutor from the Task Template.
Table 3 provides the path to a Task Template that invokes the taylor command and provides an interactive tool for obtaining Taylor expansions and polynomials. It is possible to access just this tool, which in turn provides access to the Taylor Approximation tutor. Tools Tasks Browse: Calculus Taylor Expansion and Polynomials Taylor Polynomial for a Univariate Function Calculate the Taylor expansion for a univariate function about a specified point and up to a specific order. Enter the function as an expression: Specify an expansion point and an expansion order, and then calculate the Taylor series: Alternatively, you can use the following interface to calculate the Taylor expansion and Taylor polynomial: Enter the function: Taylor Expansions and Polynomials Degree: Base-Point:
Table 3 The "Taylor Expansion and Polynomials" Task Template For both the series expansion and the Taylor polynomial, the degree of the polynomial is governed by the "Degree" option. If no base-point is provided, the tool assumes. Launching the tutor from this tool loads the function and the base-point, but not the desired degree. Closing the tutor places its graph into the graphing window of the tool. Laurent Series The Laurent series can be obtained with the series command, or with the laurent command from the numapprox package. Usage is illustrated in Table 4.
Table 4 The Laurent series via the series and laurent commands Asymptotic Series Asymptotic power series, even series with fractional powers, can be obtained in any of the four ways listed in Table 5. Table 5 Asymptotic power series
From Table 5 we see that the series, taylor, and asympt commands can all be used to generate asymptotic power series, even series with fractional powers. The asympt command assumes that the expansion point is the point at infinity. Both the taylor and series commands need to be told that the expansion point is at infinity. It is even possible to obtain an asymptotic expansion by changing variables so, expanding about, and restoring via. An asymptotic power series, even one with fractional powers, is available through the Context Menu, under the option Series Asymptotic Series. The resulting dialog, shown in Figure 3, suggests it is possible to obtain an asymptotic power series interactively, either as a series construct or as a truncated expansion. Figure 3 Dialog for Context Menu option: Series Asymptotic Series Unfortunately, Maple does not have a function for generating an asymptotic series with respect to an arbitrary asymptotic basis. However, if is an asymptotic sequence as, then the coefficients in the expansion can be obtained recursively via Multivariate Series The mtaylor command is used to generate a Taylor polynomial for a multivariate function. For example, the Taylor expansion of, taken about, would be of the form
Table 6 contains the expansion of at the point. Table 6 Multivariate Taylor expansion of Even though Maple does not have a series construct for the multivariate case, the notion of "series order" is used to determine the degree of the resulting polynomial. Unfortunately, this results in a polynomial of total degree one less than the "series order" used as a parameter in the mtaylor command. Because there is no "series construct" for the multivariate case, Maple does not tack on an order term for expansions generated by the mtaylor command. Because of this, I can recall that colleagues at RHIT would teach their students only about the mtaylor command, even in single-variable calculus. This would avoid the need to follow up with the "convert-to-polynom" step, thereby lessening the syntax burden in the days when all Maple calculations were dependent on knowing the appropriate commands. Interfaces to the mtaylor Command Figure 4 shows the Taylor Approximation tutor from the Student Multivariate Calculus package.
Figure 4 Multivariate Calculus Taylor Approximation tutor The first-degree Taylor polynomial for the function, taken at is obtained in Figure 4. In addition, a graph of the function and the Taylor polynomial is drawn. The graph of the first-degree Taylor polynomial is the graph of the tangent plane. At the bottom of the tutor, the TaylorApproximation command can be seen. The syntax of this command contrasts to that of the mtaylor command and to the similarly named command from the Calculus 1 package. Note in particular how the expansion point is expressed, and note that the explicit use of the equation "order = 1" is not required. In the absence of the "output = plot" parameter, the expression for the Taylor polynomial would be returned. Finally, note that both the command and the tutor use "Order" to mean "degree." Given that there is no "series construct" in the multivariate case, and given that both the command and the tutor specifically reference "Approximation," it's striking that the notion of "series order" is used, and used where "degree" would be more appropriate. Table 7 shows the path to a Task Template that provides access to the Taylor Approximation command and tutor. Tools Tasks Browse: Multivariate Calculus Taylor Approximation of a Multivariate Function Taylor Approximation of a Multivariate Function
Calculate the Taylor approximation of a specified degree for a multivariate function. Enter the function. Specify an expansion point and order, and then calculate the Taylor approximation. Alternatively, you can use the Taylor Series tutor, a point-and-click interface. There are two ways to launch this tutor. From the Tools menu, select Tutors, Calculus - Multi-Variable and then Taylor Series. Enter a multivariate function below, then click the following Taylor Series button. Table 7 The Task Template "Taylor Approximation of a Multivariate Function"
Again, if the Student Multivariate Calculus package is loaded, the Context Menu for an expression will contain the option "Tutors," from which the Taylor Approximation tutor can be selected. This proves to be a more efficient connection to the tutor than the Task Template. Formal Power Series Maple has two separate processes for producing the complete formal power series for. Each is accessed as an option to the convert command, but even though it looks like there is a common interface, the underlying approaches to obtaining the formal power series are different. In most cases, either process will work, but there are functions for which just one will succeed in finding the desired series. Table 8 illustrates the two relevant functionalities. Table 8 Obtaining complete formal power series in Maple It should be obvious from Table 8 that two different functionalities have been activated. In the result on the right, the summation index can be declared by the user, as we show in the following calculation. The Context Menu provides the option Series Formal Power Series. The dialog that appears in shown in Figure 5. Figure 5 Dialog for the Context Menu option: Series Formal Power Series
From Figure 5, it should be clear that even from the Context Menu it is possible to declare the summation index in the formal power series returned. Finally, note that one can obtain a complete formal asymptotic power series, as illustrated in Table 9. Table 9 Complete formal asymptotic power series Legal Notice: Maplesoft, a division of Waterloo Maple Inc. 2009. Maplesoft and Maple are trademarks of Waterloo Maple Inc. This application may contain errors and Maplesoft is not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact Maplesoft for permission if you wish to use this application in for-profit activities.