extract operands from an expression
number of operands of an expression
integers indicating positions of operands
list of integers indicating positions of operands at increasing nesting levels of an expression
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 op⁡nops⁡e+i+1,e.
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 −nops⁡e−1..nops⁡e, 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.
The op and nops commands are thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
u ≔ 1,4,9
v ≔ f⁡x,y,z
If you try to refer to an operand that is not there, an error is returned
Error, improper op or subscript selector
y ≔ 1.2
w ≔ f⁡g⁡a,b,h⁡c,d,e,j,k,l
z ≔ f13,15
s ≔ series⁡sin⁡x,x=2,6
g ≔ x3+3⁢x2+5⁢x−6
In this case, the coeff command is more efficient.
Download Help Document
What kind of issue would you like to report? (Optional)