optim function

Function to calculate smoothness and squintability