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 Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by