I'm trying some basic practice with SymPy. I would like to take a second derivative symbolically of a function in rectangular coordinates with respect to the radius parameter in polar coordinates.
I'd like a nice chain rule symbolic expression where it calculates what it can and leaves unevaluated what can't be simplified further.
from sympy import *
init_session()
x, y, r, t = symbols('x y r t') # r (radius), t (angle theta)
f, g = symbols('f g', cls=Function)
g = f(x,y)
x = r * cos(t)
y = r* sin(t)
Derivative(g,r, 2).doit()
This code yields 0
. Is there a way to get a symbolic representation of the answer, rather than 0?