Power Series from Formulas

The GenerateUnivariatePowerSeries package enables you to create power series from explicit formulas for their nth coefficients. In what follows, we construct series expansions for certain transcendental functions by giving forumulas for their coefficients. You can also compute such series expansions directly by simply specifying the function and the point about which the series is to be expanded. See Converting to Power Series for more information. Consider the Taylor expansion of %e^x about x=0:
  %e^x = 1 + x + x^2/2 + x^3/6 + ... 
       = sum from n=0 to n=%infinity of x^n/n!
The nth Taylor coefficient is 1/n!. This is how to create this series in Axiom. The first argument specifies the formula for the nth coefficient by giving a function that maps n to 1/n!. The second argument specifies that the series is to be expanded in powers of (x-0), that is, in powers of x. Since we did not specify an initial degress, the first term in the series was the term of degree 0 (the constant term). Note that the formula was given as an anonymous function. These are discussed in Anonymous Functions Consider the Taylor expansion of log x about x=1:
 log x = (x-1) - (x-1)^2/2 + (x-1)^3/3 - ... 
       = sum from n=1 to n=%infinity of (-1_^(n-1) (x-1)^n/n
If you were to evaluate the expression series(n+->(-1)^(n-1)/n,x=1) you would get an error message because Axiom would try to calculate a term of degree n=1,... are to be computed. Next consider the Taylor expansion of an odd function, say, sin(x):
  sin x = x = x^2/3! + x^5/5! - ...
Here every other coefficient is zero and we would like to give an explicit formula onloy for the odd Taylor coefficients. This is one way to do it. The third argument, 1.., specifies that the first term to be computed is the term of degree 1. The fourth argument, 2, specifies that we increment by 2 to find the degrees of subsequent terms, that is, the next term is of degree 1+2, the next of degree 1+2+2, etc. The initial degree and the increment do not have to be integers. For example, this expression produces a series expansion of sin(x^(1/3)). While the increment must be positive, the initial degree may be negative. This yields the Laurent expansion of csc(x) at x=0. Of course, the reciprocal of this power series is the Taylor expansion of sin(x). As a final example, here is the Taylor expansion of asin(x) about x=0. When we compute the sine of this series, we get x (in the sense that all higher terms computed so far are zero). As we discussed in Converting to Power Series, you can also use the operations taylor, laurent, and puiseux, instead of series if you know ahead of time what kind of exponents a series has. You can't go wrong with series though.