check that no exceptions are thrown in the case of differentiation with respect to an integer
better use of booleans in assert
fix unhandled case