Substitute a function in a formal derivative
This gives a nice result.
var('p w0 c g dc dg dp dw0')
EUa=function('EUa')(p,w0,c,g)
EUa_c=diff(EUa,c)
EUa_g=diff(EUa,g)
#
EUna=function('EUna')(p,w0,c,g)
EUna_g=diff(EUna,g)
EUna_c=diff(EUna,c)
##
dEUa=EUa_c*dc + EUa_g*dg
dEUna=EUna_c*dc + EUna_g*dg
###
show(EUa)
show(EUna)
show(dEUa)
show(dEUna)
sol=solve(dEUa==dEUna, dg)
sol=(sol[0]/dc).full_simplify()
show(sol)
But now, I would like to substitute to EUa(p,w0,c,g) = p*U(w0)+(1-p)*U(0)
and EUna(p,w0,c,g) = p*U(w0-c)+(1-p)*U(g*w0-c)
then, later change the unknown function U(w)
to say ln(w)
or w^(1/2)
. I suppose I need to define first a function U=function('U')(w)
after to define w
as a variable. But all my tentatives fail.
Hints :
use variable names in formal differentiations (e. g.
diff(f(x,y).x)
instead ofdiff(f, x)
).lookup
substitute_function?
Hi @Emmanuel Charpentier
SageMath 9.2 notebook , W10
Object
substitute_function
not found.It's a method of symbolic expression objects. Dotting the "i"s and crossing the "t"s, try :
[ Snip...]