Quantcast

Documentation Center

  • Trial Software
  • Product Updates

mtaylor

Compute a multivariate Taylor series expansion

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

mtaylor(f, x = x0, <order>, <mode>, <weights>, <NoWarning>, <Mapcoeffs = mc>)
mtaylor(f, x, <order>, <mode>, <weights>, <NoWarning>, <Mapcoeffs = mc>)
mtaylor(f, x = x0, AbsoluteOrder = order, <weights>, <NoWarning>, <Mapcoeffs = mc>)
mtaylor(f, x = x0, RelativeOrder = order, <weights>, <NoWarning>, <Mapcoeffs = mc>)
mtaylor(f, [x = x0, y = y0, …], <order>, <mode>, <weights>, <NoWarning>, <Mapcoeffs = mc>)
mtaylor(f, [x, y, …], <order>, <mode>, <weights>, <NoWarning>, <Mapcoeffs = mc>)
mtaylor(f, [x = x0, y = y0, …], <AbsoluteOrder = order>, <weights>, <NoWarning>, <Mapcoeffs = mc>)
mtaylor(f, [x = x0, y = y0, …], RelativeOrder = order, <weights>, <NoWarning>, <Mapcoeffs = mc>)

Description

mtaylor(f, [x = x0, y = y0, ...]) computes the first terms of the multivariate Taylor series of f with respect to the variables x, y etc. around the points x = x0, y = y0 etc.

With the default mode RelativeOrder, the number of requested terms for the expansion is determined by order if specified. If no order is specified, the value of the environment variable ORDER is used. You can change the default value 6 by assigning a new value to ORDER.

The terms are counted from the lowest total degree on for finite expansion points, and from the highest total degree term on for expansions around infinity.

If AbsoluteOrder is specified, order represents the truncation order of the series, i.e., no terms of total degree order or higher are computed.

For infinite expansion points, the absolute values of the exponents of the corresponding variables are used to compute the total degree.

For finite expansion points x0, y0, ..., the computed series with respect to the variables x, y, ... of weight w1, w2, ... is

taylor(f(x0 + t^w1*(x - x0), y0 + t^w2*(y - y0), dots), t = 0),

evaluated at the point t = 1.

Environment Interactions

The function is sensitive to the environment variable ORDER, which determines the default number of terms in series computations.

Examples

Example 1

We compute a Taylor series around the origin (default). The expansion contains all terms through total degree 3:

mtaylor(exp(x^2 - y), [x, y], 4)

We request additional terms of higher order:

mtaylor(exp(x^2 - y), [x, y], 5)

In the example above, the leading term is of total degree 0. In the following example, the leading term is of total degree 2. Thus, the default mode RelativeOrder produces terms of total degree smaller than4 + 2 = 6:

mtaylor(x*y*exp(x^2 - y), [x, y], 4)

We request an absolute truncation order of 4, so that only terms of total degree smaller than 4 are computed:

mtaylor(x*y*exp(x^2 - y), [x, y], AbsoluteOrder = 4)

Example 2

For infinite expansions points a series in the reciprocal of the variable is returned:

mtaylor(exp(z)/(x - y), [x = infinity, y = 0, z])

We reduce the order in z by giving z a higher weight:

mtaylor(exp(z)/(x - y), [x = infinity, y = 0, z], [1, 1, 2])

Example 3

A Taylor series expansion of around x = 1, y = 1 does not exist. Therefore, mtaylor responds with an error message:

mtaylor(1/(x*y - 1), [x = 1, y = 1])
Error: Cannot compute a Taylor expansion of '1/(x*y - 1)'. [mtaylor]

Example 4

If a Taylor series expansion cannot be computed, then the function call is returned symbolically:

mtaylor(y/exp(x^a), [x = 0, y = 1])

Example 5

This is an example of a directed Taylor expansion along the real axis around x = infinity:

mtaylor(sqrt(y)*sin(sqrt(y)/x), [x = infinity, y = 0])

In fact, this is even an undirected expansion:

mtaylor(sqrt(y)*sin(sqrt(y)/x), [x = complexInfinity, y = 0])

Example 6

A common problem in symbolic calculations is "expression swell:" Intermediate expressions which are not or cannot be simplified lead to unnecessarily complicated results. The following is an example of such behavior:

mtaylor((a+x)^n, x, 4)

In general, applying simplify or Simplify to complicated results is a strategy that often helps. In this case, however, it would destroy the format of the series:

simplify(%)

What is required is a way to map a function like simplify to the coefficients of the series only. Since mtaylor returns an ordinary expression, this must be done in the mtaylor call itself, using the Mapcoeffs option:

mtaylor((a+x)^n, x, 4, Mapcoeffs=simplify)

Parameters

f

An arithmetical expression representing a function in x, y, ...

x, y, …

identifiers or indexed identifiers

x0, y0, …

The expansion points: arithmetical expressions. Also expressions involving infinity or complexInfinity are accepted.

If not specified, the default expansion point 0 is used.

order

The truncation order (in conjunction with AbsoluteOrder) or, in conjunction with RelativeOrder, the number of terms to be computed, respectively. A nonnegative integer; the default order is given by the environment variable ORDER (default value 6).

The order concept refers to the total degree in the variables (the sum of all exponents).

mode

One of the flags AbsoluteOrder or RelativeOrder. The default is RelativeOrder.

weights

A list of positive integers determining the number of terms of the computed series. A variable x with weight w contributes as x^w to the total degree of the terms in the series. Thus, using weight 2 for x, halves the order in x to which the series is computed.

By default, all variables have the weight 1.

Options

AbsoluteOrder

With this flag, the integer value order is the truncation order of the computed series, i.e., only terms of total degree less than order are present.

RelativeOrder

With this flag, the terms in the computed series range from some leading total degree v to the highest total degree v + order - 1 (i.e., the truncation order w.r.t. the total degree is v + order).

NoWarning

Supresses warning messages printed during the series computation. This can be useful if mtaylor is called within user-defined procedures.

Mapcoeffs

Option, specified as Mapcoeffs = mc

When building the resulting expression, for each coefficient c, insert mc(c) instead.

Return Values

Arithmetical expression.

Overloaded By

f

See Also

MuPAD Functions

Related Examples

Was this topic helpful?