fex: sqrt(2)*n - n + sqrt(2) - 2 $
Neither one of:
but both of:
factor(fex,q^3-7) // Any polynom will do
do factor correctly into
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.
doesn't factor, though
factor(expand( // not even gfactor
(x + 7 sqrt(2)) (x - sqrt(3))