move the calculation of derivatives from an example back to the package