This doesn't answer your question but might provide a temporary workaround: sage: P = list_plot([Q(1+i/100) for i in srange(900)]) sage: show(P)
On Jan 27, 2008 9:39 PM, Jonathan Bober <[EMAIL PROTECTED]> wrote: > > Does anyone know what's going on in the following example? I can't seem > to reproduce this with a simple example. Basically, I create a few > 'callable symbolic expressions', and then define a lambda function that > calls a one of them. > > Ultimately, I have a function > > Q = lambda x : RR(bound(15000, 15000^x)) > > which takes a float and returns a float. (Well, if I change 'RR' to > 'float' in the above code, I get the same result.) So, as far as I can > tell, the plot() function should just see a function that takes a float > and returns a float, and it should just plot it without complaining. > > Also, if I change my callable symbolic expressions to lambdas, this > still doesn't work. > > But, if I replace Q with > > Q = lambda x : RR(sin(x)) > > the everything works fine. > > I suspect that I might be doing something wrong, since I can't reproduce > this with something simpler (and I don't like sending 'what is wrong > with my code'-type emails to sage-devel instead of sage-support), but > the same thing was happening to me yesterday and I just tried rewriting > from scratch, and I don't know what's going on. Maybe there is some sort > of bug in sage. > > Here's the code, and the error. > > sage: M = var('M') > sage: B = .561459483 > sage: C1(M) = 1/(4*pi^2) * (B/(log(M))) * (1 - 1/(2 * log(M)^2))^2 > sage: C2(M) = 2/(M - 1)^(1/2) * (log(M)^2)/B * (1 - 1/(2 * log(M)))^(-1) + > 1/(M-1) > sage: bound(N,M) = N * C1(M) - N^2 * C2(M) > sage: Q = lambda x : RR(bound(15000, 15000^x)) > sage: Q(10) > 2.21828479338329 > sage: P = plot(Q, (1, 10)) > --------------------------------------------------------------------------- > <type 'exceptions.TypeError'> Traceback (most recent call last) > > /home/bober/<ipython console> in <module>() > > /home/bober/sage/local/lib/python2.5/site-packages/sage/plot/plot.py in > __call__(self, funcs, *args, **kwds) > 2394 # if there is one extra arg, then it had better be a tuple > 2395 elif n == 1: > -> 2396 G = self._call(funcs, *args, **kwds) > 2397 elif n == 2: > 2398 # if ther eare two extra args, then pull them out and > pass them as a tuple > > /home/bober/sage/local/lib/python2.5/site-packages/sage/plot/plot.py in > _call(self, funcs, xrange, parametric, polar, label, **kwds) > 2470 del options['plot_division'] > 2471 while i < len(data) - 1: > -> 2472 if abs(data[i+1][1] - data[i][1]) > max_bend: > 2473 x = (data[i+1][0] + data[i][0])/2 > 2474 try: > > <type 'exceptions.TypeError'>: 'float' object is unsubscriptable > sage: > > > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---