Ask Your Question
1

A last substitution

asked 2019-09-22 22:29:22 +0200

Cyrille gravatar image

updated 2019-09-22 22:32:13 +0200

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);
tms=(U_x/U_y).canonicalize_radical();
var('x,y')
y= function('y');
tms1=(U_x/U_y).substitute(y=y(x)).canonicalize_radical();
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[0][y(x).diff(x)]

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

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

but it obviously doesn't work.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-09-23 08:45:20 +0200

Emmanuel Charpentier gravatar image
  • 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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-09-22 22:29:22 +0200

Seen: 165 times

Last updated: Sep 23 '19