Construction of formal and analytic realizations of nonlinear systems