The alchemy configuration interaction method. I. The symbolic matrix method for determining elements of matrix operators