Ask Your Question

Revision history [back]

Sage has a "hold" context for some operations, but I don't see how to use it to answer the question.

Especially since the hold context seems quite fragile with respect to substitution.

As a workaround, one can use SymPy inside Sage.

Here are some things one can do with "hold", in case it helps.

sage: a = x
sage: a = a.mul(8, hold=True)
sage: a = a.mul(5, hold=True)
sage: a
5*(8*x)
sage: a.unhold()
40*x