answered 4 years ago
You can define a piecewise symbolic function, see https://doc.sagemath.org/html/en/reference/functions/sage/functions/piecewise.html