# A last substitution

The result of the following code is perfectly normal.

 %display latex
var('A, x, y, l, alpha, beta, R, p_x, p_y');
assume(A>0,alpha>0,beta>0,x>0,y>0);
U=A*x^(alpha)*y^(beta);
U_x= U.diff(x);
U_y= U.diff(y);
var('x,y')
y= function('y');
tms1.diff(x)
courbtms=solve(tms1.diff(x)==0, y(x).diff(x),solution_dict=True)
courbtms


but it looks like this

$\left[\frac{\partial}{\partial x}y(x) = \frac{y(x)}{x}\right]$

It's the first time I see this type of brackets. I can extract the right member of this equation

courbtms[y(x).diff(x)]

but what I am not able to obtain is to substitue backward $y$ to $y(x)$? I have tried

courbtms[y(x).diff(x)].substitute[y(x)=z]

but it obviously doesn't work.

edit retag close merge delete

Sort by » oldest newest most voted
• solve returns a list of solution, denoted between brackets ; here , you get a singl solution, expressed as alist of length one. RTFM

• You attempt to use the same y symbol for two different objects : a symbolic variable and a symbolic function. Make a choice and use diferent symbols for different names.

• your second definition ofy invalidates the results obtained with the first.

more