Dear all, I'm having a variable Sw, which I calculate pointwise in a routine calc_Sw (see attachment). This variable depends on my primary unknown h: Sw = (h-hn)/(hw-hn) (hn,hw known values). But now it seems like automatic differentiation for this routine does not work. I'm getting zero entries for the Jacobian, whereas d(Sw)/dh = 1.0 should hold. Do I have to write this routine with conditionals? I tried this, but failed. How would my routine calc_Sw have to look like with conditionals? Thank you! Henrik -- Dipl.-Math. Henrik Büsing Institute for Applied Geophysics and Geothermal Energy E.ON Energy Research Center RWTH Aachen University ------------------------------------------------------ Mathieustr. 10 | Tel +49 (0)241 80 49907 52074 Aachen, Germany | Fax +49 (0)241 80 49889 ------------------------------------------------------ http://www.eonerc.rwth-aachen.de/GGE hbuesing@eonerc.rwth-aachen.de ------------------------------------------------------