How to substitute a function in a derivative

I know that if $U(x, y) = A x^\alpha y^\beta$, I have $U_x = \alpha A x^{\alpha-1} y ^\beta$. But by substitution, I can obtain $U_x = \alpha \left(\frac{U}{x}\right)$. Is there a way to obtain this in Sagemath. I have tried

U_x= U.diff(x).subs(Ax^(alpha)y^(beta)== U)

but this has no effect.

edit retag close merge delete

Sort by » oldest newest most voted

If I understand you correctly, you meant that $U_x=\frac{\partial U}{\partial x}$, right ? If so, your result is a triviality, since :

• There exists some quantity $K$ such as $U(x,y)=K x^\alpha$, where $K$ doesn't depend on $x$ (in fact, it is obvious that $K=A y^\beta$).

• Therefore $\frac{\partial U}{\partial x}=K\frac{\partial x^\alpha}{\partial x}=K\alpha x^{\alpha-1}$

This can be checked in sage quite directly:

sage: U(x,y)=A*x^a*y^b;U
(x, y) |--> A*x^a*y^b
sage: bool(U(x,y).diff(x)==a*U(x,y)/x)
True

more

Of course Emmanuel It's trivial. But for students it is not. You propose a verification not a substitution neither a demonstration.

( 2019-09-21 23:28:47 +0200 )edit

Ah. I see what you mean. Bt that's not substitution per se. What you're trying to do is:

sage: var("z")
z
sage: solve(U.diff(x)(x,y)==z*U(x,y),z)
[z == alpha/x]


I can't say I find trhis especially illuminating...

( 2019-09-22 08:11:10 +0200 )edit