gxmw
I've leveraged an offer to get my compensation increased several times, without having to actually leave, and it did nothing to harm my standing with my employer. If anything, my immediate management respected me more for "playing the system" to my advantage.
Finally do make sure you question any "wisdom" that taking the counteroffer is a bad idea is coming from. It is often repeated by recruiters, but clearly this is for self-serving reasons, so beware of that.
If you want to look at how small changes in inputs affect the output ("sensitivity analysis"), multivariate calculus can help with that.
If you want to find particular values of the V0, V1, etc which give the highest or lowest output value, that is called mathematical optimization. What kind of optimization (linear, quadratic, local, global etc) depends exactly on what your function looks like.