• Factor factors a symbolic polynomial over the integers.
  • Factor applies only to scalar parts of expressions.
  • Factor applies only to the top algebraic level in an expression.
  • Factor tries to factor all scalar combinations of tensors (like k_a*k^a), which it treats as independent variables. Factor[[FactorScalars: false]] will apply only to symbolic expressions, which contain no any indexed variables.


Factor a multivariate polynomial:

def t = '2*x**3*y - 2*a**2*x*y - 3*a**2*x**2 + 3*a**4'.t
println Factor >> t
   > (x+a)*(x-a)*(-3*a**2+2*y*x)

Factor scalar parts in tensorial expression:

def t = '(a+b)**4*F_mn + (x**6-y**6)*R_mn'.t
println Factor >> t
   > (a+b)**4*F_mn+(x+y)*(x-y)*(x*y+x**2+y**2)*(-x*y+x**2+y**2)*R_mn

Factor expression that contains scalar combinations:

def t = '(a+b)**2*f_m*f^m + (a**2 - b**2)*f_a*f^a*f_b*f^b'.t
println Factor >> t
   > (a+b+(a-b)*f_{m}*f^{m})*(a+b)*f_{a}*f^{a}
Do not factor “tensorial” scalars:
println Factor[[FactorScalras:false]] >> t
   > (a+b)**2*f_{m}*f^{m}-(b+a)*(b-a)*f_{a}*f^{a}*f_{b}*f^{b}

See also