# Revision history [back]

### max_symbolic, polynomial expressions, assumptions

The following works as expected:

var('b')
with assuming(b>1):
v = max_symbolic(7*b-5,0).full_simplify()
print(v)


yields 7*b - 5

The following does not (maybe my expectations are unrealistic)

with assuming(b>1):
v = max_symbolic(b^2-b+1,0).full_simplify()
print(v)


yields max(0, b^2 - b + 1), even though the latter expression is always > 3/4

I have a bunch of expressions such as the one below, that I want to analyze, to get a piecewise-defined function:

print(myexpr,"\n\n")
print(myexpr.full_simplify(),"\n\n")
with assuming(a>2):
print(myexpr.full_simplify(),"\n\n")

max(max(3, a + 1) + 2*max(2*max(3, a + 1) + 1, a + max(3, a + 1)), a*max(3, a + 1) + max(2*max(3, a + 1) + 1, a + max(3, a + 1)))

max(max(3, a + 1) + 2*max(2*max(3, a + 1) + 1, a + max(3, a + 1)), a*max(3, a + 1) + max(2*max(3, a + 1) + 1, a + max(3, a + 1)))

max(5*a + 7, a^2 + 3*a + 3)


This is good, however:

with assuming(a>2000):
print(myexpr.full_simplify())


yields max(5a + 7, a^2 + 3a + 3)

Can such expressions, as above, in max_symbolic be converted into piecewise defined functions? (I would also be interested in having more than one parameter, and having SAGE partition the parameter space appropriately and automatically).