Efficient symbolic differentiation for graphics applications