ORDER
-- the default number of
terms in series expansionsThe environment variable ORDER
controls the default
number of terms that the system returns when you compute a series
expansion.
ORDER
ORDER
:= n
n |
- | a positive integer less than 2^31. The default value is 6. |
asympt
, limit
, O
, series
, taylor
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
.delete ORDER
'' resets
ORDER
to its default value 6. Executing the
function reset
also
restores the default value.taylor
, series
, or asympt
may not agree with the value
of ORDER
. Cf. example 2.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 )
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: