Hey everyone. So, here's the problem I have:

z = x^2 + y^2
x = r*cos(theta)
y = r*sin(theta)

I need to calculate the partial derivative (dz/dx) while holding r 
constant. I was hoping I could define all of those functions and then just 
use the derivative command, but it doesn't seem to work the way I'm looking 
for. I also don't know how to tell sage to keep a variable constant. Note 
that, in this problem, the partial derivative is equal to -2x (if this were 
a very basic partial derivative, not involving having to keep anything 
constant, it would have been 2x).

Here is the code I tried:

r,theta,y = var("r,theta,y")
x = r*cos(theta)
f1 = x^2 + y^2
f1(x).diff(x)

I'm getting 2x as the output, when what I want is -2x. What am I doing 
wrong?

Thanks!



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to