Matlab unable to find solution to cubic polynomial
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!