Find common factors in two expressions

13 ビュー (過去 30 日間)
John Miller
John Miller 2020 年 4 月 22 日
コメント済み: Ameer Hamza 2020 年 6 月 5 日
Is there some function so I can find a common factor in multiple expressions?
For example: syms x y
a= 5*(x^4/y)
b= 27*(x^4/y)
=> x^4/y is a common factor.
The reason I'm asking this is that I have some very long expressions I need to sum up. In order to shorten some stuff I would like to extract common factors and assign them to some variable. Thankful for any help!

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 22 日
編集済み: Ameer Hamza 2020 年 4 月 22 日
syms x y
a = 5*(x^4/y);
b = 27*(x^4/y);
common_factor = gcd(a,b);
Result:
>> common_factor
common_factor =
x^4/y
  2 件のコメント
John Miller
John Miller 2020 年 6 月 5 日
Thank you!
Ameer Hamza
Ameer Hamza 2020 年 6 月 5 日
I am glad to be of help!

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by