# Revision history [back]

In general, a Sage object foo.sobj is a (Python) pickle of a Sage/Python thing (nearly anything). However, in this instance, the documentation means that one can plot functions or certain other things, like circles, arcs, as well as elliptic curves or anything else that has a .plot() method.

So much for that. What is the problem with the errors? It turns out your first thing works in Sage without numpy

H=lambda x: (sign(x)+1)/2
P = lambda x, a,b: H(x - a) - H(x - b)
plot(P(x,5,10), (x,-10,20))


because P is a function of one variable the way you made it

sage: P(x,5,10)
-1/2*sgn(x - 10) + 1/2*sgn(x - 5)


but

sage: from numpy import sign
sage: P(x,5,10)
0


because symbolic expressions apparently always have sign 1 when compared with Numpy's sign.

Similarly,

sage: BOX510 = lambda x: P(x,5,10)
sage: plot(BOX510, (x,-10,20))


works great, but try to make it BOX510(x) and you are trying to do this.

sage: preparse('BOX510(x) = lambda x: P(x,5,10)')
'__tmp__=var("x"); BOX510 = symbolic_expression(lambda x: P(x,Integer(5),Integer(10))).function(x)'


and you can't make a symbolic expression from a lambda function. The moral of the story is to be careful when mixing Sage expressions with Python ones.