We develop methods for computing with matrix groups defined over a range of infinite domains, and apply those methods to the design of algorithms for nilpotent groups. In particular, we provide a practical nilpotency testing algorithm for matrix groups over an infinite field. We also provide algorithms to answer a number of structural questions for a nilpotent matrix group. The main algorithms have been implemented in GAP, for groups over the rational number field. (c) 2007 Elsevier Ltd. All rights reserved.