  We introduce the generalized Heisenberg algebra $\mathcal{H}_n$ and construct
realizations of the orthogonal and Lorentz algebras by power series in a
semicompletion of $\mathcal{H}_n$. The obtained realizations are given in terms
of the generating functions for the Bernoulli numbers. We also introduce an
extension of the orthogonal and Lorentz algebras by quantum angles and study
realizations of the extended algebras in $\mathcal{H}_n$. Furthermore, we show
that by extending the generalized Heisenberg algebra $\mathcal{H}_n$ one can
also obtain realizations of the Poincare algebra and its extension by quantum
angles.
