On 5/20/07, jperry <[EMAIL PROTECTED]> wrote: > > I guess I solved my own problem: > > show( eval( maxima.eval( "sin(x)" ) ).plot( x, -5, 5 ) ) > > On May 20, 2:14 pm, jperry <[EMAIL PROTECTED]> wrote: > > What's the proper method to plot a Maxima function? Maybe I'm > > misunderstanding the syntax, but something like: > > > > show( maxima("x*sin(x)").plot( x,-5,5 ) ) > > > > gives me a graph consisting of axes with "x*sin(x)" printed in the > > center of the graph (no plot). > > > > Using plot2d() works, but I'd prefer not to use Gnuplot since I'm > > using the web-based notebook and my browser can't display EPS files. > > > > I can also use something like: > > > > L = [(x, maxima.eval( "float(sin(%s))"%x )) for x in range(-5,5)] > > show( line(L) ) > > > > Is there a simplier way? AFAIK I can't avoid using Maxima because I'm > > using some ODE/Laplace functions that don't exist natively.
Unfortunately, in your follow up post you didn't fix your problem, since you just ended up plotting sage's sin function. But using a strategy like you are using above, e.g., show ( plot( lambda x: float(maxima('sin(%s)'%x)), 0, 10 ) ) is probably a good way to go. NOTE -- it *will* be slow, since there is a separate call to maxima to evaluate every single point of the plot -- this might not be a problem for your application, though. So you might want to restrict the number of evaluation points, e.g., show ( plot( lambda x: float(maxima('sin(%s)'%x)), 0, 10 , plot_points=10, plot_division=0) ) Note that as of sage-2.5, we have much much better support for symbolic calculus type stuff directly in SAGE without having to use maxima at all. You might want to try it out. E.g., We compute a few Laplace transforms: sage: sin(x).laplace(x, s) 1/(s^2 + 1) sage: (z + exp(x)).laplace(x, s) z/s + 1/(s - 1) sage: var('t0') t0 sage: log(t/t0).laplace(t, s) (-log(t0) - log(s) - euler_gamma)/s See http://sagemath.org/doc/html/ref/module-sage.calculus.calculus.html and the sections around that section. .... And it's so cool that you -- my office mate from Northern Arizona University in 1994 -- are using SAGE! William --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---