how to expand/rewrite/simplify (cos(a)+cos(b))^2?
3 ビュー (過去 30 日間)
古いコメントを表示
I have the code below. How to expand/rewrite/simplify the expression f^2 into cos(2a), cos(2b), cos(a+b), cos(2a), cos(2b), cos(a-b), cos(b-a)?
==========================================
syms a b;
f=cos(a)+cos(b);
combine(f^2)
shows (cos(a) + cos(b))^2
rewrite(f^2, 'sincos')
shows (cos(a) + cos(b))^2
simplify(f^2)
shows (cos(a) + cos(b))^2
==========================================
3 件のコメント
Nathan Hardenberg
2023 年 7 月 27 日
I could be wrong, but I don't think this is possible. In the rewrite() documentation you can find a list of functions that can be replaced, but squares/powers are not (yet?) one of the options.
Still I want to mention that you can find multiple simplifications with the following Code:
syms a b
expr = cos(a) + cos(b);
simplify(expr,'Steps',15,'All',true)
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Assumptions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!