필터 지우기
필터 지우기

Matlab unable to find solution to cubic polynomial

조회 수: 2 (최근 30일)
Aleem Andrew
Aleem Andrew 2021년 2월 1일
편집: James Tursa 2021년 2월 1일
The following cubic equation has three roots.
syms a
solve((1225*a)/2 - 6125 == ((2*a - 35)^2*(60*a + 4200))/840, a)
Matlab's output is:
root(z^3 + 35*z^2 - (8575*z)/2 + 42875, z, 1)
root(z^3 + 35*z^2 - (8575*z)/2 + 42875, z, 2)
root(z^3 + 35*z^2 - (8575*z)/2 + 42875, z, 3)
Can cubic equations like this be solved analytically in Matlab?

채택된 답변

James Tursa
James Tursa 2021년 2월 1일
편집: James Tursa 2021년 2월 1일
Tell the solve( ) function that the max degree of the polynomial is 3 to force explicit solutions for the result:
syms a
p = (1225*a)/2 - 6125 - ((2*a - 35)^2*(60*a + 4200))/840
solve(p,a,'MaxDegree',3)
which gives
ans =
28175/(18*(- 5187875/108 + (432^(1/2)*659937359375^(1/2)*1i)/432)^(1/3)) + ((432^(1/2)*659937359375^(1/2)*1i)/432 - 5187875/108)^(1/3) - 35/3
- 28175/(36*(- 5187875/108 + (432^(1/2)*659937359375^(1/2)*1i)/432)^(1/3)) - ((432^(1/2)*659937359375^(1/2)*1i)/432 - 5187875/108)^(1/3)/2 - (3^(1/2)*(28175/(18*(- 5187875/108 + (432^(1/2)*659937359375^(1/2)*1i)/432)^(1/3)) - ((432^(1/2)*659937359375^(1/2)*1i)/432 - 5187875/108)^(1/3))*1i)/2 - 35/3
- 28175/(36*(- 5187875/108 + (432^(1/2)*659937359375^(1/2)*1i)/432)^(1/3)) - ((432^(1/2)*659937359375^(1/2)*1i)/432 - 5187875/108)^(1/3)/2 + (3^(1/2)*(28175/(18*(- 5187875/108 + (432^(1/2)*659937359375^(1/2)*1i)/432)^(1/3)) - ((432^(1/2)*659937359375^(1/2)*1i)/432 - 5187875/108)^(1/3))*1i)/2 - 35/3
Then you can also note
>> simplify(ans)
ans =
(35*2^(1/3)*(- 121 - 1077^(1/2)*3i)^(1/3))/6 + (35*2^(1/3)*(- 121 + 1077^(1/2)*3i)^(1/3))/6 - 35/3
- (35*2^(1/3)*(- 121 + 1077^(1/2)*3i)^(1/3))/12 - (35*2^(1/3)*(1 + 3^(1/2)*1i)*(- 121 - 1077^(1/2)*3i)^(1/3))/12 + (2^(1/3)*3^(1/2)*(- 121 + 1077^(1/2)*3i)^(1/3)*35i)/12 - 35/3
- (35*2^(1/3)*(- 121 + 1077^(1/2)*3i)^(1/3))/12 + (35*2^(1/3)*(- 1 + 3^(1/2)*1i)*(- 121 - 1077^(1/2)*3i)^(1/3))/12 - (2^(1/3)*3^(1/2)*(- 121 + 1077^(1/2)*3i)^(1/3)*35i)/12 - 35/3
>> imag(ans)
ans =
0
0
0
So you can pick off the real part for the answer.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by