Starting from a CAS-SCF calculation a sequence of contracted functions can be generated by applying strings of spin-traced replacement operators to the CAS-SCF solution. The laborious task of producing the Hamiltonian matrix elements between such functions can be substantially reduced making use of a computer algebra system. An implementation employing the MuPAD system is presented and illustrated. (C) 2004 Elsevier B.V. All rights reserved.