Hi all
I'm searching for a function
f(x)=1 if x in [a,b], =0 otherwise
Of course I can do
a=0
b=1
def characteristic(x):
if x<a:
return 0
if x>b:
return 0
return 1
but the problem is that this is not a real "function" in the sense that
sage: f(x)=x*characteristic(x)
will not produce the expected result because characteristic(x) always
evaluates to 0.
Should I use piecewise functions ?
Thanks for any advice !
Laurent
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org