I need an algorithm for adaptive sampling a well-behaved function and computing its derivative in the sampling range with prescribed accuracy. The function has no more than one minimum in the sampling range. If it has no minimum in the sampling range it is monotonic. The derivatives of the first and of the second order exist in any point in the sampling range and are continuous as well as the function itself. The algorithm must take the minimum number of points of the objective function and allow computing its derivative in any point in the sampling range with prescribed accuracy (number of precise digits of the derivative). Probably such an algorithm is already developed and well-tested. Please help me to find it. The algorithm is supposed to be implemented in the Wolfram Mathematica system.