factorization of Multivariate polynomial

조회 수: 37 (최근 30일)
Bruno Luong
Bruno Luong 2023년 3월 6일
댓글: Walter Roberson 2023년 12월 2일
Hello, I want to factorize a multivariate polynomial in a complex field. I just don't understand why the result of this simple polynomial
syms x y
F = factor(x^2+y^2,'FactorMode','complex')
F = 
and not (x + i*y)*(x - i*y)?
Is there any third-party toolbox/code that can carry out the problem of factorization multivariate polynomial?
NOTE: in 1D it's equivalent to finding the roots of the polynomial3

답변 (2개)

Manikanta Aditya
Manikanta Aditya 2023년 3월 17일
Hi Bruno,
As per my understanding, you want to factorize a polynomial in a complex field, and you are getting result of this simple polynomial.
The reason why the factorization of x^2+y^2 using ‘factor’ function in MATLAB returns a different result than (x + i*y)*(x - i*y) is because ‘factor’ function only returns factors with real coefficients by default.
Since the factors (x + i*y) and (x - i*y) have complex coefficients, they are not returned by the ‘factor’ function. If you want to obtain factors with complex coefficients, you can use the factor function with the option 'FactorMode','full'.
syms x y
F = factor(x^2+y^2,'FactorMode','full')
F = 
‘Factormode’ parameter set to ‘full’ will include complex conjugate pair of factors.
For further reference, please go through this link for knowing about symbolic factors:
I hope this resolves the issue you are facing.
  댓글 수: 14
Paul
Paul 2023년 3월 23일
편집: Paul 2023년 3월 23일
syms x y;
p = x^2 + y^2;
The following line isn't actually a documented syntax of solve. There is a note in the inputs section that says "By default, solve uses the variable determined by symvar." I think that should really be symvar(eqn,1). Contrast with diff and the very first syntax and its description.
roots_p = solve(p);
Anyway, this line actually soved for symvar(p,1), so the correct expression would be
factors_p = prod(symvar(p,1) - roots_p)
factors_p = 
Bruno Luong
Bruno Luong 2023년 3월 23일
@Paul, this is similar to @John D'Errico solution but without doing explicit division. This is neat, thanks.

댓글을 달려면 로그인하십시오.


John D'Errico
John D'Errico 2023년 3월 17일
This is a bit of a hack of course, since factor seemingly should have solved the problem with the appropriate setting. The problem with the complex FactorMode is the polynomial is not one with constant coefficients.
syms x y a b
C = coeffs(x^2 + y^2 - (x + a*y)*(x + b*y),x)
C = 
[a,b] = solve(C == 0,a,b)
a = 
b = 
Thus finding the two solutions. Pick either one to factor the original polynomial.
As I said, a hack. But perhaps another idea is to non-dimensionalize the problem, factoring out the highest order of one variable. Essentially, divide by y^2 below. So we would have
P = x^2 + y^2
P = 
Q = P/y^2;
syms u
Q = simplify(subs(Q,x,u*y))
Q = 
QF = factor(Q,'FactorMode','full')
QF = 
simplify(y*subs(QF,u,x/y))
ans = 
This one seems a little more general, though still arguably a hack. It can at least work for bivariate polynomials.
  댓글 수: 4
yogeshwari patel
yogeshwari patel 2023년 12월 2일
Before putting up the question I already gone through the above mention answer. Why we cant direct use the comammnad why to divide the expression by y^2 .Convert it into one variable and then substitute again.
Is it so that it didnt work for two variable ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by