Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

2 questions : savefig + show

hello here my code that works

x=var('x')
f(x)=exp(-1/x^2)
p=[]
legendes=[]
for n in range(8):
    dn(x)=diff(f(x), x, n)
    print("f^(",n,")(x)=",dn(x))
    delta=n/2
    p.append(\
        plot(dn(x)/factorial(n),-4+delta,4-delta)\
        +text("n="+str(n),(0,0.1*factorial(n)),color="green",bounding_box={'boxstyle':'round', 'fc':'w'}))
show(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7])
#save(p[0]+p[1]+p[2]+p[3]+p[4]+p[5]+p[6]+p[7],"~/Desktop/toto.png")

#savefig("~/Desktop/toto.png")

my questions :

a) how can i automatize the show, can i write. For example :

show(p[i] for in in range(8))

dont give the image but a code that says : <πšπšŽπš—πšŽπš›πšŠπšπš˜πš›Β πš˜πš‹πš“πšŽπšŒπšΒ <πšπšŽπš—πšŽπš‘πš™πš›>Β πšŠπšΒ πŸΆπš‘πŸ·πŸΌπŸΎπš‹πŸ·πšπšπŸ»πŸΆ>

b) i can't find the way to save instead of show

in the help, the formulation is something like A.save but i can't get it, dont understand how to write this type of code with mine ?

thanks :-)