I am trying to find the derivative of a function defined in polar coordinates with respect to $x$ and $y$. My function is defined as follows:
$ v_x(r, \theta ) = v_r \cos (\theta ) - v_{\theta }\sin (\theta ) $
To do this, I start by defining the relation between Cartesian and Polar coordinates:
(* Define the mapping between Cartesian and Polar coordinate systems. *)
x[r_, θ_] = r Cos[θ];
y[r_, θ_] = r Sin[θ];
Then I define the function and find its derivative with respect to $x$:
Subscript[v, r][r_, θ_] = Subscript[v, r][r, θ] Cos[θ] - Subscript[v, θ][r, θ] Sin[θ];
D[Subscript[v, r][r, θ], x]
I am getting 0 because Mathematica is not considering the relation between $r$ and $x$. Is there anyway to tell Mathematica to use the chain rule to find the derivative of $v_x$ with respect to $x$?
The other problem is that Mathematica is considering the subscripts to be variables (which is reasonable), is there anyway to tell it that the subscripts are only notational symbols?
EDIT: The function is better defined as:
vx[r_, θ_] = vr[r, θ] Cos[θ] - vtheta[r, θ] Sin[θ];
to avoid evaluating subscripts and possibly having recursion.