AngouriMath

Navigation

← Back to list of members

Factorize​(System.​Int32)

 Method (no overloads)

Summary

Factorizes an equation trying to eliminate as many power-uses as possible ( e.g. x * 3 + x * y = x * (3 + y) )

Parameter "level"

The number of iterations (increase this argument if some factor operations are still available)

Example

using System;
using static AngouriMath.MathS;

var (x, y) = Var("x", "y");

var expr1 = x * y + y + x + 1;
Console.WriteLine(expr1);
Console.WriteLine(expr1.Factorize());
Console.WriteLine("-----------------------------------");
var expr2 = x * y + y + (1 + x);
Console.WriteLine(expr2);
Console.WriteLine(expr2.Factorize());

Prints
x * y + y + x + 1
y * (1 + x) + x + 1
-----------------------------------
x * y + y + 1 + x
(1 + x) * (1 + y)

Remarks

One pass is the perfect-square rules, then the factorisation rules, then
InnerSimplified -- so that the factors come back finished, since
the rules leave x ^ 1 where they mean x and sqrt(4) where
they mean 2 -- and level is how many times that runs.
Built out of RewriteRules by
FactorizationAtLevel(System.Int32).

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1953 pages online