AngouriMath
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)
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1534 pages online