Tests for differentiate with simplified expressions

It was hard to write test for differentiate() because the writer had to
know exactly how the expression would be simplified. Now a utility
function is used to simplify both the automatically differentiated
expression and compare the simplified version. The error message if the
assertion fails is also better.