three order complex coefficient polynomial root matlab

Hi, I would like to find the root for a 3rd order polynomial with complex coefficient.
The polynomial is like:
28x^3 + Ax^2 + Bx - C = 0;
A,B,C are complex numbers.
I appreciate if anyone can help.

답변 (3개)

There are at least two options —
z = complex(randn(3,1), randn(3,1))
z =
0.1066 + 0.2511i 0.8599 + 2.0317i -0.2015 + 2.7642i
r = roots([28; z])
r =
0.4103 - 0.2811i -0.0640 + 0.4828i -0.3501 - 0.2106i
syms x
p = 28*x.^3 + z(1,:)*x.^2 + z(2,:)*x + z(3,:);
vpap = vpa(p, 5)
vpap = 
r = vpa(solve(p), 5)
r = 
.
John D'Errico
John D'Errico 2023년 5월 26일

1 개 추천

Another classic solution is to find the matrix that has the same eigenvalues as your polynomial has roots. Then use eig to compute the eigenvalues of this "companion matrix". This is in fact what roots does.
syms x A B C
eqn = 28*x^3 + A*x^2 + B*x - C == 0;
solutions = solve(eqn, x, 'MaxDegree', 3)
solutions = 
char(solutions(1))
ans = '(C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3) - (B/84 - A^2/7056)/(C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3) - A/84'
char(solutions(2))
ans = '(B/84 - A^2/7056)/(2*(C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3)) - A/84 - (C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3)/2 - (3^(1/2)*((B/84 - A^2/7056)/(C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3) + (C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3))*1i)/2'
char(solutions(3))
ans = '(B/84 - A^2/7056)/(2*(C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3)) - A/84 - (C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3)/2 + (3^(1/2)*((B/84 - A^2/7056)/(C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3) + (C/56 + ((C/56 - A^3/592704 + (A*B)/4704)^2 + (B/84 - A^2/7056)^3)^(1/2) - A^3/592704 + (A*B)/4704)^(1/3))*1i)/2'

카테고리

제품

질문:

2023년 5월 26일

답변:

2023년 5월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by