Find common factors in two expressions
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
John Miller
el 22 de Abr. de 2020
Comentada: Ameer Hamza
el 5 de Jun. de 2020
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!
0 comentarios
Respuesta aceptada
Ameer Hamza
el 22 de Abr. de 2020
Editada: Ameer Hamza
el 22 de Abr. de 2020
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!