% Copyright The Numerical Algorithms Group Limited 1991. % Certain derivative-work portions Copyright (C) 1988 by Leslie Lamport. % All rights reserved % Title: Series % Address comments and questions to the % Computer Algebra Group, Mathematical Sciences Department % IBM Thomas J. Watson Research Center, Box 218 % Yorktown Heights, New York 10598 USA % Author: Clifton J. Williamson % Date created: 2 November 1989 % Date last updated: 2 November 1989 \begin{page}{ExSeriesConvert}{Converting Expressions to Series} \beginscroll You can convert a functional expression to a power series by using the function 'series'. Here's an example: \spadpaste{series(sin(a*x),x = 0)} This causes {\em sin(a*x)} to be expanded in powers of {\em (x - 0)}, that is, in powers of {\em x}. You can have {\em sin(a*x)} expanded in powers of {\em (a - \%pi/4)} by issuing the following command: \spadpaste{series(sin(a*x),a = \%pi/4)} \endscroll \autobuttons\end{page} \begin{page}{ExSeriesManipulate}{Manipulating Power Series} \beginscroll Once you have created a power series, you can perform arithmetic operations on that series. First compute the Taylor expansion of {\em 1/(1-x)}: \spadpaste{f := series(1/(1-x),x = 0) \bound{f}} Now compute the square of that series: \spadpaste{f ** 2 \free{f}} It's as easy as 1, 2, 3,... \endscroll \autobuttons\end{page} \begin{page}{ExSeriesFunctions}{Functions on Power Series} \beginscroll The usual elementary functions ({\em log}, {\em exp}, trigonometric functions, etc.) are defined for power series. You can create a power series: % Warning: currently there are (interpretor) problems with converting % rational functions and polynomials to power series. \spadpaste{f := series(1/(1-x),x = 0) \bound{f1}} and then apply these functions to the series: \spadpaste{g := log(f) \free{f1} \bound{g}} \spadpaste{exp(g) \free{g}} \endscroll \autobuttons\end{page} \begin{page}{ExSeriesSubstitution}{Substituting Numerical Values in Power Series} \beginscroll Here's a way to obtain numerical approximations of {\em e} from the Taylor series expansion of {\em exp(x)}. First you create the desired Taylor expansion: \spadpaste{f := taylor(exp(x)) \bound{f2}} Now you evaluate the series at the value {\em 1.0}: % Warning: syntax for evaluating power series may change. \spadpaste{eval(f,1.0) \free{f2}} You get a sequence of partial sums. \endscroll \autobuttons\end{page}