On Jan 1, 2008 6:16 PM, lwd <[EMAIL PROTECTED]> wrote: > > First of all "A Happy New Year to everyone!" > Ok, sage-2.9.1-linux-ubuntu-32bit-i686-Linux on Ubuntu 7.10 machine I > get a plot for this: > sage: maxima.plot2d('[-7.5/-0.5*(x-0.5)+8,-7.5/7.5*(x-0.5)+8]','[x, > 0,8]', '[y, 0, 8],[ylabel,"y"],[gnuplot_preamble, "set grid xtics > ytics"],[legend,false]') > > But not for this ugliness: > > sage: maxima.plot2d('[-7.5/-0.5*(x-0.5)+8, -7.5/7.5*(x-0.5)+8, > -6.5/-0.5*(x-0.5)+8, -6.5/7.5*(x-0.5)+8, -5.5/-0.5*(x-0.5)+8, > -5.5/7.5*(x-0.5)+8, -4.5/-0.5*(x-0.5)+8, -4.5/7.5*(x-0.5)+8, > -3.5/-0.5*(x-0.5)+8, -3.5/7.5*(x-0.5)+8, -2.5/-0.5*(x-0.5)+8, > -2.5/7.5*(x-0.5)+8, -1.5/-0.5*(x-0.5)+8, -1.5/7.5*(x-0.5)+8, > -0.5/-0.5*(x-0.5)+8, -0.5/7.5*(x-0.5)+8]','[x,0,8]', '[y, 0, 8], > [ylabel,"y"], [gnuplot_preamble, "set grid xtics ytics"], > [legend,false]') > > or this > sage: maxima('plot2d([-7.5/-0.5*(x-0.5)+8, -7.5/7.5*(x-0.5)+8, > -6.5/-0.5*(x-0.5)+8, -6.5/7.5*(x-0.5)+8, -5.5/-0.5*(x-0.5)+8, > -5.5/7.5*(x-0.5)+8, -4.5/-0.5*(x-0.5)+8, -4.5/7.5*(x-0.5)+8, > -3.5/-0.5*(x-0.5)+8, -3.5/7.5*(x-0.5)+8, -2.5/-0.5*(x-0.5)+8, > -2.5/7.5*(x-0.5)+8, -1.5/-0.5*(x-0.5)+8, -1.5/7.5*(x-0.5)+8, > -0.5/-0.5*(x-0.5)+8, -0.5/7.5*(x-0.5)+8]','[x,0,8]', '[y, 0, 8], > [ylabel,"y"], [gnuplot_preamble, "set grid xtics ytics"], > [legend,false])')
It would be better to try sage: maxima.eval(...) above. > > which returns: > sage0 > > but no plot. > But in maxima plot2d(...) works, also in maxima.console() > Octave is different; it pops a gnuplot window with some lines and > raise the following error: > sage: octave('fplot("[-7.5/-0.5*(x-0.5)+8, -7.5/7.5*(x-0.5)+8, > -6.5/-0.5*(x-0.5)+8, -6.5/7.5*(x-0.5)+8, -5.5/-0.5*(x-0.5)+8, > -5.5/7.5*(x-0.5)+8, -4.5/-0.5*(x-0.5)+8, -4.5/7.5*(x-0.5)+8, > -3.5/-0.5*(x-0.5)+8, -3.5/7.5*(x-0.5)+8, -2.5/-0.5*(x-0.5)+8, > -2.5/7.5*(x-0.5)+8, -1.5/-0.5*(x-0.5)+8, -1.5/7.5*(x-0.5)+8, > -0.5/-0.5*(x-0.5)+8, -0.5/7.5*(x-0.5)+8]",[0,8])') > --------------------------------------------------------------------------- > <type 'exceptions.TypeError'> Traceback (most recent call > last) > > /home/lwdrob/Disertatie/<ipython console> in <module>() > > /usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/ > expect.py in __call__(self, x) > 736 return x > 737 if isinstance(x, basestring): > --> 738 return cls(self, x) > 739 try: > 740 return self._coerce_from_special_method(x) > > /usr/local/sage/local/lib/python2.5/site-packages/sage/interfaces/ > expect.py in __init__(self, parent, value, is_name) > 987 except (TypeError, KeyboardInterrupt, > RuntimeError, ValueError), x: > 988 self._session_number = -1 > --> 989 raise TypeError, x > 990 self._session_number = parent._session_number > 991 > > <type 'exceptions.TypeError'>: Error executing code in Octave > CODE: > > sage4=fplot("[-7.5/-0.5*(x-0.5)+8,-7.5/7.5*(x-0.5)+8,-6.5/-0.5*(x-0.5)+8,-6.5/7.5*(x-0.5)+8,-5.5/-0.5*(x-0.5)+8,-5.5/7.5*(x-0.5)+8,-4.5/-0.5*(x-0.5)+8,-4.5/7.5*(x-0.5)+8,-3.5/-0.5*(x-0.5)+8,-3.5/7.5*(x-0.5)+8,-2.5/-0.5*(x-0.5)+8,-2.5/7.5*(x-0.5)+8,-1.5/-0.5*(x-0.5)+8,-1.5/7.5*(x-0.5)+8,-0.5/-0.5*(x-0.5)+8,-0.5/7.5*(x-0.5)+8]", > [0,8]); > Octave ERROR: > error: value on right hand side of assignment is undefined > error: evaluating assignment expression near line 1, column 6 > error: near line 1 of file `/home/lwdrob/.sage//temp/lwdrob_comp/7546// > interface//tmp' > error: source: error sourcing file `/home/lwdrob/.sage//temp/ > lwdrob_comp/7546//interface//tmp' > > But in octave and octave.console() in works. Do sage: octave.eval(...) that is equivalent to just typing in the contents of eval to octave. Doing sage: foo = octave(...) is different -- it makes a Python object that wraps an octave object -- this makes no sense if ... doesn't evaluate to an octave object. > Any ideas are welcomed. In that case, here's a quick remark. You can easily just draw the above plots in Sage directly, without using any of gnuplot/maxima/octave at all: show(plot([-7.5/-0.5*(x-0.5)+8, -7.5/7.5*(x-0.5)+8, \ -6.5/-0.5*(x-0.5)+8, -6.5/7.5*(x-0.5)+8, -5.5/-0.5*(x-0.5)+8, \ -5.5/7.5*(x-0.5)+8, -4.5/-0.5*(x-0.5)+8, -4.5/7.5*(x-0.5)+8, \ -3.5/-0.5*(x-0.5)+8, -3.5/7.5*(x-0.5)+8, -2.5/-0.5*(x-0.5)+8, \ -2.5/7.5*(x-0.5)+8, -1.5/-0.5*(x-0.5)+8, -1.5/7.5*(x-0.5)+8, \ -0.5/-0.5*(x-0.5)+8, -0.5/7.5*(x-0.5)+8], 0, 8), ymin=0,ymax=8) Sage has extremely good 2d graphics built in, which are built on matplotlib: http://matplotlib.sourceforge.net/ See http://sagemath.org/doc/html/ref/module-sage.plot.plot.html for how to use it from Sage. Our goal is that this, plus our new interactive 3d graphics (coming soon), will be substantially better than gnuplot (which is what both Maxima and Octave rely on for the above commands). If nothing else, the *license* is much better than the gnuplot license, which is not GPL-compatible. This is why Sage cannot include gnuplot, and programs such as Octave and Maxima can't (legally) binary link with gnuplot. If you check the Octave devel mailing list, you'll see one of the main pushes in Octave development right now is a new graphics engine so that can get away from gnuplot. -- William -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@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-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---