This is the code to the implicit differentiaion of a function from the theoretical point of view
var("w1, w2, a, p")
EU(w1, w2, a, p)= p*w1^a+ (1-p)*w2^a
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)
Now without to be obliged to rewrite all the commands, I would like to apply this procedure to the EU function or any other function. I have tried to use dV.substitute_function(V, EU)
and (sol[0]/dw1).right_hand_side()
but without success. I have an amplified problem for the second order derivative since I am nosure of my formulation due to the fact that one must substitute the first order derivative inside derivation.