Find extrema of a function in a given interval.