Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If I am right, you want to transform the differential expression $$\frac{d^2\phi}{dr^2}+\frac{2}{r}\frac{d\phi}{dr},$$ where $$\phi(r)=\frac{m(r)}{r},$$ by changing the independent variable to $V$. The relation between $V$ and $r$ is $$V=\frac{4\pi}{3} r^3.$$ We can think of $m(r)$ as the result of composing two functions: one that yields $V$ in terms of $r$ and then one that yields $m$ in terms of $V$. In other words, an abusing a bit of the notation, $$m(r)=m(V(r)).$$

We can then transform the given differential expression as follows:

var("r,V")
vol = 4*pi*r^3/3
m(V) = function("m")(V)    # m as function of V
M = m(V.subs(V=vol))       # this is m(r)=m(V(r))
phi = M/r
divG = (diff(phi,r,2) + 2/r*diff(phi,r))
divG = divG.subs(vol==V, r^3==3*V/(4*pi)).full_simplify()
show(divG)

In a Jupyter notebook, one gets

$$12 \pi V \frac{\partial^{2}}{(\partial V)^{2}}m\left(V\right) + 8 \pi \frac{\partial}{\partial V}m\left(V\right)$$

that is, in a more proper mathematical notation,

$$4\pi\left( 3V\frac{d^2m}{dV^2}(V)+2\frac{dm}{dV}(V)\right)$$

I hope this has some meaning for you.