Hi all,
Typing a correction on some recurrent sequences $u_{n+1}=f(u_n)$ I use sage to build a nice plot illustrating the behavior of the sequence depending on the initial data. I took a nice function from this awesome book.
def escargot(f,x,u0,n,xmin,xmax,file):
u = u0
P = plot(x, x, xmin, xmax, color='gray')
for i in range(n):
P+= line([[u,u],[u,f(u)],[f(u),f(u)]], color ='red')
u = f(u)
P += f.plot(x, xmin, xmax, color='blue')
P.save('/home/myfolder/f1a.png')
So everyhting work perfectly but, since there is a lot of examples to produce, I would like to make the function to have an extra argument say filename so that now the file so that now the plot is saved in /home/myfolder/filename.png, but I have no idea how sage manipulate string. Help would be welcome !