Matlab Symbolic Toolbox: assumptions not considered for expand function

2 views (last 30 days)
I have encountered the following inconsistency while programming with the Matlab Symbolic Toolbox.
From trigonometry we know that cos(a*x) = a*cos(x) if 'a' is a variable that can assume only values +1 and -1 (the same holds for 'sin' function). However, this equivalence is not considered by function 'expand', being values of variable 'a' properly constrained. Here is the example:
____________________________
syms a x
assume(a, 'integer'); assumeAlso(a == +1 | a == -1);
s = cos(a*x);
expand(s)
ans =
cos(a*x)
____________________________
How can I include such "rule" in developing symbolic mathematical expressions?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!