## 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) + 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 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:

2019-2021 Angouri · Project's repo · Site's repo · Octicons