AngouriMath
AngouriMath copied to clipboard
Incomplete Simplification (Factoring) and Equality Check
The version I use: AngouriMath v1.3.0 from NuGet
Unexpected behaviour or bug: I have the following expression:
Entity expr = "a*c + a*d + b*c + b*d";
When I call Simplify() on it, it becomes the following:
a * (c + d) + b * c + b * d
I would expect it to be the reduced form ((a + b) * (c + d)). Normally this wouldn't be a problem, but testing for equality between these two fails unless they are both in their maximally expanded forms:
Entity expr = "a*c + a*d + b*c + b*d";
Entity expr2 = "(a + b) * (c + d)";
Entity eq = new Entity.Equalsf(expr, expr2);
eq = eq.Simplify();
Console.WriteLine(eq); // Prints "a * (c + d) + b * c + b * d = (a + b) * (c + d)"
expr2 = expr2.Expand();
eq = new Entity.Equalsf(expr, expr2);
eq = eq.Simplify();
Console.WriteLine(eq); // Prints "true"
We require this equality check to function properly, and (hopefully) fixing this simplification bug will make that work.