Choose Factorization Modes
Use the FactorMode argument
to choose a particular factorization mode.
Factor an expression without specifying the factorization mode.
By default, factor uses factorization over rational
numbers. In this mode, factor keeps rational
numbers in their exact symbolic form.
syms x
factor(x^3 + 2, x)
ans =
x^3 + 2
Factor the same expression, but this time use numeric factorization
over real numbers. This mode factors the expression into linear and
quadratic irreducible polynomials with real coefficients and converts
all numeric values to floating-point numbers.
factor(x^3 + 2, x, 'FactorMode', 'real')
ans =
[ x + 1.2599210498948731647672106072782,...
x^2 - 1.2599210498948731647672106072782*x + 1.5874010519681994747517056392723]
Factor this expression using factorization over complex numbers.
In this mode, factor reduces quadratic polynomials
to linear expressions with complex coefficients. This mode converts
all numeric values to floating-point numbers.
factor(x^3 + 2, x, 'FactorMode', 'complex')
ans =
[ x + 1.2599210498948731647672106072782,...
x - 0.62996052494743658238360530363911 + 1.0911236359717214035600726141898i,...
x - 0.62996052494743658238360530363911 - 1.0911236359717214035600726141898i]
Factor this expression using the full factorization mode. This
mode factors the expression into linear expressions, reducing quadratic
polynomials to linear expressions with complex coefficients. This
mode keeps rational numbers in their exact symbolic form.
factor(x^3 + 2, x, 'FactorMode', 'full')
ans =
[ x + 2^(1/3),...
x - 2^(1/3)*((3^(1/2)*1i)/2 + 1/2),...
x + 2^(1/3)*((3^(1/2)*1i)/2 - 1/2)]
Approximate the result with floating-point numbers by using vpa.
Because the expression does not contain any symbolic parameters besides
the variable x, the result is the same as in complex
factorization mode.
vpa(ans)
ans =
[ x + 1.2599210498948731647672106072782,...
x - 0.62996052494743658238360530363911 - 1.0911236359717214035600726141898i,...
x - 0.62996052494743658238360530363911 + 1.0911236359717214035600726141898i]