If the function is more complicated and local variables are needed the function proc should be used. If the number of in-arguments is not predetermined, use args and nargs . The alias facility is quite useful. They can both take a set of functions as their first argument. The opposite of expand is combine , in some sense.
More advanced uses are possible.
For complex integration, apply evalc . If there are several solutions to eq then solve returns an expression sequence , i.e. several expressions separated by commas. It is up to the user to collect the solutions in a set or a list etc. Whenever doing matrix calculations the function evalm has to be applied. Variables may be assigned an object of any type.