Relative extrema and inflection points