AngouriMath
Navigation
Simplification
Here we alternate the given expression into different possible forms.
Alternate
The main method for Simplification is method
Entity 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) + sqrt(e - x) + sin(x / a)
cos(3) + sin(x / a) + 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
Method
Critera of complexity and other methods
To change the critera by which an expression's complexity is computed, you may want
to change setting
Entity 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
Same way as with
Extension:
Conditions on the answer: provided
A rewrite that removes a singularity carries a condition, so that the answer does not claim a
value the input never had.
Entity expr = "x / x";
Console.WriteLine(expr.Simplify());
Output:
1 provided not x = 0
Entity expr = "x ^ x";
Console.WriteLine(expr.Differentiate("x").Simplify());
Entity expr2 = "ln(x) / x";
Console.WriteLine(expr2.Differentiate("x").Simplify());
Output:
x ^ x * (1 + ln(x))
(1 - ln(x)) / x ^ 2
What decides it is the expression's own domain condition, read in the codomain the question is
asked in (
Entity expr = "tan(x) provided not cos(x) = 0";
Console.WriteLine(expr.Simplify());
Output:
tan(x)
A condition the expression does not state stays —
Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 5629 pages online