Help with sage math defining function of two variables Hello I need help regarding sage math, since I cant find anything about it on the manuals. 
So I have a function of the form $F(r,t) = 2r H(t)$  and then i want to perform an operation on it involving differentiation. H(t) is kept arbitrary. I know how to do this using sagemath. My question is, what if before performing any operation, I want to perform a change of variables $u = t-r$ and $v=t+r$ first? So my function now becomes
$F =(v-u) H( (u+v)/2)$
Is it possible to define H((u+v)/2) in sage math, such that when it takes the derivative it takes the partial derivative wrt u and then wrt v?

I think this is what you want.
var('t,r')
H = function('H', nargs=1)(t)
F = 2*r*H(t)
print F
print diff(F,r)
print diff(F,r,t)
var('u,v')
G = F.subs(r=(v-u)/2,t=(u+v)/2)
print G
print diff(G,u)
print diff(G,u,v)

output:
2*r*H(t)
2*H(t)
2*diff(H(t), t)
-(u - v)*H(1/2*u + 1/2*v)
-1/2*(u - v)*D[0](H)(1/2*u + 1/2*v) - H(1/2*u + 1/2*v)
-1/4*(u - v)*D[0, 0](H)(1/2*u + 1/2*v)

You have to be careful with F = 2*r*H(t), though, as it won't know what "order" the arguments come in.  F(r,t) = ... might work better there, but it will be weirder on the derivative side once you substitute because it will still think the "inputs" are r,t.
See function? for more documentation on how these abstract functions work, which isn't always intuitive.
