Updated for Numeric.AD v4

This is a bit messy because I wanted to leave in a (mostly superseded) commit showing a different way of doing things. I'll discuss some details in #2.