Python Vector Dot Product Derivative