series

Taylor series expansion of a symbolic expression.

Category: Mathematics > Calculus

Syntax

s = series(f, x)

Expansion of f around x = 0 up to the default order 6.

s = series(f, x, a)

Expansion around the point a.

s = series(f, x, a, 'Order', n)

Truncates the expansion before the term of order n.

Description

The series is the polynomial whose derivatives at a match those of f: cos(x) around 0 gives 1 - x^2/2 + x^4/24 - .... With 'Order', 6, terms up to x^5 are kept. The result does not carry an O(x^6) term; it is an ordinary polynomial that can be evaluated with subs.

Input arguments

f
Symbolic expression.
x
Expansion variable.
a
Expansion point, 0 by default.
n
Number of terms; terms of degree n and above are dropped.

Output arguments

s
Polynomial in x - a that approximates f near a.

Example

Cosine and exponential

syms x
series(cos(x), x, 'Order', 6)
series(exp(x), x, 1, 'Order', 3)
Output
ans = x^4/24 - x^2/2 + 1
ans = ((x - 1)^2*exp(1))/2 + (x - 1)*exp(1) + exp(1)

See also

taylor limit pade diff subs