Math: Added some derivatives and simplification patterns.
Heavy overhaul of pattern simplification mechanism.