how to check if two symbolic fractions are the same?

2 views (last 30 days)
I have two fractions that have so many symbolic variables and are too complicated, but are in different forms. How can I check if they are equal to each other? For example:
syms x y z
fraction1 = (x+y)/(x*y) + z;
fraction2 = (x+y+x*y*z)/(x*y);
How can I check if fraction1 and fraction2 are the same?

Accepted Answer

Torsten on 27 Jul 2023
syms x y z
fraction1 = (x+y)/(x*y) + z;
fraction2 = (x+y+x*y*z)/(x*y);
ans = logical

More Answers (1)

the cyclist
the cyclist on 27 Jul 2023
You can use isequal or isAlways, depending on the specific need. I suggest that you read the documentation, because there are nuances.




Community Treasure Hunt

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

Start Hunting!