Substitution in implicit function
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.
What is
V
?V=function('V')(w1, w2). The solution you propose works nicely but not for the theoretical presentation since
my_procedure(V)
return an error. I would like both but at last this is nice. Then I realize it suffice ta addreturn
to your code to obtain what I was searching. ThanksI am not sure what is wrong in my answer which merits a downvote, I do not get an error for the abstract
V
, see my update.