Added derivative.
Merge branch 'master' into optimization_interface