converting symbolic differentiation to using data-directed programming style