2

I am trying to factorise: 5x+10 -> 5(x+2)

Everything I have tried either fails miserably or just returns "10+5*x", or worse.

    public void Factorising()
    {
        var expr = "5*x+10";
        var parsing = Infix.ParseOrThrow(expr);
        var ratExpand = Rational.Expand(parsing);
        var format = Infix.Format(ratExpand);
    }
Returns: 10+5*x

I have also tried using Algebraic.Factors, Rational.Simplify and I am sure others.

Also, is there any decent documentation for MathNet? I am trying to figure out how to use the library from forum posts, their github tests and there's little else for Symbolics...it is a nightmare.

kizzer
  • 150
  • 7
  • There's a tiny amount of documentation at https://symbolics.mathdotnet.com/, but it doesn't seem enough... – Matthew Watson Feb 17 '20 at 15:58
  • @MattheWatson Yeah thank you, I have gone over that too - I want to use the tool, I am sure it works fantastically...but learning to do so is very painful due to the "tiny amount" you mention – kizzer Feb 17 '20 at 15:59
  • I think `Algebraic.Factors` is the proper one, but it might factor symbols only and not numbers. There might not be a way to make `2x+2` into `2(x+1)`. – John Alexiou Feb 18 '20 at 17:34
  • Based on a quick try, Algebraic.Factors didn't factor anything, e.g. returned X^2 - 1 with no change. I didn't seen anything like Infix.Format that takes FSharpList as an argument. – phv3773 Mar 02 '20 at 19:07

0 Answers0