1 | initial version |
Hint:
sage: ddom(x,y)
abs(x - 0.500000000000000) - 0.500000000000000
This shows that SageMath (or rather, Python) didn't catch your intended meaning when you wrote max
. If you want to work with symbolic expressions involving the maximum, then you should use the symbolic maximum:
sage: ddom(x,y)=max_symbolic(abs(x-0.5),abs(y-0.5))-0.5
sage: ddom(x,y)
max(abs(x - 0.500000000000000), abs(y - 0.500000000000000)) - 0.500000000000000
sage: ddom(10,20)
19.0000000000000
If you don't need symbolic expressions, then you can also define a Python function instead:
sage: ddom2 = lambda x,y: max(abs(x-0.5),abs(y-0.5))-0.5
sage: ddom2(10,20)
19.0000000000000