Lie algebras of first- and second-order operators