I am not perfectly sure that the following code evaluate the implicit differentiation of the function UU
. In all case what I expect is to fint ∂w2/∂w1 and then ∂w22/∂2w1
U=function('U')(x)
w2=function('w2')(w1)
U=U(x)
UU=p*U(w1)+(1-p)*U(w2)
diff(UU, w1)
then I would like to substitute U(x)=log(x) or U(x)=xa or $U(x) = -\exp(-ax).Andasanimpliedquestion,Iwouldliketoknowhowtoselectpartofanexpressionlikeforinstance\exp(ax + b)+ f(x) -> a, \text{ or } a*x \text{ or } f(x)$. As every expression in Mathematica is a three, is not difficult to saw a branch. But in Sagemath I wonder how to do.