Automatic differentiation and applications to option pricing