[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 31. Series

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 31.1 Introduction to Series

Maxima contains functions `taylor` and `powerseries` for finding the series of differentiable functions. It also has tools such as `nusum` capable of finding the closed form of some series. Operations such as addition and multiplication work as usual on series. This section presents the global variables which control the expansion.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 31.2 Definitions for Series

Option variable: cauchysum

  Default value: `false`

  When multiplying together sums with `inf` as their upper limit, if `sumexpand` is `true` and `cauchysum` is `true` then the Cauchy product will be used rather than the usual product. In the Cauchy product the index of the inner summation is a function of the index of the outer one rather than varying independently.

  Example:

      (%i1) sumexpand: false$
      (%i2) cauchysum: false$
      (%i3) s: sum (f(i), i, 0, inf) * sum (g(j), j, 0, inf);
                            inf         inf
                            ====        ====
                            \           \
      (%o3)                ( >    f(i))  >    g(j)
                            /           /
                            ====        ====
                            i = 0       j = 0
      (%i4) sumexpand: true$
      (%i5) cauchysum: true$
      (%i6) ''s;
                       inf     i1
                       ====   ====
                       \      \
      (%o6)             >      >     g(i1 - i2) f(i2)
                       /      /
                       ====   ====
                       i1 = 0 i2 = 0

Function: deftaylor (f_1(x_1), expr_1, ..., f_n(x_n), expr_n)

  For each function f_i of one variable x_i, `deftaylor` defines expr_i as the Taylor series about zero. expr_i is typically a polynomial in x_i or a summation; more general expressions are accepted by `deftaylor` without complaint.

  `powerseries (f_i(x_i), x_i, 0)` returns the series defined by `deftaylor`.

  `deftaylor` returns a list of the functions f_1, ..., f_n. `deftaylor` evaluates its arguments.

  Example:

      (%i1) deftaylor (f(x), x^2 + sum(x^i/(2^i*i!^2), i, 4, inf));
      (%o1)                          [f]
      (%i2) powerseries (f(x), x, 0);
                            inf
                            ====      i1
                            \        x         2
      (%o2)                  >     -------- + x
                            /       i1    2
                            ====   2   i1!
                            i1 = 4
      (%i3) taylor (exp (sqrt (f(x))), x, 0, 4);
                            2         3          4
                           x    3073 x    12817 x
      (%o3)/T/     1 + x + -- + ------- + -------- + . . .
                           2     18432     307200

Option variable: maxtayorder

  Default value: `true`

  When `maxtayorder` is `true`, then during algebraic manipulation of (truncated) Taylor series, `taylor` tries to retain as many terms as are known to be correct.

Function: niceindices (expr)

  Renames the indices of sums and products in expr. `niceindices` attempts to rename each index to the value of `niceindicespref[1]`, unless that name appears in the summand or multiplicand, in which case `niceindices` tries the succeeding elements of `niceindicespref` in turn, until an unused variable is found. If the entire list is exhausted, additional indices are constructed by appending integers to the value of `niceindicespref[1]`, e.g., `i0`, `i1`, `i2`, ....

  `niceindices` returns an expression. `niceindices` evaluates its argument.

  Example:

      (%i1) niceindicespref;
      (%o1)                  [i, j, k, l, m, n]
      (%i2) product (sum (f (foo + i*j*bar), foo, 1, inf), bar, 1, inf);
                       inf    inf
                      /===\   ====
                       ! !    \
      (%o2)            ! !     >      f(bar i j + foo)
                       ! !    /
                      bar = 1 ====
                              foo = 1
      (%i3) niceindices (%);
                           inf  inf
                          /===\ ====
                           ! !  \
      (%o3)                ! !   >    f(i j l + k)
                           ! !  /
                          l = 1 ====
                                k = 1

Option variable: niceindicespref

  Default value: `[i, j, k, l, m, n]`

  `niceindicespref` is the list from which `niceindices` takes the names of indices for sums and products.

  The elements of `niceindicespref` are typically names of variables, although that is not enforced by `niceindices`.

  Example:

      (%i1) niceindicespref: [p, q, r, s, t, u]$
      (%i2) product (sum (f (foo + i*j*bar), foo, 1, inf), bar, 1, inf);
                       inf    inf
                      /===\   ====
                       ! !    \
      (%o2)            ! !     >      f(bar i j + foo)
                       ! !    /
                      bar = 1 ====
                              foo = 1
      (%i3) niceindices (%);
                           inf  inf
                          /===\ ====
                           ! !  \
      (%o3)                ! !   >    f(i j q + p)
                           ! !  /
                          q = 1 ====
                                p = 1

Function: nusum (expr, x, i_0, i_1)

  Carries out indefinite hypergeometric summation of expr with respect to x using a decision procedure due to R.W. Gosper. expr and the result must be expressible as products of integer powers, factorials, binomials, and rational functions.

  The terms "definite" and "indefinite summation" are used analogously to "definite" and "indefinite integration". To sum indefinitely means to give a symbolic result for the sum over intervals of variable length, not just e.g. 0 to inf. Thus, since there is no formula for the general partial sum of the binomial series, `nusum` can't do it.

  `nusum` and `unsum` know a little about sums and differences of finite products. See also `unsum`.

  Examples:

      (%i1) nusum (n*n!, n, 0, n);

      Dependent equations eliminated:  (1)
      (%o1)                     (n + 1)! - 1
      (%i2) nusum (n^4*4^n/binomial(2*n,n), n, 0, n);
                           4        3       2              n
            2 (n + 1) (63 n  + 112 n  + 18 n  - 22 n + 3) 4      2
      (%o2) ------------------------------------------------ - ------
                          693 binomial(2 n, n)                 3 11 7
      (%i3) unsum (%, n);
                                    4  n
                                   n  4
      (%o3)                   ----------------
                              binomial(2 n, n)
      (%i4) unsum (prod (i^2, i, 1, n), n);
                          n - 1
                          /===\
                           ! !   2
      (%o4)              ( ! !  i ) (n - 1) (n + 1)
                           ! !
                          i = 1
      (%i5) nusum (%, n, 1, n);

      Dependent equations eliminated:  (2 3)
                                  n
                                /===\
                                 ! !   2
      (%o5)                      ! !  i  - 1
                                 ! !
                                i = 1

Function: pade (taylor_series, numer_deg_bound, denom_deg_bound)

  Returns a list of all rational functions which have the given Taylor series expansion where the sum of the degrees of the numerator and the denominator is less than or equal to the truncation level of the power series, i.e. are "best" approximants, and which additionally satisfy the specified degree bounds.

  taylor_series is a univariate Taylor series. numer_deg_bound and denom_deg_bound are positive integers specifying degree bounds on the numerator and denominator.

  taylor_series can also be a Laurent series, and the degree bounds can be `inf` which causes all rational functions whose total degree is less than or equal to the length of the power series to be returned. Total degree is defined as `numer_deg_bound + denom_deg_bound`. Length of a power series is defined as `"truncation level" + 1 - min(0, "order of series")`.

      (%i1) taylor (1 + x + x^2 + x^3, x, 0, 3);
                                    2    3
      (%o1)/T/             1 + x + x  + x  + . . .
      (%i2) pade (%, 1, 1);
                                       1
      (%o2)                       [- -----]
                                     x - 1
      (%i3) t: taylor(-(83787*x^10 - 45552*x^9 - 187296*x^8
                         + 387072*x^7 + 86016*x^6 - 1507328*x^5
                         + 1966080*x^4 + 4194304*x^3 - 25165824*x^2
                         + 67108864*x - 134217728)
             /134217728, x, 0, 10);
                          2    3       4       5       6        7
                   x   3 x    x    15 x    23 x    21 x    189 x
      (%o3)/T/ 1 - - + ---- - -- - ----- + ----- - ----- - ------
                   2    16    32   1024    2048    32768   65536

                                        8         9          10
                                  5853 x    2847 x    83787 x
                                + ------- + ------- - --------- + . . .
                                  4194304   8388608   134217728
      (%i4) pade (t, 4, 4);
      (%o4)                          []

  There is no rational function of degree 4 numerator/denominator, with this power series expansion. You must in general have degree of the numerator and degree of the denominator adding up to at least the degree of the power series, in order to have enough unknown coefficients to solve.

      (%i5) pade (t, 5, 5);
                           5                4                 3
      (%o5) [- (520256329 x  - 96719020632 x  - 489651410240 x

                        2
       - 1619100813312 x  - 2176885157888 x - 2386516803584)

                     5                 4                  3
      /(47041365435 x  + 381702613848 x  + 1360678489152 x

                        2
       + 2856700692480 x  + 3370143559680 x + 2386516803584)]

Option variable: powerdisp

  Default value: `false`

  When `powerdisp` is `true`, a sum is displayed with its terms in order of increasing power. Thus a polynomial is displayed as a truncated power series, with the constant term first and the highest power last.

  By default, terms of a sum are displayed in order of decreasing power.

Function: powerseries (expr, x, a)

  Returns the general form of the power series expansion for expr in the variable x about the point a (which may be `inf` for infinity).

  If `powerseries` is unable to expand expr, `taylor` may give the first several terms of the series.

  When `verbose` is `true`, `powerseries` prints progress messages.

      (%i1) verbose: true$
      (%i2) powerseries (log(sin(x)/x), x, 0);
      can't expand
                                       log(sin(x))
      so we'll try again after applying the rule:
                                              d
                                            / -- (sin(x))
                                            [ dx
                              log(sin(x)) = i ----------- dx
                                            ]   sin(x)
                                            /
      in the first simplification we have returned:
                                   /
                                   [
                                   i cot(x) dx - log(x)
                                   ]
                                   /
                          inf
                          ====        i1  2 i1             2 i1
                          \      (- 1)   2     bern(2 i1) x
                           >     ------------------------------
                          /                i1 (2 i1)!
                          ====
                          i1 = 1
      (%o2)                -------------------------------------
                                            2

Option variable: psexpand

  Default value: `false`

  When `psexpand` is `true`, an extended rational function expression is displayed fully expanded. The switch `ratexpand` has the same effect.

  When `psexpand` is `false`, a multivariate expression is displayed just as in the rational function package.

  When `psexpand` is `multi`, then terms with the same total degree in the variables are grouped together.

Function: revert (expr, x)
Function: revert2 (expr, x, n)

  These functions return the reversion of expr, a Taylor series about zero in the variable x. `revert` returns a polynomial of degree equal to the highest power in expr. `revert2` returns a polynomial of degree n, which may be greater than, equal to, or less than the degree of expr.

  `load ("revert")` loads these functions.

  Examples:

      (%i1) load ("revert")$
      (%i2) t: taylor (exp(x) - 1, x, 0, 6);
                         2    3    4    5     6
                        x    x    x    x     x
      (%o2)/T/      x + -- + -- + -- + --- + --- + . . .
                        2    6    24   120   720
      (%i3) revert (t, x);
                     6       5       4       3       2
                 10 x  - 12 x  + 15 x  - 20 x  + 30 x  - 60 x
      (%o3)/R/ - --------------------------------------------
                                      60
      (%i4) ratexpand (%);
                           6    5    4    3    2
                          x    x    x    x    x
      (%o4)             - -- + -- - -- + -- - -- + x
                          6    5    4    3    2
      (%i5) taylor (log(x+1), x, 0, 6);
                          2    3    4    5    6
                         x    x    x    x    x
      (%o5)/T/       x - -- + -- - -- + -- - -- + . . .
                         2    3    4    5    6
      (%i6) ratsimp (revert (t, x) - taylor (log(x+1), x, 0, 6));
      (%o6)                           0
      (%i7) revert2 (t, x, 4);
                                4    3    2
                               x    x    x
      (%o7)                  - -- + -- - -- + x
                               4    3    2

Function: taylor (expr, x, a, n)
Function: taylor (expr, [x_1, x_2, ...], a, n)
Function: taylor (expr, [x, a, n, 'asymp])
Function: taylor (expr, [x_1, x_2, ...], [a_1, a_2, ...], [n_1, n_2, ...])

  `taylor (expr, x, a, n)` expands the expression expr in a truncated Taylor or Laurent series in the variable x around the point a, containing terms through `(x - a)^n`.

  If expr is of the form `f(x)/g(x)` and `g(x)` has no terms up to degree n then `taylor` attempts to expand `g(x)` up to degree `2 n`. If there are still no nonzero terms, `taylor` doubles the degree of the expansion of `g(x)` so long as the degree of the expansion is less than or equal to `n 2^taylordepth`.

  `taylor (expr, [x_1, x_2, ...], a, n)` returns a truncated power series of degree n in all variables x_1, x_2, ... about the point `(a, a, ...)`.

  `taylor (expr, [x_1, a_1, n_1], [x_2, a_2, n_2], ...)` returns a truncated power series in the variables x_1, x_2, ... about the point `(a_1, a_2, ...)`, truncated at n_1, n_2, ....

  `taylor (expr, [x_1, x_2, ...], [a_1, a_2, ...], [n_1, n_2, ...])` returns a truncated power series in the variables x_1, x_2, ... about the point `(a_1, a_2, ...)`, truncated at n_1, n_2, ....

  `taylor (expr, [x, a, n, 'asymp])` returns an expansion of expr in negative powers of `x - a`. The highest order term is `(x - a)^-n`.

  When `maxtayorder` is `true`, then during algebraic manipulation of (truncated) Taylor series, `taylor` tries to retain as many terms as are known to be correct.

  When `psexpand` is `true`, an extended rational function expression is displayed fully expanded. The switch `ratexpand` has the same effect. When `psexpand` is `false`, a multivariate expression is displayed just as in the rational function package. When `psexpand` is `multi`, then terms with the same total degree in the variables are grouped together.

  See also the `taylor_logexpand` switch for controlling expansion.

  Examples:

      (%i1) taylor (sqrt (sin(x) + a*x + 1), x, 0, 3);
                                 2             2
                   (a + 1) x   (a  + 2 a + 1) x
      (%o1)/T/ 1 + --------- - -----------------
                       2               8

                                         3      2             3
                                     (3 a  + 9 a  + 9 a - 1) x
                                   + -------------------------- + . . .
                                                 48
      (%i2) %^2;
                                          3
                                         x
      (%o2)/T/           1 + (a + 1) x - -- + . . .
                                         6
      (%i3) taylor (sqrt (x + 1), x, 0, 5);
                             2    3      4      5
                        x   x    x    5 x    7 x
      (%o3)/T/      1 + - - -- + -- - ---- + ---- + . . .
                        2   8    16   128    256
      (%i4) %^2;
      (%o4)/T/                  1 + x + . . .
      (%i5) product ((1 + x^i)^2.5, i, 1, inf)/(1 + x^2);
                               inf
                              /===\
                               ! !    i     2.5
                               ! !  (x  + 1)
                               ! !
                              i = 1
      (%o5)                   -----------------
                                    2
                                   x  + 1
      (%i6) ev (taylor(%, x,  0, 3), keepfloat);
                                     2           3
      (%o6)/T/    1 + 2.5 x + 3.375 x  + 6.5625 x  + . . .
      (%i7) taylor (1/log (x + 1), x, 0, 3);
                                     2       3
                       1   1   x    x    19 x
      (%o7)/T/         - + - - -- + -- - ----- + . . .
                       x   2   12   24    720
      (%i8) taylor (cos(x) - sec(x), x, 0, 5);
                                      4
                                 2   x
      (%o8)/T/                - x  - -- + . . .
                                     6
      (%i9) taylor ((cos(x) - sec(x))^3, x, 0, 5);
      (%o9)/T/                    0 + . . .
      (%i10) taylor (1/(cos(x) - sec(x))^3, x, 0, 5);
                                                     2          4
                  1     1       11      347    6767 x    15377 x
      (%o10)/T/ - -- + ---- + ------ - ----- - ------- - --------
                   6      4        2   15120   604800    7983360
                  x    2 x    120 x

                                                                + . . .
      (%i11) taylor (sqrt (1 - k^2*sin(x)^2), x, 0, 6);
                     2  2       4      2   4
                    k  x    (3 k  - 4 k ) x
      (%o11)/T/ 1 - ----- - ----------------
                      2            24

                                          6       4       2   6
                                     (45 k  - 60 k  + 16 k ) x
                                   - -------------------------- + . . .
                                                720
      (%i12) taylor ((x + 1)^n, x, 0, 4);
                            2       2     3      2         3
                          (n  - n) x    (n  - 3 n  + 2 n) x
      (%o12)/T/ 1 + n x + ----------- + --------------------
                               2                 6

                                     4      3       2         4
                                   (n  - 6 n  + 11 n  - 6 n) x
                                 + ---------------------------- + . . .
                                                24
      (%i13) taylor (sin (y + x), x, 0, 3, y, 0, 3);
                     3                 2
                    y                 y
      (%o13)/T/ y - -- + . . . + (1 - -- + . . .) x
                    6                 2

                          3                       2
                     y   y            2      1   y            3
                + (- - + -- + . . .) x  + (- - + -- + . . .) x  + . . .
                     2   12                  6   12
      (%i14) taylor (sin (y + x), [x, y], 0, 3);
                           3        2      2      3
                          x  + 3 y x  + 3 y  x + y
      (%o14)/T/   y + x - ------------------------- + . . .
                                      6
      (%i15) taylor (1/sin (y + x), x, 0, 3, y, 0, 3);
                1   y              1    1               1            2
      (%o15)/T/ - + - + . . . + (- -- + - + . . .) x + (-- + . . .) x
                y   6               2   6                3
                                   y                    y

                                                 1            3
                                            + (- -- + . . .) x  + . . .
                                                  4
                                                 y
      (%i16) taylor (1/sin (y + x), [x, y], 0, 3);
                                   3         2       2        3
                  1     x + y   7 x  + 21 y x  + 21 y  x + 7 y
      (%o16)/T/ ----- + ----- + ------------------------------- + . . .
                x + y     6                   360

Option variable: taylordepth

  Default value: 3

  If there are still no nonzero terms, `taylor` doubles the degree of the expansion of `g(x)` so long as the degree of the expansion is less than or equal to `n 2^taylordepth`.

Function: taylorinfo (expr)

  Returns information about the Taylor series expr. The return value is a list of lists. Each list comprises the name of a variable, the point of expansion, and the degree of the expansion.

  `taylorinfo` returns `false` if expr is not a Taylor series.

  Example:

      (%i1) taylor ((1 - y^2)/(1 - x), x, 0, 3, [y, a, inf]);
                        2                       2
      (%o1)/T/ - (y - a)  - 2 a (y - a) + (1 - a )

               2                        2
       + (1 - a  - 2 a (y - a) - (y - a) ) x

               2                        2   2
       + (1 - a  - 2 a (y - a) - (y - a) ) x

               2                        2   3
       + (1 - a  - 2 a (y - a) - (y - a) ) x  + . . .
      (%i2) taylorinfo(%);
      (%o2)               [[y, a, inf], [x, 0, 3]]

Function: taylorp (expr)

  Returns `true` if expr is a Taylor series, and `false` otherwise.

Option variable: taylor_logexpand

  Default value: `true`

  `taylor_logexpand` controls expansions of logarithms in `taylor` series.

  When `taylor_logexpand` is `true`, all logarithms are expanded fully so that zero-recognition problems involving logarithmic identities do not disturb the expansion process. However, this scheme is not always mathematically correct since it ignores branch information.

  When `taylor_logexpand` is set to `false`, then the only expansion of logarithms that occur is that necessary to obtain a formal power series.

Option variable: taylor_order_coefficients

  Default value: `true`

  `taylor_order_coefficients` controls the ordering of coefficients in a Taylor series.

  When `taylor_order_coefficients` is `true`, coefficients of taylor series are ordered canonically.

Function: taylor_simplifier (expr)

  Simplifies coefficients of the power series expr. `taylor` calls this function.

Option variable: taylor_truncate_polynomials

  Default value: `true`

  When `taylor_truncate_polynomials` is `true`, polynomials are truncated based upon the input truncation levels.

  Otherwise, polynomials input to `taylor` are considered to have infinite precison.

Function: taytorat (expr)

  Converts expr from `taylor` form to canonical rational expression (CRE) form. The effect is the same as `rat (ratdisrep (expr))`, but faster.

Function: trunc (expr)

  Annotates the internal representation of the general expression expr so that it is displayed as if its sums were truncated Taylor series. expr is not otherwise modified.

  Example:

      (%i1) expr: x^2 + x + 1;
                                  2
      (%o1)                      x  + x + 1
      (%i2) trunc (expr);
                                      2
      (%o2)                  1 + x + x  + . . .
      (%i3) is (expr = trunc (expr));
      (%o3)                         true

Function: unsum (f, n)

  Returns the first backward difference `f(n) - f(n - 1)`. Thus `unsum` in a sense is the inverse of `sum`.

  See also `nusum`.

  Examples:

      (%i1) g(p) := p*4^n/binomial(2*n,n);
                                           n
                                        p 4
      (%o1)               g(p) := ----------------
                                  binomial(2 n, n)
      (%i2) g(n^4);
                                    4  n
                                   n  4
      (%o2)                   ----------------
                              binomial(2 n, n)
      (%i3) nusum (%, n, 0, n);
                           4        3       2              n
            2 (n + 1) (63 n  + 112 n  + 18 n  - 22 n + 3) 4      2
      (%o3) ------------------------------------------------ - ------
                          693 binomial(2 n, n)                 3 11 7
      (%i4) unsum (%, n);
                                    4  n
                                   n  4
      (%o4)                   ----------------
                              binomial(2 n, n)

Option variable: verbose

  Default value: `false`

  When `verbose` is `true`, `powerseries` prints progress messages.

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated on March, 19 2006 using texi2html 1.76.