analytic derivatives and better to maintain functions