How to differentiate one function with respect to another? I have two functions, u(x,y) and v(x,y), that are both intractable analytically and estimated numerically in MATLAB on a grid for x and y. How can I estimate du(x,y)/dv(x,y) at all points (x,y) on the grid? I want to plot du(x,y)/dv(x,y) against x and y.
 A: I am not aware of any sensible definition for $$\frac {du(x,y)}{dv(x,y)}$$ as a numeric value.
Understand that $$du = \frac{\partial u}{\partial x}dx + \frac{\partial u}{\partial y}dy$$ and $$dv = \frac{\partial v}{\partial x}dx + \frac{\partial v}{\partial y}dy$$ The ratio of these two differential expressions cannot define a number, as independent differentials do not cancel each other.
What you can do is describe the ratio of change in $u$ to change in $v$ as you move in various directions. For example, if from a point $(x_0,y_0)$, you move by changing $x$ and $y$ by the same amount: $(x,y) = (x_0, y_0) + t(1,1)$, then $dx = dy = dt$, so you get $$\frac{du}{dv} = \cfrac{\frac{\partial u}{\partial x}dt + \frac{\partial u}{\partial y}dt}{\frac{\partial v}{\partial x}dt + \frac{\partial v}{\partial y}dt}\\=\cfrac{\frac{\partial u}{\partial x} + \frac{\partial u}{\partial y}}{\frac{\partial v}{\partial x} + \frac{\partial v}{\partial y}}$$
This is called a directional derivative (though I suppose in this case it might be more appropriate to call it an implicit directional derivative, as $u$ is not explicitly a function of $v$).
But there is nothing particularly special about moving in that direction. You could instead hold $x$ constant and let $y$ change: $(x,y) = (x_0, y_0) + t(0,1)$. Then
$$\frac{du}{dv} = \cfrac{\frac{\partial u}{\partial y}}{\frac{\partial v}{\partial y}}$$
Or decrease $y$ by twice the amount you increase $x$: $(x,y) = (x_0, y_0) + t(1,-2)$. Then
$$\frac{du}{dv} = \cfrac{\frac{\partial u}{\partial x} - 2\frac{\partial u}{\partial y}}{\frac{\partial v}{\partial x} - 2\frac{\partial v}{\partial y}}$$
In general, if you want to measure the directional derivative $\frac {du}{dv}$ in the direction $\mathbf w = (w_x, w_y)$, then the formula is
$$\frac {du}{dv}(\mathbf w) = \cfrac{\nabla u \cdot \mathbf w}{\nabla v \cdot \mathbf w} = \cfrac{\frac{\partial u}{\partial x}w_x + \frac{\partial u}{\partial y}w_y}{\frac{\partial v}{\partial x}w_x + \frac{\partial v}{\partial y}w_y}$$
