f_gen function

Formula of an n-order model.