The reference manual shows the following example for the gradient()
function:
sage: x,y = var('x y')
sage: f = x^2+y^2
sage: f.gradient()
(2*x, 2*y)
However, if instead I enter:
sage: x,y,n = var('x y n')
sage: f = x^n+y^n
sage: f.gradient()
(y^n*log(y) + x^n*log(x), n*x^(n - 1), n*y^(n - 1))
(not what I wanted, but I can understand what happened.)
So I tried:
sage: f(x,y) = x^n+y^n
sage: f.gradient()
((x, y) |--> y^n*log(y) + x^n*log(x), (x, y) |--> n*x^(n - 1), (x, y)
|--> n*y^(n - 1))
So even if I specify that f is a function of x and y,
gradient() still insists on also differentiating w.r.t. n
How do I tell gradient() that n is a constant?
Thanks in advance for insights.
Jim Clark
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---