Manipulating Expressions You can examine parts of expressions by using the standard Maple library functions designed to categorize them or to pull them apart: type, whattype, op, and nops are some of those functions. To look at the i-th part of an expression, you use op(i, expression), where i evaluates to a non-negative integer. Example: > e1 := op1 + op2 + op3: > e2 := op1 * op2 * sin(op3): > op(2, e1); op2 > op(3, e2); sin(op3) As you can see, the operands of the expression are returned, not the operators that connect them. This is because Maple categorizes expressions into "types". For instance, "a+b+c" is of type "+" and has three operands; "a+b*c" is also of type "+" and has only two operands, one of which is of type "*" and itself has two operands. The whattype function tells you the type of an expression; type is a boolean test that allows you to check for a particular type of expression. For example: > whattype(e1); + > whattype(e2); * > type(e1+e2, `+`); true > type(expand(e1*e2),`+`); true To find out the number of operands in an expression, you use nops(expr). For example: > expand(e1*e2); 2 2 op1 op2 sin(op3) + op1 op2 sin(op3) + op1 op2 sin(op3) op3 > nops("); 3