|
Calling Sequence
|
|
op(i, e)
op(i..j, e)
op(e)
op(list, e)
nops(e)
|
|
Parameters
|
|
i, j
|
-
|
integers indicating positions of operands
|
e
|
-
|
expression
|
list
|
-
|
list of integers indicating positions of operands at increasing nesting levels of an expression
|
|
|
|
|
Description
|
|
•
|
The op function extracts operands from an expression. The nops function returns the number of operands in an expression.
|
•
|
If the first argument to the op function is a positive integer i, then the ith operand of e is returned. If the operand does not exist, an error occurs.
|
•
|
If the first argument to op is a negative integer i, then the result is .
|
•
|
For some data structures, op(0, e) is defined as a special case (for more information, see the particular data structure help page). For an unevaluated function call, op(0, e) is the name of the function. For an indexed name, op(0, e) is the name without the index. For a series, op(0, e) is x-a where x is the variable and a is the expansion point of the series. If calculating op(0, series(exp(x), x=a)), x-a returns rather than a. For all other data structures, op(0, e) returns the type of e.
|
•
|
If the values of the operand selectors are not in the range , an error occurs.
|
•
|
If the first argument to op is a range i..j, then the result is a sequence of the ith to jth operands of e. Negative integers in the range are treated as described above; nops(e)+1 is added to them.
|
•
|
If the op function has only one argument, this is equivalent to op(1..nops(e), e).
|
•
|
If the first argument to op is a list, then the elements of the list refer to a sub-operand of e at increasing levels of nesting. This is merely a short-form notation. The expression op([a1, a2, ..., an], e) returns the same result as op(an, op(..., op(a2, op(a1, e))...)), but is more efficient to execute.
|
•
|
When the first argument is a list, the last element of the list can be a range. As stated above, this is merely a short-form notation. The expression op([a1, a2, ..., an1..an2], e) returns the same result as op(an1..an2, op(..., op(a2, op(a1, e))...)), but is more efficient to execute.
|
|
|
Thread Safety
|
|
•
|
The op and nops commands are thread-safe as of Maple 15.
|
|
|
Examples
|
|
If you try to refer to an operand that is not there, an error is returned
In this case, the coeff command is more efficient.
|
|
|