How to find the factors of the polynomial in one than one variable

5 ビュー (過去 30 日間)
yogeshwari patel
yogeshwari patel 2023 年 12 月 1 日
回答済み: Pavan Sahith 2023 年 12 月 13 日
syms x y
e1=x^2+4
factor(e1)
P = x^2 + y^2
QF = factor(P,x,'FactorMode','full')
factor(x^3 + 2, x, 'FactorMode', 'full')
I use the above code to find the complex factor but the answer are not correct
  3 件のコメント
yogeshwari patel
yogeshwari patel 2023 年 12 月 1 日
for x^2+y^2 the factors are (x+iy) and (x-iy)
Bruno Luong
Bruno Luong 2023 年 12 月 1 日
Factor seems to be completly useless for such task, I ask the same question not long ago

サインインしてコメントする。

回答 (1 件)

Pavan Sahith
Pavan Sahith 2023 年 12 月 13 日
Hello Yogeswari,
As per my understanding, you want to factorize a polynomial in a complex field, and you are not able to get your expected output '(x+iy),(x-iy)' while using "factor(x^2+y^2,x,'FactorMode','full')".
When I tried with some equations like 'x^2+4',I could be able to get the linear factors.
syms x y
factor(x^2+ 4,x,"FactorMode","complex")
ans = 
factor(x^3 + 2, x, 'FactorMode', 'full')
ans = 
However, in the case of 'x^2+y^2', it appears that the answer remains irreducible. While searching the MathWorks documentation for "factor()", I found the following information:
"Factorization over complex numbers. A complex numeric factorization is a factorization into linear factors whose coefficients are floating-point numbers. Such factorization is only available if the coefficients of the input are convertible to floating-point numbers, that is, if the roots can be determined numerically. Symbolic inputs are treated as irreducible."
So,possibly 'y' might be getting considered as symbol and being treated as irreducable.
As a possible workaround, you might consider using the "solve" function:
syms x y;
e = x^2 + y^2;
roots = solve(e);
factors= prod(symvar(e,1) - roots)
factors = 
Please find the related MathWorks documentation links below
Hope that Helps.

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by