Compute Generalized Series

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

The Taylor series expansion is the most common way to approximate an expression by a polynomial. However, not all expressions can be represented by Taylor series. For example, you cannot compute a Taylor series expansion for the following expression around x = 2:

taylor(1/(x^3 - 8), x = 2)
Error: Unable to compute Taylor expansion of '1/(x^3 - 8)'. Try 'series' for a more general expansion. [taylor]

If a Taylor series expansion does not exist for your expression, try to compute other power series. MuPAD® provides the function series for computing power series. When you call series, MuPAD tries to compute the following power series:

  • Taylor series

  • Laurent series

  • Puiseux series. For more information, see Series::Puiseux.

  • Generalized series expansion of f around x = x0. For more information, see Series::gseries.

As soon as series computes any type of power series, it does not continue computing other types of series, but stops and returns the result. For example, for this expression it returns a Laurent series:

S := series(1/(x^3 - 8), x = 2);
testtype(S, Type::Series(Laurent))

When computing series expansions, MuPAD returns only those results that are valid for all complex values of the expansion variable in some neighborhood of the expansion point. If you need the expansion to be valid only for real numbers, use the option Real. For example, when you compute the series expansion of the following expression for complex numbers, series returns:

series(sign(x^2*sin(x)), x = 0)

When you compute the series expansion for real numbers, series returns a simplified result:

series(sign(x^2*sin(x)), x = 0, Real)

Along the real axis, compute series expansions for this expression when x approaches the value 0 from the left and from the right sides:

series(sign(x^2*sin(x)), x = 0, Left);
series(sign(x^2*sin(x)), x = 0, Right)