Numerical calculation of derivatives using algorithmic differentiation