Analytical solution of dispersion relations for the nuclear optical model