Converting to Power Series
The
ExpressionToUnivariatePowerSeries package provides operations for
computing series expansions of functions.
Evaluate this to compute the Taylor expansion of sin x about x=0. The first
argument, sin(x), specifies the function whose series expansion is to be
computed and the second argument, x=0, specifies that the series is to be
expanded in powers of (x-0), that is, in powers of x.
Here is the Taylor expansion of sin x about x=%pi/6:
The function to be expanded into a series may have variables other than the
series variable. For example, we may expand tan(x*y) as a Taylor series in x.
or as a Taylor series in y.
A more interesting function it (t*%e^(x*t))/(%e^t-1).
When we expand this function as a Taylor series in t the nth order
coefficient is the nth Bernoulli polynomial divided by n!.
Therefore, this and the next expression produce the same result.
Technically, a series with terms of negative degree is not considered to
be a Taylor series, but rather a Laurent series. If you try to compute a
Taylor series expansion of x/log(x) at x=1 via taylor(x/log(x),x=1) you
get an error message. The reason is that the function has a pole at x=1,
meaning that its series expansion about this point has terms of negative
degree. A series with finitely many terms of negative degree is called a
Laurent series. You get the desired series expansion by issuing this.
Similarly, a series with terms of fractional degree is neither a Taylor
series nor a Laurent series. Such a series is called a Puiseux series. The
expression laurent(sqrt(sec(x)),x=3*%pi/2) results in an error message
because the series expansion about this point has terms of fractional degree.
However, this command produces what you want.
Finally, consider the case of functions that do not have Puiseux expansions
about certain points. An example of this is x^x about x=0. puiseux(x^x,x=0)
produces an error message because of the type of singularity of the
function at x=0. The general function series
can be used in this case. Notice that the series returned is not, strictly
speaking, a power series because of the log(x) in the expansion.
The operation series returns the most general
type of infinite series. The user who is not interested in distinguishing
between various types of infinite series may wish to use this operation
exclusively.