If a user function is incompatible with tomSym, it can still be used in symbolic computations, by giving it a "wrapper". For example, if the cos function were not already overloaded by tomSym, it would still be possible to do the equivalent of cos(3*x) by writing wrap('cos',size(x,1),size(x,2),3*x). The size of the output must be supplied in the call to "wrap" so that the symbol gets the correct size.

MAD computes the derivatives when the Jacobian matrix of a wrapped function is needed. A wrapper is supplied for this call. For example, the derivative of the wrapped cos(3*x), above, is madWrap(1,'cos',1,3*x)*3.