First time here? Check out the FAQ!
answered 2022-06-20 18:42:45 +0100
Sage's symbolic ring has "wildcards" for advanced substitutions.
For example, starting from the expression in the question:
sage: w0 = SR.wild(0) sage: a.subs({sin(w0)/cos(w0): tan(w0)}) tan(x^2 + x + 1)