AngouriMath
Simplification
Here we alternate the given expression into different possible forms.
Alternate
The main method for Simplification is methodEntity expr = "sin(x / a) + cos(3) + sqrt(e - x)";
foreach (var alt in expr.Alternate(5))
Console.WriteLine(alt);
Output:
sin(x / a) + cos(3) + sqrt(e - x)
cos(3) + sin(x / a) + sqrt(e - x)
sin(x / a) + cos(3) + sqrt(e - x)
cos(3) + sin(1 / a * x) + sqrt(e + -x)
The only argument of this method is responsible for the number of iterations
the simplification will go through.
The measure of the complexity of an expression is Entity expr = "sin(x / a) + cos(3) + sqrt(e - x)";
foreach (var alt in expr.Alternate(5))
Console.WriteLine(alt.SimplifiedRate);
Output:
37
37
37
49
The user's algorithms should not rely on the number, produced by Critera of complexity and other methods
To change the critera by which an expression's complexity is computed, you may want to change settingEntity expr1 = "a + 0";
Console.WriteLine(expr1.InnerSimplified); // a
Entity expr2 = "sin(x)2 + cos(x)2";
Console.WriteLine(expr2.InnerSimplified); // sin(x) ^ 2 + cos(x) ^ 2
As it could be seen, it will not simplify cases which require applying patterns.
To simplify the latter case, call Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1534 pages online