I am not completely sure about your question, but i guess that what you call "procedure" is actually a Python function, which you can define using the def
satatement (check for Python introductions, there are very good tutorials online):
var("w1, w2, a, p")
EU(w1, w2, a, p)= p*w1^a+ (1-p)*w2^a
def my_procedure(V):
var("dw1, dw2")
V_w1 = diff(V, w1)
V_w2 = diff(V, w2)
# Differential
dV = V_w1 * dw1 + V_w2 * dw2
show("dV ="+latex(dV))
# Dérivée du premier ordre
sol=solve(dV==0, dw2)
show(sol[0]/dw1)
Then, calling:
my_procedure(EU)
should do the trick.
I am not completely sure about your question, but i guess that what you call "procedure" is actually a Python function, which you can define using the def
satatement statement (check for Python introductions, there are very good tutorials online):
var("w1, w2, a, p")
EU(w1, w2, a, p)= p*w1^a+ (1-p)*w2^a
def my_procedure(V):
var("dw1, dw2")
V_w1 = diff(V, w1)
V_w2 = diff(V, w2)
# Differential
dV = V_w1 * dw1 + V_w2 * dw2
show("dV ="+latex(dV))
# Dérivée du premier ordre
sol=solve(dV==0, sol = solve(dV == 0, dw2)
show(sol[0]/dw1)
Then, calling:
my_procedure(EU)
should do the trick.
![]() | 3 | No.3 Revision |
I am not completely sure about your question, but i guess that what you call "procedure" is actually a Python function, which you can define using the def
statement (check for Python introductions, there are very good tutorials online):
var("w1, w2, a, p")
EU(w1, w2, a, p)= p*w1^a+ (1-p)*w2^a
def my_procedure(V):
var("dw1, dw2")
V_w1 = diff(V, w1)
V_w2 = diff(V, w2)
# Differential
dV = V_w1 * dw1 + V_w2 * dw2
show("dV ="+latex(dV))
# Dérivée du premier ordre
sol = solve(dV == 0, dw2)
show(sol[0]/dw1)
Then, calling:
my_procedure(EU)
should do the trick.
dV=(w1,w2,a,p) ↦ adw1pwa−11−adw2(p−1)wa−12
dw2dw1=pwa−11w−a+12p−1
and
V=function('V')(w1, w2)
my_procedure(EU)
leads to
dV=dw1∂∂w1V(w1,w2)+dw2∂∂w2V(w1,w2)
dw2dw1=−∂∂w1V(w1,w2)∂∂w2V(w1,w2)
![]() | 4 | No.4 Revision |
I am not completely sure about your question, but i guess that what you call "procedure" is actually a Python function, which you can define using the def
statement (check for Python introductions, there are very good tutorials online):
var("w1, w2, a, p")
EU(w1, w2, a, p)= p*w1^a+ (1-p)*w2^a
def my_procedure(V):
var("dw1, dw2")
V_w1 = diff(V, w1)
V_w2 = diff(V, w2)
# Differential
dV = V_w1 * dw1 + V_w2 * dw2
show("dV ="+latex(dV))
# Dérivée du premier ordre
sol = solve(dV == 0, dw2)
show(sol[0]/dw1)
Then, calling:
my_procedure(EU)
leads to
dV=(w1,w2,a,p) ↦ adw1pwa−11−adw2(p−1)wa−12
dw2dw1=pwa−11w−a+12p−1
and
V=function('V')(w1, w2)
my_procedure(EU)
my_procedure(V)
leads to
dV=dw1∂∂w1V(w1,w2)+dw2∂∂w2V(w1,w2)
dw2dw1=−∂∂w1V(w1,w2)∂∂w2V(w1,w2)