# I want to manipulate max(x/b,a) so that I end up with an expression with max(0,ab-x)

On paper I would factor 1/b and then subtract and add x and end up with the expression I am looking for.

1/b max(x, ab)

1/b {max(0,ab-x) + x}

Is there a way to do this in sage?

You seem to be assuming that b is positive.