Compact the Quadratic Function