Evaluating a derivative of an unknown function

asked 2019-03-11 16:15:59 +0200

Luis Escudero gravatar image

I need to evaluate the derivative of a certain unknown function, but instead of doing this what I get is the expression with a change in the name of the variable.

My example

z,l = var('z,l')  
g = function('g', nargs=1)(z)    
g_prime = g.derivative(z)(z)    

So the output for that code is \frac{\partial}{\partial l} g (l) .

Instead, I would like \frac{\partial}{\partial z} g(l)

edit retag flag offensive close merge delete



This does not quite do what you're asking, but is close:

sage: from sage.symbolic.constants import Constant
sage: l = Constant('l').expression()
sage: g.diff(z)(l)
rburing gravatar imagerburing ( 2019-03-11 19:17:22 +0200 )edit