The Yang-Mills equations for gauge fields of an arbitrary semisimple Lie group G in Euclidean spaces R(n) with dimension n greater-than-or-equal-to 4 is considered. For gauge fields A(a) we introduce the ansatze which reduce the Yang-Mills equations in R(n) to a set of nonlinear differential matrix equations (Rouhani-Ward equations). This permits us to write out the explicit form of cosmological, plane-wave, and other types of solutions.