| 1 | initial version |
Here are two other options:
1) Use the Heaviside function:
f(x)=heaviside(x-1)-heaviside(x-3)
plot(f(x),(x,0,5))
2) define a Python function
def f(x,a,b):
if x>a and x<b:
return(1)
else:
return(0)
plot(lambda x: f(x,1,3),(x,-3,5))
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.