On Tue, Nov 15, 2011 at 7:01 PM, Dan Drake <dr...@kaist.edu> wrote: > Hello, > > At ticket #12035, I posted a patch that makes list_plot do the obvious > thing when given a list such as > > [1+I, 2+I, 4-I] > > The only way I could see for detecting "genuine" complex number input > was to iterate over the entire input, running CC() on everything and > looking for nonzero imaginary parts (and also looking for input that is > of a complex number type). > > This represents a slowdown, of course. My question is, is it too much of > a slowdown? > > My thinking is this: list_plot is typically used interactively, on lists > with maybe 1000 entries. On my machine, I get: > > sage: foo = [random() for _ in range(1000)] > sage: %timeit [CC(_) for _ in foo] > 125 loops, best of 3: 7.05 ms per loop > > I doubt anyone will mind if their plot takes an additional 7 > milliseconds to appear. Moreoever, I really like it when the computer > does the obvious thing -- if I have a function that plots points in two > dimensions, and I give it [1+I, 2+I, 4-I], there's only one reasonable > thing I could mean. > > What are your thoughts? Suggestions for the patch are welcome.
Right now, we have: sage: list_plot([1+I, 2+I, 4-I]) Traceback (most recent call last): ... TypeError: unable to simplify to float approximation I suppose you could rewrite list_plot so that it calls a function _list_plot that works just like the one now, and if it catches a TypeError, then -- and only then -- CC'ify all the entries of the input list. That would probably solve the problem with no slowdown at all in cases that are currently supported. Anyway... > > Thanks. > > Dan > > -- > --- Dan Drake > ----- http://mathsci.kaist.ac.kr/~drake > ------- > -- William Stein Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org