1 | initial version |
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.
2 | No.2 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
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 = \left( w_{1}, w_{2}, a, p \right) \ {\mapsto} \ a \mathit{dw}_{1} p w_{1}^{a - 1} - a \mathit{dw}_{2} {\left(p - 1\right)} w_{2}^{a - 1}$
$\frac{\mathit{dw}_{2}}{\mathit{dw}_{1}} = \frac{p w_{1}^{a - 1} w_{2}^{-a + 1}}{p - 1}$
and
V=function('V')(w1, w2)
my_procedure(EU)
leads to
$dV = \mathit{dw}_{1} \frac{\partial}{\partial w_{1}}V\left(w_{1}, w_{2}\right) + \mathit{dw}_{2} \frac{\partial}{\partial w_{2}}V\left(w_{1}, w_{2}\right)$
$\frac{\mathit{dw}_{2}}{\mathit{dw}_{1}} = -\frac{\frac{\partial}{\partial w_{1}}V\left(w_{1}, w_{2}\right)}{\frac{\partial}{\partial w_{2}}V\left(w_{1}, w_{2}\right)}$
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 = \left( w_{1}, w_{2}, a, p \right) \ {\mapsto} \ a \mathit{dw}_{1} p w_{1}^{a - 1} - a \mathit{dw}_{2} {\left(p - 1\right)} w_{2}^{a - 1}$
$\frac{\mathit{dw}_{2}}{\mathit{dw}_{1}} = \frac{p w_{1}^{a - 1} w_{2}^{-a + 1}}{p - 1}$
and
V=function('V')(w1, w2)
my_procedure(EU)
my_procedure(V)
leads to
$dV = \mathit{dw}_{1} \frac{\partial}{\partial w_{1}}V\left(w_{1}, w_{2}\right) + \mathit{dw}_{2} \frac{\partial}{\partial w_{2}}V\left(w_{1}, w_{2}\right)$
$\frac{\mathit{dw}_{2}}{\mathit{dw}_{1}} = -\frac{\frac{\partial}{\partial w_{1}}V\left(w_{1}, w_{2}\right)}{\frac{\partial}{\partial w_{2}}V\left(w_{1}, w_{2}\right)}$