## `ORDER` -- the default number of terms in series expansions

#### Introduction

The environment variable `ORDER` controls the default number of terms that the system returns when you compute a series expansion.

#### Call(s)

`ORDER`
`ORDER` := n

#### Parameters

`n` | - | a positive integer less than 2^31. The default value is 6.

#### Related Functions

`asympt`, `limit`, `O`, `series`, `taylor`

#### Details

- The functions `taylor`, `series`, and `asympt` have an optional third argument specifying the desired number of terms of the requested series expansion, counting from the lowest degree term on (relative order). If this optional argument is missing, then the value of `ORDER` is used instead.
- `ORDER` may also affect the results returned by the function `limit`.
- Deletion via the statement ```delete ORDER`'' resets `ORDER` to its default value 6. Executing the function `reset` also restores the default value.
- In some cases, the number of terms returned by `taylor`, `series`, or `asympt` may not agree with the value of `ORDER`. Cf. example 2.

#### Example 1

In the following example, we compute the first 6 terms of the series expansion of the exponential function around the origin:

    >> series(exp(x), x = 0)

                                 2    3    4    5
                                x    x    x    x        6
                        1 + x + -- + -- + -- + --- + O(x )
                                2    6    24   120

To obtain the first 10 terms, we specify the third argument of `series`:

    >> series(exp(x), x = 0, 10)

                   2    3    4    5     6      7      8        9
                  x    x    x    x     x      x      x        x
          1 + x + -- + -- + -- + --- + --- + ---- + ----- + ------ +
                  2    6    24   120   720   5040   40320   362880

                10
             O(x  )

Alternatively, we increase the value of `ORDER`. This affects all subsequent calls to `series` or any other function returning a series expansion:

    >> ORDER := 10: series(exp(x), x = 0)

                   2    3    4    5     6      7      8        9
                  x    x    x    x     x      x      x        x
          1 + x + -- + -- + -- + --- + --- + ---- + ----- + ------ +
                  2    6    24   120   720   5040   40320   362880

                10
             O(x  )

    >> taylor(x^2/(1 - x), x = 0)

             2    3    4    5    6    7    8    9    10    11      12
            x  + x  + x  + x  + x  + x  + x  + x  + x   + x   + O(x  )

Finally, we reset `ORDER` to its default value 6:

    >> delete ORDER: taylor(x^2/(1 - x), x = 0)

                         2    3    4    5    6    7      8
                        x  + x  + x  + x  + x  + x  + O(x )

#### Example 2

Here are some examples where the number of terms returned by `series` differs from the value of `ORDER`:

    >> ORDER := 3:

    >> series((x^2 + x)^2, x = 0)

                                     2      3
                                    x  + O(x )

    >> series(exp(x) - 1 - x, x = 0)

                                     2
                                    x       3
                                    -- + O(x )
                                    2

    >> series(1/(1 - sqrt(x)), x = 0)

                             1/2        3/2    2      5/2
                        1 + x    + x + x    + x  + O(x   )

    >> delete ORDER:

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000