Implement logistic funciton.