collects all constant symbols in expr.
CollectConstants[expr, vars]
collects the constant symbols vars in expr.
CollectConstants[expr, !vars]
collects all constant symbols in expr except vars.
  • Expression of the form c_2 T_1+c_1 T_2 T_1+c_2 T_2 T_1+c_1 T_3 get collected to (T_2T_1+T_3) c_1+(T_1+T_2T_1) c_2, where the c_i's are constants and the T_i's are tensors.
  • The second argument vars can either be a single constant symbol or a list of constant symbols.
  • The following options can be given:
SimplifyMethodCollectTensorshow collected prefactors are simplified