Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Finally I find the solution

var("w1,p,w2")
U=function('U')(x)
w2=function('w2')(w1)
U=U(x)
UU=p*U(w1)+(1-p)*U(w2(w1))
difU=solve(diff(UU, w1)==0, diff(w2,w1))
show(difU)

But (Notice there is always a but). I want now to specify U. But subs() doesn't work ! How to do this ?

Finally I find the solution

var("w1,p,w2")
U=function('U')(x)
w2=function('w2')(w1)
U=U(x)
UU=p*U(w1)+(1-p)*U(w2(w1))
difU=solve(diff(UU, w1)==0, diff(w2,w1))
show(difU)

But (Notice there is always a but). I want now to specify U. But subs() doesn't work ! How to do this ?? Of course, one can always replace function('U')(x) by say x^a without forgetting to eclare a. But I was wondering if there would be a substitution method.

Finally I find the solutionfound a solution:

var("w1,p,w2")
U=function('U')(x)
w2=function('w2')(w1)
U=U(x)
UU=p*U(w1)+(1-p)*U(w2(w1))
difU=solve(diff(UU, w1)==0, diff(w2,w1))
var("w1, p, w2")
U = function('U')(x)
w2 = function('w2')(w1)
U = U(x)
UU = p*U(w1) + (1 - p) * U(w2(w1))
difU = solve(diff(UU,  w1) == 0, diff(w2, w1))
show(difU)

But (Notice (notice there is always a but). I want now to specify U. U. But subs() doesn't work ! work! How to do this ? this? Of course, one can always replace function('U')(x) by say x^a without forgetting to eclare first declare a. But I was wondering if there would be a substitution method.

Finally I found a solution:

var("w1, p, w2")
U = function('U')(x)
w2 = function('w2')(w1)
U = U(x)
UU = p*U(w1) + (1 - p) * U(w2(w1))
difU = solve(diff(UU,  w1) == 0, diff(w2, w1))
show(difU)

But (notice there is always a but). I now want now to specify U. But subs() doesn't work! How to do this? Of course, one can always replace function('U')(x) by say x^a without forgetting to first declare a. But I was wondering if there would be a substitution method.

Finally I found have made a solution:biog mistake in the precedent solution so as I go slowly here is a part of my new code

var("w1, p, w2")
U var("x, y, dx, dy")
V=function('V')(x, y)
V_x = function('U')(x)
w2 diff(V, x)
V_y = function('w2')(w1)
U diff(V, y)
dV = U(x)
UU = p*U(w1) V_x * dx + (1 - p) V_y * U(w2(w1))
difU = solve(diff(UU,  w1) == 0, diff(w2, w1))
show(difU)
dy 
show(dV)
sol=solve(dV==0, dy)
show(sol[0]/dx)
y_x=sol[0].rhs()/dx
show(y_x)
latex(y_x)

But (notice there is always a but). I now want to specify U. But subs() doesn't work! How to do this? Of course, one can always replace function('U')(x) by say x^a without forgetting to first declare a. But I was wondering if there would be a substitution method.

I have made a biog mistake in the precedent solution so as I go slowly here is a part of my new code

var("x, y, dx, dy")
V=function('V')(x, y)
V_x = diff(V, x)
V_y = diff(V, y)
dV = V_x * dx + V_y * dy 
show(dV)
sol=solve(dV==0, dy)
show(sol[0]/dx)
y_x=sol[0].rhs()/dx
show(y_x)
latex(y_x)

The show commands give successively :

I have made a biog mistake in the precedent solution so as I go slowly here is a part of my new code

var("x, y, dx, dy")
V=function('V')(x, y)
V_x = diff(V, x)
V_y = diff(V, y)
dV = V_x * dx + V_y * dy 
show(dV)
sol=solve(dV==0, dy)
show(sol[0]/dx)
y_x=sol[0].rhs()/dx
show(y_x)

The show commands give successively :

$\mathit{dx} \frac{\partial}{\partial x}V\left(x, y\right) + \mathit{dy} \frac{\partial}{\partial y}V\left(x, y\right)$

$$

I have made a biog mistake in the precedent solution so as I go slowly here is a part of my new code

var("x, y, dx, dy")
V=function('V')(x, y)
V_x = diff(V, x)
V_y = diff(V, y)
dV = V_x * dx + V_y * dy 
show(dV)
sol=solve(dV==0, dy)
show(sol[0]/dx)
y_x=sol[0].rhs()/dx
show(y_x)

The show commands give successively :

$\mathit{dx} \frac{\partial}{\partial x}V\left(x, y\right) + \mathit{dy} \frac{\partial}{\partial y}V\left(x, y\right)$

$\frac{\mathit{dy}}{\mathit{dx}} = -\frac{\frac{\partial}{\partial x}V\left(x, y\right)}{\frac{\partial}{\partial y}V\left(x, y\right)}$

$$

I have made a biog mistake in the precedent solution so as I go slowly here is a part of my new code

var("x, y, dx, dy")
V=function('V')(x, y)
V_x = diff(V, x)
V_y = diff(V, y)
dV = V_x * dx + V_y * dy 
show(dV)
sol=solve(dV==0, dy)
show(sol[0]/dx)
y_x=sol[0].rhs()/dx
show(y_x)

The show commands give successively :

$\mathit{dx} \frac{\partial}{\partial x}V\left(x, y\right) + \mathit{dy} \frac{\partial}{\partial y}V\left(x, y\right)$

$\frac{\mathit{dy}}{\mathit{dx}} = -\frac{\frac{\partial}{\partial x}V\left(x, y\right)}{\frac{\partial}{\partial y}V\left(x, y\right)}$

$$$-\frac{\frac{\partial}{\partial x}V\left(x, y\right)}{\frac{\partial}{\partial y}V\left(x, y\right)}$

Now I will work on the substitution of the chosen function. And when I will have found I will come back.

I have made Here is the code for first and second order implicit differentiation of a biog mistake in the precedent solution so as I go slowly here is a part of my new code

two variables function

#Evaluation of the two first derivatives of an implicit function var("x, y, dx, dy") dy, al, be") V=function('V')(x, y) y)# A) either A or B should be uncomment

V= x^al*y^be# B)

V_x = diff(V, x) V_y = diff(V, y) y)

Evaluation of the two first derivatives of an implicit function

var("x, y, dx, dy, al, be") V=function('V')(x, y)# A) either A or B should be uncomment

V= x^al*y^be# B)

V_x = diff(V, x) V_y = diff(V, y)

Differential

dV = V_x * dx + V_y * dy show(dV) show(dV)

# Dérivée du premier ordre
sol=solve(dV==0, dy)
show(sol[0]/dx)
# Dérivée du second ordre
y_x=sol[0].rhs()/dx
show(y_x)
hh=y_x.function(x,y)
y=function('y')(x)
hh_x=diff(hh(x,y),x).full_simplify().subs(diff(y(x), x)==y_x).full_simplify() 
show(hh)
show(hh_x)

The show commands give successively :

$\mathit{dx} \frac{\partial}{\partial x}V\left(x, y\right) + \mathit{dy} \frac{\partial}{\partial y}V\left(x, y\right)$

$\frac{\mathit{dy}}{\mathit{dx}} = -\frac{\frac{\partial}{\partial x}V\left(x, y\right)}{\frac{\partial}{\partial y}V\left(x, y\right)}$

$-\frac{\frac{\partial}{\partial x}V\left(x, y\right)}{\frac{\partial}{\partial y}V\left(x, y\right)}$

Now I will work on the substitution of the chosen function. And when I will have found I will come back.

Here is the code for first and second order implicit differentiation of a two variables function

 #Evaluation of the two first derivatives of an implicit function
var("x, y, dx, dy, al, be")
V=function('V')(x, y)# A) either A or B should be uncomment

V= uncomment #V= x^al*y^be# B)

B) V_x = diff(V, x) V_y = diff(V, y)

Evaluation y) #Evaluation of the two first derivatives of an implicit function

function var("x, y, dx, dy, al, be") V=function('V')(x, y)# A) either A or B should be uncomment

V= uncomment #V= x^al*y^be# B)

B) V_x = diff(V, x) V_y = diff(V, y)

Differential

y) # Differential dV = V_x * dx + V_y * dy show(dV)

show(dV)
# Dérivée du premier ordre
sol=solve(dV==0, dy)
show(sol[0]/dx)
# Dérivée du second ordre
y_x=sol[0].rhs()/dx
show(y_x)
hh=y_x.function(x,y)
y=function('y')(x)
hh_x=diff(hh(x,y),x).full_simplify().subs(diff(y(x), x)==y_x).full_simplify() 
show(hh)
show(hh_x)

$\frac{\mathit{dy}}{\mathit{dx}} = -\frac{\frac{\partial}{\partial x}V\left(x, y\right)}{\frac{\partial}{\partial y}V\left(x, y\right)}$

$-\frac{\frac{\partial}{\partial x}V\left(x, y\right)}{\frac{\partial}{\partial y}V\left(x, y\right)}$

Now I will work on the substitution of the chosen function. And when I will have found I will come back.