# Revision history [back]

### Partial derivative and chain rule

I have the following variable and function:

var('r')
g = function('g')(r)


Now, I define the function f, which depends on g:

f = function('f')(g)


If I want to compute the derivative diff(f,r), I get:

D[0](f)(g(r))*diff(g(r), r)


which is the usual chain rule. However, if I want the derivative with respect to g:

diff(f,g)


I get an error:

TypeError: argument symb must be a symbol

Is there a way I can calculate the partial derivative of a function? I would expect a symbolic expression, like

$\displaystyle \frac{\partial f}{\partial g}$

### Partial derivative and chain rule

I have the following variable and function:

var('r')
g = function('g')(r)


Now, I define the function f, which depends on g:

f = function('f')(g)


If I want to compute the derivative diff(f,r), I get:

D[0](f)(g(r))*diff(g(r), r)


which is the usual chain rule. However, if I want the derivative with respect to g:

diff(f,g)


I get an error:

TypeError: argument symb must be a symbol

Is there a way I can calculate the partial derivative of a function? I would expect a symbolic expression, like

$\displaystyle \frac{\partial f}{\partial g}$

I have seen that in REDUCE there is the package DFPART which accounts for derivatives with respect generic functions.

### Partial derivative and chain rule

I have the following variable and function:

var('r')
g = function('g')(r)


Now, I define the function f, which depends on g:

f = function('f')(g)


If I want to compute the derivative diff(f,r), I get:

D[0](f)(g(r))*diff(g(r), r)


which is the usual chain rule. However, if I want the derivative with respect to g:

diff(f,g)


I get an error:

TypeError: argument symb must be a symbol

Is there a way I can calculate the partial derivative of a function? I would expect a symbolic expression, like

$\displaystyle \frac{\partial f}{\partial g}$

I have seen that in REDUCE there is the package DFPART which accounts for derivatives with respect to generic functions.functions, but I have not found an analogous module in SageMath.