Calculates the negation of a function.