Explicit expressions for restricted partition function W(s,d(m)) and its quasiperiodic components W-j(s,d(m)) (called Sylvester waves) for a set of positive integers d(m) = {d(1), d(2), ..., d(m)} are derived. The formulas are represented in a form of a finite sum over Bernoulli and Eulerian polynomials of higher order with periodic coefficients. A novel recursive relation for the Sylvester waves is established. Application to counting algebraically independent homogeneous polynomial invariants of finite groups is discussed.