I was wondering if there was a way to automatically display cosine/sine of the sum of symbolic variables. I'm multiplying symbolic matrices and in one cell of the result I have something like
cos(A)*cos(B)-sin(A)*sin(B)
where A
and B
are my symbolic variables. Is there a way to automatically display in every occurrence of that the actual cosine of the sum such that the cosine identity is given?
cos(A+B)
Use simplify
syms A B
simplify(cos(A)*cos(B)-sin(A)*sin(B))
ans =
cos(A + B)