Symbolics.jl icon indicating copy to clipboard operation
Symbolics.jl copied to clipboard

Simplify does not pull out common factors from polynomials

Open ndinsmore opened this issue 3 years ago • 0 comments

Simplify seems to be struggling with basic polynomial common factor extraction. It in fact seems to favor the expanded form of a factor*polynomial ie 2*(a+b) "simplifies" to 2a+2b.

julia> using Symbolics

julia> @syms a b c
(a, b, c)

julia> simplify(2*(a+b) )
2a + 2b

julia> simplify(2*(1+a+a^2+a^3+a^4+a^5))
2 + 2a + 2(a^2) + 2(a^3) + 2(a^4) + 2(a^5)

julia> simplify( a / (b + c) + a / (b + c)^2 )
(a + a*b + a*c) / ((b + c)^2) 

I understand that sometimes the expanded form is needed for other simplifications to be investigated, but you would expect that once no further simplifications are found in that search tree it reverts to non-expanded form.

ndinsmore avatar Aug 03 '22 11:08 ndinsmore