Finds critial poinst (not including endpoints). Needs to plot critical points, create dgm