I am in need of a symbolic engine for Python to calcultate max expressions. It is important that we can pass assumptions like "x is a positive symbol" and "y is greater than x" to the engine (the latter is why sympy does not suffice AFAIK).
I am currently testing sage and ran into some disappointing results... Am I doing something wrong here or is this sage's limit?
import sage.all as sage
x = sage.var('x')
y = sage.var('y')
myMax = sage.max_symbolic(x, 2*x)
print(sage.simplify(myMax)) # gives max(x, 2*x) as expected
sage.assume(x, 'integer')
sage.assume(x > 0)
print(sage.simplify(myMax)) # simplifies to 2*x (nice!)
sage.assume(y > 0)
sage.assume(y, 'integer')
myMax = sage.max_symbolic(x, y)
print(sage.simplify(myMax)) # gives max(x, y) as expected
sage.assume(y > x)
print(sage.simplify(myMax)) # now gives y (nice!)
print(sage.simplify(sage.max_symbolic(20*x, 20*y))) # gives 20*y (nice!)
print(sage.simplify(sage.max_symbolic(19*x, 20*y))) # gives max(19*x, 20*y)... why?
print(sage.simplify(sage.max_symbolic(19*x, 20*x))) # gives 20*x, so the above should be deducable
We tell sage that x and y are positive integers and that y > x. Sage can deduce that 20y > 20x (and also 20x > 19x), but it cannot deduce that 20y > 19x? :(
Do I need to do somehing differently or is this how things are in sage?
Thanks for the much appreciated help!