| 1 | initial version |
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.
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.