Create derivative function.