How to collect sin(t) or (sin(t)) ^2 coefficients in a expression

Your b is a vector, not a scalar. Try b[1] and the above should flow through. (In the first post, you have b=a'*a which dispatches to dot which should return a scalar in this usage.)

1 Like