]>
Book Contents Previous Section 1.9 Limits Next Section 1.11 Derivatives Book Index

## 1.10 Series

Axiom also provides power series. series:power By default, Axiom tries to compute and display the first ten elements of a series. Use )set streams calculate to change the default value to something else. For the purposes of this document, we have used this system command to display fewer than ten terms. For more information about working with series, see ugProblemSeries.

You can convert a functional expression to a power series by using the operation series. In this example, sin(a*x) is expanded in powers of (x-0), that is, in powers of x.

series(sin(a*x),x = 0)

a x-a 3 6 x 3+a 5 120 x 5-a 7 5040 x 7+a 9 362880 x 9-a 11 39916800 x 11+O(x 12)

Type: UnivariatePuiseuxSeries(Expression Integer,x,0)

This expression expands sin(a*x) in powers of (x - %pi/4).

series(sin(a*x),x = %pi/4)

a 2 sin(a π 4)2(x-π 4)2-a 3 cos(a π 4)6(x-π 4)3+ a 4 sin(a π 4)24(x-π 4)4+a 5 cos(a π 4)120(x-π 4)5- a 6 sin(a π 4)720(x-π 4)6-a 7 cos(a π 4)5040(x-π 4)7+ a 8 sin(a π 4)40320(x-π 4)8+a 9 cos(a π 4)362880(x-π 4)9- a 10 sin(a π 4)3628800(x-π 4)10+O((x-π 4)11)

Type: UnivariatePuiseuxSeries(Expression Integer,x,pi/4)

Axiom provides series:Puiseux Puiseux series: Puiseux series series with rational number exponents. The first argument to series is an in-place function that computes the n-th coefficient. (Recall that the ``+->'' is an infix operator meaning ``maps to.'')

series(n +-> (-1)**((3*n - 4)/6)/factorial(n - 1/3),x=0,4/3..,2)

x 4 3-1 6 x 10 3+O(x 5)

Type: UnivariatePuiseuxSeries(Expression Integer,x,0)

Once you have created a power series, you can perform arithmetic operations on that series. We compute the Taylor expansion of 1/(1-x). series:Taylor

f := series(1/(1-x),x = 0)

1+x+x 2+x 3+x 4+x 5+x 6+x 7+x 8+x 9+x 10+O(x 11)

Type: UnivariatePuiseuxSeries(Expression Integer,x,0)

Compute the square of the series.

f ** 2

1+2 x+3 x 2+4 x 3+5 x 4+6 x 5+7 x 6+8 x 7+9 x 8+10 x 9+11 x 10+O(x 11)

Type: UnivariatePuiseuxSeries(Expression Integer,x,0)

The usual elementary functions ( log, exp, trigonometric functions, and so on) are defined for power series.

f := series(1/(1-x),x = 0)

1+x+x 2+x 3+x 4+x 5+x 6+x 7+x 8+x 9+x 10+O(x 11)

Type: UnivariatePuiseuxSeries(Expression Integer,x,0)
g := log(f)

x+1 2 x 2+1 3 x 3+1 4 x 4+1 5 x 5+1 6 x 6+1 7 x 7+1 8 x 8+1 9 x 9+1 10 x 10+1 11 x 11+O(x 12)

Type: UnivariatePuiseuxSeries(Expression Integer,x,0)
exp(g)

1+x+x 2+x 3+x 4+x 5+x 6+x 7+x 8+x 9+x 10+O(x 11)

Type: UnivariatePuiseuxSeries(Expression Integer,x,0)

Here is a way to obtain numerical approximations of e from the Taylor series expansion of exp(x). First create the desired Taylor expansion.

f := taylor(exp(x))

1+x+1 2 x 2+1 6 x 3+1 24 x 4+1 120 x 5+1 720 x 6+1 5040 x 7+1 40320 x 8+1 362880 x 9+1 3628800 x 10+O(x 11)

Type: UnivariateTaylorSeries(Expression Integer,x,0)

Evaluate the series at the value 1.0. As you see, you get a sequence of partial sums.

eval(f,1.0)

[1.0,2.0,2.5,2.6666666666 666666667,2.7083333333 333333333,2.7166666666 666666667,2.7180555555 555555556,2.7182539682 53968254,2.7182787698 412698413,2.7182815255 731922399,…]

Type: Stream Expression Float
Book Contents Previous Section 1.9 Limits Next Section 1.11 Derivatives Book Index