>> Note that you need to use "randomize=False" in plot if you're doing
>> this, because otherwise the plot positions are different each time
>> (!), so caching the function is useless. I don't understand the
>> motivation for having that be the default behaviour.
>
> Better than having a set algorithm that will perform poorly in edge
> cases (e.g. periodic functions). The adaptive algorithm could
> certainly be improved - it nearly always produces more points than you
> ever need, and produces monstrosities like plot(tan(x),-10,10) - but
> overall this has served us well.
Adaptive != non-reproducible, though.
I can understand why having an adaptive approach which uses random
numbers is more robust than "dx=(xmax-xmin)/100" etc. What I don't
understand is why the default behaviour isn't to use a set seed so
that the result of plotting calls would be reproducible.
If there's a real difference between using one seed and the next, in
that sometimes it produces a good plot and sometimes it doesn't, then
aren't you going to need to control the seed anyway to get the good
plot back? And if there isn't a real difference, then why not simply
pick one and get all the benefits of the adaptive approach while
preserving reproducibility?
(Having re-read the docs it looks like I should have added
adaptive_recursion=0, not just randomize=False.)
To avoid possibly causing problems for tough functions, then, I guess
setting the random seed is better than using the randomize flag:
# or a python function:
def f(x):
print 'called with',x
return x**2
g = CachedFunction(f)
set_random_seed(3)
plot(g, 0, 10) # this is very noisy because of the print
set_random_seed(3)
plot(g, 0, 10) # this is quiet
Doug
--
Department of Earth Sciences
University of Hong Kong
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org