5.36.3 Series expansion : series
series takes from one to four arguments :

an expression depending of a variable (by default x),
 an equality variable=value (e.g. x=a) where to compute
the series expansion, by default x=0,
 an integer n, the order of the series expansion,
by default 5
 a direction 1, 1 (for unidirectional series expansion)
or 0 (for bidirectional series expansion) (by default 0).
Note that the syntax ...,x,a,n,...
(instead of ...,x=a,n,...) is also accepted.
series returns a polynomial in xa, plus a remainder
of the form:
(xa)^
n*order_size(xa)
where order_size is a function such that,
∀ r>0,   x^{r} order_size(x) = 0 
The order returned by series may be smaller than n if
cancellations between numerator and denominator occur.
Examples :

series expansion in the vicinity of x=0
Find an series expansion of
x^{3}+sin(x)^{3}/x−sin(x)
in the vicinity of x=0.
Input :
series(x^
3+sin(x)^
3/(xsin(x)))
Output is only a 2ndorder series expansion :
6+27/10*x^2
+x^
3*order_size(x)
We have lost 3 orders because the valuation of the numerator and
denominator is 3. To get a 4th order expansion, we must therefore
take n=7.
Input :
series(x^
3+sin(x)^
3/(xsin(x)),x=0,7)
or :
series(x^
3+sin(x)^
3/(xsin(x)),x,0,7)
Output is a 4thorder series expansion :
6+27/10*x^
2+x^
3+711/1400*x^
4+
x^
5*order_size(x)
 series expansion in the vicinity of x=a
Find a series 4thorder expansion of cos(2x)^{2} in the vicinity of
x=π/6.
Input:
series(cos(2*x)^
2,x=pi/6, 4)
Output :
1/4+((4*sqrt(3)))/4*(xpi/6)+(4*34)/4*(xpi/6)^
2+ 32*sqrt(3)/3/4*(xpi/6)^
3+(16*3+16)/3/4*(xpi/6)^
4+ (xpi/6)^
5*order_size(xpi/6)
 series expansion in the vicinity of x=+∞ or x=∞

Find a 5thorder series expansion of arctan(x) in the vicinity of
x=+∞.
Input :
series(atan(x),x=+infinity,5)
Output :
pi/21/x+1/3*(1/x)^
3+1/5*(1/x)^
5+
(1/x)^
6*order_size(1/x)
Note that the expansion variable and the argument of the
order_size function is
h=1/x →_{x→ + ∞} 0 .
 Find a series 2ndorder expansion of (2x−1)e^{1/x−1} in the vicinity of
x=+∞.
Input :
series((2*x1)*exp(1/(x1)),x=+infinity,3)
Output is only a 1storder series expansion :
2*x+1+2/x+(1/x)^
2*order_size(1/x)
To get a 2ndorder series expansion in 1/x, input:
series((2*x1)*exp(1/(x1)),x=+infinity,4)
Output :
2*x+1+2/x+17/6*(1/x)^
2+(1/x)^
3*order_size(1/x)
 Find a 2ndorder series expansion of (2x−1)e^{1/x−1} in the vicinity
of x=∞.
Input :
series((2*x1)*exp(1/(x1)),x=infinity,4)
Output :
2*(x)+12*(1/x)+17/6*(1/x)^
2+
(1/x)^
3*order_size(1/x)
 unidirectional series expansion.
The fourth parameter indicates the direction :

1 to do an series expansion in the vicinity of x=a with
x>a,
 1 to do an series expansion in the vicinity of x=a with
x<a,
 0 to do an series expansion in the vicinity of x=a with
x ≠ a.
For example,
find a 2ndorder series expansion of (1+x)^{1/x}/x^{3} in
the vicinity of x=0^{+}.
Input :
series((1+x)^
(1/x)/x^
3,x=0,2,1)
Output :
exp(1)/x^
3+((exp(1)))/2/x^
2+1/x*order_size(x)