On Fri, Feb 4, 2011 at 11:37 AM, Renato Budinich <renn...@gmail.com> wrote:
> hello,
> why is the below code plotting a flat function rather than a box one?

When you do,

> plot(box(x,1),(x,-3,3))

it evaluates box(x,1) which returns 0 because the variable x is not
always less than 1.  You need to delay the evaluation of this
function:

sage: plot(lambda x: box(x,1),(x,-3,3))

or

sage: from sage.misc.decorators import specialize
sage: f = specialize(c=1)(box)
sage: plot(f,(x,-3,3))

or

sage: from functools import partial
sage: f = partial(box, c=1)
sage: plot(f,(x,-3,3))

--Mike

-- 
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
URL: http://www.sagemath.org

Reply via email to