Skip to content

Function expansions and series

goodok edited this page Mar 10, 2011 · 22 revisions

In order to clarify the discussions about Taylor series and asymptotic expansions, it is necessary to define the relevant concepts as precisely as possible.

Definitions

Sympy makes a sharp distinction between expressions and functions. In the following, whenever something is defined for a function (f), there's an equivalent definition applying to the expression (f(x)).

Series

In this section we attract attention to the structure of finite or infinite series.

The term formal which is used below for series usually means that "Historically, mathematicians such as Leonhard Euler operated liberally with infinite series, even if they were not convergent. When calculus was put on a sound and correct foundation in the nineteenth century, rigorous proofs of the convergence of series were always required. However, the formal operation with non-convergent series has been retained in rings of formal power series which are studied in abstract algebra." In other words, operations with formal series depend only upon the coefficients, the basis, not upon (X) itself, so (X) is a formal parameter. ( They can be depend of (X) nature: complex, real and so on.)

A Series is the sum of the terms of a sequence. Finite sequences and series have defined first and last terms, whereas infinite sequences and series continue indefinitely. The terms of the series are often produced according to a certain rule, such as by a formula, or by an algorithm. Remark about context: When talking about series, one can refer either to the sequence (S_N) of the partial sums, or to the result - the sum of the series.

A formal power series is an object of the form (S = \sum_{n=0}^{+\infty} a_n X^n) where (X) is a formal parameter. The set of formal power series over a field (K) is noted (KX) and has a ring structure.

A classical Laurent series is an object of the form (\sum_{n=+\infty}^{+\infty} a_n X^n).

A generalized formal power series, or formal Laurent series, in an object (S) such that (X^n S) is a formal power series for some integer (n). The set of formal Laurent series over a field (K) is noted (K((X))) and has a field structure.

A Laurent polynomial in one variable over a field (F) is a linear combination of positive and negative powers of the variable with coefficients in (F). Laurent polynomials in (X) form a ring denoted (F [X, X−1] ). They differ from ordinary polynomials in that they may have terms of negative degree. A Laurent polynomial over C may be viewed as a Laurent series in which only finitely many coefficients are non-zero.

The Taylor series at (x_0) of a smooth function (f) is the formal power series (TS_{x_0}(f) = \sum_{n = 0}^\infty \frac{f^{(n)}(x_0)}{n!} X^n). where (X = x-x_0) (f) is analytic iff there exists a neighbourhood (V) of (x_0) where (f(x) = S(x-x_0), x \in V, S = TS_{x_0}(f)).

The n-th order Taylor polynomial of f at (x_0) is the degree-n polynomial (TP_{n, x_0}(f) = \sum_{n = 0}^n \frac{f^{(k)}(x_0)}{k!} X^k). If f is analytic, (TP_{n, x_0}(f)) is the degree-n truncation of (TS_{x_0}(f)).

Unclassified series

( \sqrt{\sin(x)} = x^{\frac{1}{2}} - \frac{x^{\frac{5}{2}}}{12} + \frac{x^{\frac{9}{2}}}{1440} + \cdots )

( x^x = 1 + x \log x + \frac{x^2 \log^2(x)}{2} + \cdots )

Asymptotic expansion

In this section we attract attention to the asymptotic expansion and related things.

f is dominated by g at (x_0), written (f = O_{x_0}(g)), if (f/g) is bounded at (x_0). Similarly, (f(x) = O_{x \rightarrow x_0}(g(x))) if (f = O_{x_0}(g)), i.e. if (f(x)/g(x)) is bounded for (x) going to (x_0). Note that (\cdot = O_\cdot(\cdot)) is a purely notational device here, not an equality.

The set of functions dominated by a function (g) at (x_0), (O_{x_0}(g)) is defined by (f \in O_{x_0}(g)) if (f = O_{x_0}(g)). (h + O(g)) is a set of functions defined in the usual way: (h + O(g) = {h+\alpha ; \alpha \in O(g)}). It is called an asymptotic expansion of f if (f \in h + O(g)).

Asymptotic series, otherwise asymptotic expansions, are infinite series whose partial sums become good approximations in the limit of some point of the domain (to a given function as the argument of the function tends towards a particular, often infinite, point). In general they do not converge.

The n-th order Taylor expansion of f at (x_0) is (TP_{n, x_0}(f)(x-x_0) + O_{x \rightarrow x_0}((x-x_0)^{n+1}))

Generating function

This section is not really related with expansion but related with series. Roughly speaking, it is inversion of asymptotic series goals: while we have infinite number of coefficients of series then we obtain some function which is generated by them.

"However such interpretation is not required to be possible, because formal power series are not required to give a convergent series when a nonzero numeric value is substituted for x. Also, not all expressions that are meaningful as functions of x are meaningful as expressions designating formal power series; negative and fractional powers of x are examples of this. Generating functions are not functions in the formal sense of a mapping from a domain to a codomain; the name is merely traditional, and they are sometimes more correctly called generating series."

The ordinary generating function of a sequence (a_n) is ( G(a_n;x) = \sum_{n=0}^{+\infty} a_n x^n).

The exponential generating function of a sequence (a_n) is ( EG(a_n;x) = \sum_{n=0}^{+\infty} a_n \frac{x^n}{n!}).

Usage and applications

Series

  • In some cases it is easier to work with series, while processing with original function is difficult or impossible symbolically.
  • One can use formal power series to prove several relations familiar from analysis in a purely algebraic setting.
  • Some ODE can be solved by consideration of the desired result as formal series. Some recurrence formula for series coefficients can be obtained.
  • limits

Asymptotic expansion

  • Asymptotic expansions through series is used for approximation of functions. In some cases it is easier to work with truncated series, while processing with original function is difficult or impossible.
  • Some ODE, Integral equations can be solved by consideration of the desired result as asymptotic expansions.

Generating function

  • Find a closed formula for a sequence given in a recurrence relation.
  • Find recurrence relations for sequences — the form of a generating function may suggest a recurrence formula.
  • Define function through sequence.
  • Discrete representation of function.

Common tasks

  • Calculate items of sequences by recurrent formula

Current situation

  • According to its docstring, f(x).series(x, x0, n) is supposed to return the (n-1)th order generalized Taylor expansion of (f(x)) for (x \rightarrow x_0). Actually, it works only for (x_0 = 0) and when f doesn't have a generalized Taylor expansion, it returns some arbitrarily chosen asymptotic expansion of (f(x)).

  • But the present method "series" which returns various kinds of series is convenient and used for the task of limits processing: limits use necessary amount of first terms of series whatever it be. The work with processing of many various cases of series and limits was executed recently, also many tests have been collected and passed for series and limits.

  • Class Function , exp sin and others contain method taylor_term.

  • general algorithm for series() and nseries() consist in that the operations with asymptotic expansion used through recursion: F.e: ((sin(x))^1000 ).series() = (1 + x^{\frac{3}{6}} + O(x**4))^1000.

  • There is an object Sum defined in sympy, which represent unevaluated summation ( \sum_{k=a}^b a(n) ).

  • sympy/solvers/recurr.py contains some methods for solving recurrences, main function on this module is rsolve().

  • The implementation of some series methods for solving IDEs is processing now in Saptarshi's branch (https://github.com/saptman/sympy/tree/dev_ide ).

problems and remarks which we encounter

  • Problems with big O representation and behaviour at non zero point or oo.
  • representation of Derivative of function at some (no zero) point.
  • Not effective algorithm in some cases: now is used that: (cos(x)*(sin(x)).series() = sin(x).series() * cos(x).series(), lseries.next() calculate the nseries(n) every time (f.e. fifth next() calculate nseries(5) and after this yield fifth term)

Open questions and future topics

  • what is exp(1/x).series(x, oo) - classical Laurent or power series at point oo?
  • multivariable extension.
  • complex numbers, non commutative formal variables.
  • convergence
Clone this wiki locally