Revert "Coding the consequences of #987:derivative functions cannot introduce sparsity"

This reverts commit fb5db2023ce3886a59a6c4b59acfaa3af38c40a8.
A proper fix for #991?
Cleanup of derivative logic
more strict unittests for CustomFunction
automatic casadibot merge