First time here? Check out the FAQ!
answered 2022-08-03 23:17:30 +0100
One can use wildcards for this purpose:
f = cos(x)*(sin(x))^2+cos(x)^3*(sin(x))^5 w = SR.wild(0) f.subs({sin(x)^w:((1-cos(x)^2)^floor(w/2)*sin(x)^(w-2*floor(w/2)))})