Joint brackets to take action


(Tyetis) #1

How can I get the bracket joint ?

2x + 2y = 15
To
2*(x + y) = 15

Another example

x^2 + 2xy + y^2 = 10
To
(x + y)^2 = 10


(Christoph Rüegg) #2

We don’t have a full factorization routine yet. In these two specific cases Polynomial.factorSquareFree can achieve exactly that, but I do not expect this to work reliably in all cases.

E.g. in F#:

open Operators
let x = symbol "x"
let y = symbol "y"

2*x + 2*y |> Polynomial.factorSquareFree x             // 2*(x + y)
x**2 + 2*x*y + y**2 |> Polynomial.factorSquareFree x   // (x + y)^2