**labels**: --> Lisp Core - Polynomials**priority**: 5 --> 3

fex: sqrt(2)*n - n + sqrt(2) - 2 $

Neither one of:

factor(fex)

factor(fex),algebraic:true

factors fex.

but both of:

gfactor(fex)

factor(fex,q^3-7) // Any polynom will do

do factor correctly into

(sqrt(2)-1)*(n-sqrt(2))

This behavior difference is not documented, and is confusing.

Of course, the semantics are not entirely clear, and anyway the current code doesn't work for all cases you'd like, e.g.

gfactor(expand(

(x-sqrt(2)+sqrt(3))*(x+sqrt(2)*3+sqrt(3))

))

doesn't factor, though

factor(expand( // not even gfactor

(x + 7 sqrt(2)) (x - sqrt(3))

))

does.

-s