Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

help on using chain rule in Sage

Does anyone have any tips for using Sage to take derivatives of functions of many variables?

For example, if I define

w(x,y) = x^2 + y^2 (say)

and then if I suppose that x and y depend on an independent variable t, the chain rule applies for finding w.diff(t). The only way I found to do this in Sage is

var('t')

x(t) = cos(t) (say)

y(t) = sin(t)

w(x,y) = x^2 + y^2

w.diff(t)

But this isn't really using the chain rule. If I instead try

var('x,y')

(define w again)

(define x and y again)

w.diff(t)

Out: (x,y) |--> 0

Apparently it thinks the derivative is zero because it still thinks x and y are two independent variables where they appear in w, even though you get

x

Out: t |--> cos(t)

and similarly for y. Any suggestions? Thanks.