# Revision history [back]

I think the issue is the double inequality in assume: only the first one is taken into account, as one can check with the function assumptions(), which returns the list of assumptions known to Sage:

sage: assume(0 <= x <= 1/2)
sage: assumptions()
[0 <= x]


Actually, one shall use assume with two single inequalities instead of a double inequality:

sage: assume(0 <= x, x <= 1/2)
sage: assumptions()
[0 <= x, x <= (1/2)]


Then your function will return 1 for f(x), as expected.