ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 11 Mar 2019 13:17:22 -0500Evaluating a derivative of an unknown functionhttp://ask.sagemath.org/question/45758/evaluating-a-derivative-of-an-unknown-function/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)
g_prime(l)
So the output for that code is \frac{\partial}{\partial l} g (l) .
Instead, I would like \frac{\partial}{\partial z} g(l)Mon, 11 Mar 2019 10:15:59 -0500http://ask.sagemath.org/question/45758/evaluating-a-derivative-of-an-unknown-function/Comment by rburing for <p>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.</p>
<p>My example</p>
<pre><code>z,l = var('z,l')
g = function('g', nargs=1)(z)
g_prime = g.derivative(z)(z)
g_prime(l)
</code></pre>
<p>So the output for that code is \frac{\partial}{\partial l} g (l) .</p>
<p>Instead, I would like \frac{\partial}{\partial z} g(l)</p>
http://ask.sagemath.org/question/45758/evaluating-a-derivative-of-an-unknown-function/?comment=45759#post-id-45759This 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)
D[0](g)(l)Mon, 11 Mar 2019 13:17:22 -0500http://ask.sagemath.org/question/45758/evaluating-a-derivative-of-an-unknown-function/?comment=45759#post-id-45759