  Automatic differentiation (AD) is an ensemble of techniques that allow to
evaluate accurate numerical derivatives of a mathematical function expressed in
a computer programming language. In this paper we use AD for stating and
solving solid mechanics problems. Given a finite element discretization of the
domain, we evaluate the free energy of the solid as the integral of its strain
energy density, and we make use of AD for directly obtaining the residual force
vector and the tangent stiffness matrix of the problem, as the gradient and the
Hessian of the free energy respectively. The result is a remarkable
simplification in the statement and the solution of complex problems involving
non trivial constraints systems and both geometrical and material non
linearities. Together with the continuum mechanics theoretical basis, and with
a description of the specific AD technique adopted, the paper illustrates the
solution of a number of solid mechanics problems, with the aim of presenting a
convenient numerical implementation approach, made easily available by recent
programming languages, to the solid mechanics community.
