Added ExprFactory class and differentiate method.

Added ExprFactory class which is in charge of generating Expr objects
and destroying them. Added differentiate method in Expr, which takes in
a variable (double*) and an ExprFactory, and returns an Expr
representing the derivative of this with respect to the first argument.
Also added ConstExpr, CosExpr and NegExpr.