I have no idea what you mean by "What is the best way of partially differentiating w.r.t. this thing?" You differentiate a function with respect to a variable. I suspect you meant to differentiate that "thing" wrt to a variable rather than "w.r.t. this thing". But what are the variables?