Automatically determine lb and ub.