added basic differentiation and fixed a bug in simplification