Analytically finding the roots of polynomials with symbolic variables

조회 수: 22 (최근 30일)
I am trying to solve a cubic equation with symbolic variables, but Matlab is not able to find an analytical solution.
syms a len
solve((35*len*a)/2 - 6125 == ((2*a - 35)^2*(60*a + 4200))/840, a)
ans =
root(z^3 + 35*z^2 - (7*z*((35*len)/2 + 1225/2))/2 + 42875, z, 1)
root(z^3 + 35*z^2 - (7*z*((35*len)/2 + 1225/2))/2 + 42875, z, 2)
root(z^3 + 35*z^2 - (7*z*((35*len)/2 + 1225/2))/2 + 42875, z, 3)
Can equations such as this be solved analytically in Matlab?

채택된 답변

James Tursa
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 len
p = (35*len*a)/2 - 6125 - ((2*a - 35)^2*(60*a + 4200))/840
solve(p,a,'MaxDegree',3)
which gives
ans =
((245*len)/12 + 30625/36)/((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3) + ((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3) - 35/3
- ((245*len)/12 + 30625/36)/(2*((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3)) - (3^(1/2)*(((245*len)/12 + 30625/36)/((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3) - ((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3))*1i)/2 - ((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3)/2 - 35/3
- ((245*len)/12 + 30625/36)/(2*((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3)) + (3^(1/2)*(((245*len)/12 + 30625/36)/((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3) - ((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3))*1i)/2 - ((((8575*len)/24 + 7674625/216)^2 - ((245*len)/12 + 30625/36)^3)^(1/2) - (8575*len)/24 - 7674625/216)^(1/3)/2 - 35/3

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Formula Manipulation and Simplification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by