The hard-sphere fluid is a very commonly used mechanical or thermodynamic model in physics, chemistry and chemical engineering, with its equation of state being its most important thermodynamic property. In this work, we present the implementation of the computer program Maple for developing an algorithm for the derivation of different analytical expressions for both hard-sphere and hard-disk equations of state, i.e., compressibility factors as functions of the density or the packing fraction. The asymptotic expansion method is used, which permits a great number of different expressions to be generated from knowledge of the values of a given number of virial coefficients. Finally, the procedure of selection of the most appropriate expression is explained and examples are given.