Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Recursive problems in Sage

I've been trying to figure out how to run a basic recursive problem in sage. The basic structure of the problem I have figured out, its just a matter of putting it in terms of a for/ while loop.

#Initializing values
k,k1,vk,beta,vk1=var('k,k1,vk,beta,vk1')
vk= log(k-k1)+beta*log(k1)

#I want to loop this procedure
FOC=vk.diff(k1)
k1star=solve(FOC==0,k1)
vk=(vk).subs(k1star)
vk

Any help is appreciated.