I would guess the problem stems from the sage: length = daylength.subs(locals()).n()
line somehow. I would recommend making daylength a function, instead of substituting. I am still not sure exactly what the problem is in the original code though. On Feb 9, 12:35 pm, Stan Schymanski <schym...@gmail.com> wrote: > Dear all, > > For some reason, the meaning of the global constants pi and e (and > maybe others) becomes unavailable to the plot command in the following > example. Is this a bug? > > ---------------------------------------------------------------------- > | Sage Version 3.2, Release Date: 2008-11-20 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > > sage: var('h delta phi doy t') > (h, delta, phi, doy, t) > sage: h = 1/12*pi*(t-12) > sage: delta = -23.45*pi/180*cos(2*pi*(doy+10)/365) > sage: sinbeta = cos(h)*cos(delta)*cos(phi)+sin(delta)*sin(phi) > sage: daylength = 12+24/180*arcsin(tan(phi)*sin(delta)/cos(delta))*180/ > pi > sage: plot(pi*x,x,0,1) > > sage: plot(exp(x),x,0,1) > > sage: doy = 180 > sage: phi = (30*pi/180).n() > sage: length = daylength.subs(locals()).n() > sage: t0 = 12-0.5*length > sage: t1 = 12+0.5*length > sage: plot(pi*x,x,0,1) > ERROR: An unexpected error occurred while tokenizing input > The following traceback may be corrupted or invalid > The error message is: ('EOF in multi-line statement', (546, 0)) > [...] > ValueError: free variable: pi > > sage: plot(exp(x),x,0,1) > [...] > ValueError: free variable: e > > Funnily enough, the following fixes the pi-problem for the time being: > > sage: pi=pi.n() > > But e=e.n() does not fix the e-problem. > > Can anyone help? > > Thanks a lot, > Stan --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---