Series Expansion

In this lesson, we will learn about Taylor series and formal power series.

Taylor series

SymPy expressions can be expanded as Taylor series using the series() function from the SymPy module.

Taylor series about x=ax=a is given by:

f(x)=n=0f(n)an!(xa)nf(x)=\sum_{n=0}^{\infty}\frac{f^{(n)}a}{n!}(x-a)^n

where f(n)f^{(n)} is the nthn^{th} derivative of ff.

For a generic expansion, we only need to specify the expression and the variable in the expansion for which the expression is to be expanded.

series(f(x), x)

or

f(x).series(x)

Let’s see a basic implementation of the series() function below:

Get hands-on with 1200+ tech skills courses.