how to calculate higher order derivatives