Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 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.

click to hide/show revision 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.

click to hide/show revision 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.

leads to

dV=(w1,w2,a,p)  adw1pwa11adw2(p1)wa12

dw2dw1=pwa11wa+12p1

and

V=function('V')(w1, w2)
my_procedure(EU)

leads to

dV=dw1w1V(w1,w2)+dw2w2V(w1,w2)

dw2dw1=w1V(w1,w2)w2V(w1,w2)

click to hide/show revision 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)  adw1pwa11adw2(p1)wa12

dw2dw1=pwa11wa+12p1

and

V=function('V')(w1, w2)
my_procedure(EU)
my_procedure(V)

leads to

dV=dw1w1V(w1,w2)+dw2w2V(w1,w2)

dw2dw1=w1V(w1,w2)w2V(w1,w2)