I'm trying to make a bunch of plots so I can assemble them together into a video. Here's my code:
import mpmath
erfc = mpmath.erfc
def partial(n, x, t):
return sum(erfc((2*n+1-x)/(2*sqrt(t))) - erfc((2*n+1+x)/(2*sqrt(t)))
for n in range(n+1))
start = 1
step = 100
for n in [start/step, (start+1)/step..1/2]:
print n
plot(lambda x: partial(10, x, n), (0, 1)).save('/tmp/%05d.png' %
(n*step))
(It's plotting solutions to the heat equation, where one end of a rod is
being held at temperature zero, the other end at temperature 1.)
When I run the above code, the first bunch of images work fine, but over
time, Sage uses more and more memory. If I kill the script and evaluate
the corresponding plot commands, everything works fine. This seems like
a memory leak, but I don't know how to track those down.
Any suggestions for how to avoid the memory problems?
Thanks,
Dan
--
--- Dan Drake
----- http://mathsci.kaist.ac.kr/~drake
-------
signature.asc
Description: Digital signature
