Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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).

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.