Compact finite-difference scheme for some Sobolev type equations with Dirichlet boundary conditions