Do some improvement for the polynominal function.

Change some cpp code to the hpp code, and add a main file.