Download A Maple User`s Guide
Transcript
If you want to get a list of all the operands Maple thinks there are in an expression, do op(s). Using this op notation, you can dig down into a very complex Maple expression and extract any sub-expression you want. You just do it recursively: a = op(2,s); b = op(7,a); and so on. Suppressing function arguments Example 1: Sometimes it is necessary to display arguments of a function to make things "work right", but then in the result one might prefer not to see the arguments. Consider: When the undefined function f has no explicit arguments, the deferred Diff differentiations activated by the value statement give the result 0 since Maple assumes f is a constant. This is repaired by changing f to f(x,y). If expressions are long and/or there are many arguments, it might be desirable to suppress these arguments in a final result, and the above shows one way to do this by extracting the function name using the op command. See elsewhere in this document for comments on Diff, value, % and subs. Example 2: This fancier example illustrates several things at once: how to get nice subscripts on a vector function, how to tell Maple not to throw out derivatives of unknown functions, and how to get Maple to suppress function arguments after they have been explicitly added. It is the suppression of the arguments that involves the "op" command which is used below to "pick off" just the function name as op 0, causing the arguments of the function to go away, as in the previous example. Things are very delicate because Maple always wants to compute derivatives of things which it often interprets as constants. One constantly has to tell Maple to "defer" evaluation by various methods. One is by using Diff instead of diff 45