How to solve equation?
5 views (last 30 days)
Show older comments
equ = x^3 + (29*x^2)/100 - (1351*x)/100 + 359/50 == 0
Spectrum = solve(equ, x)
Hi, trying to solve this equation but get something like that.
Spectrum =
root(z^3 + (29*z^2)/100 - (1351*z)/100 + 359/50, z, 1)
root(z^3 + (29*z^2)/100 - (1351*z)/100 + 359/50, z, 2)
root(z^3 + (29*z^2)/100 - (1351*z)/100 + 359/50, z, 3)
0 Comments
Accepted Answer
Ameer Hamza
on 8 May 2020
Edited: Ameer Hamza
on 8 May 2020
First
You can force MATLAB to write its explicit form using MaxDegree with solve()
syms x
equ = x^3 + (29*x^2)/100 - (1351*x)/100 + 359/50 == 0
Spectrum = solve(equ, x, 'MaxDegree', 3)
Result
Spectrum =
406141/(90000*(- 114584939/27000000 + (1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000)^(1/3)) + ((1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000 - 114584939/27000000)^(1/3) - 29/300
- (3^(1/2)*(406141/(90000*(- 114584939/27000000 + (1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000)^(1/3)) - ((1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000 - 114584939/27000000)^(1/3))*1i)/2 - 406141/(180000*(- 114584939/27000000 + (1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000)^(1/3)) - ((1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000 - 114584939/27000000)^(1/3)/2 - 29/300
(3^(1/2)*(406141/(90000*(- 114584939/27000000 + (1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000)^(1/3)) - ((1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000 - 114584939/27000000)^(1/3))*1i)/2 - 406141/(180000*(- 114584939/27000000 + (1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000)^(1/3)) - ((1200000000^(1/2)*88664127737^(1/2)*1i)/1200000000 - 114584939/27000000)^(1/3)/2 - 29/300
Second
Or you can get output in variable precision numeric format
syms x
equ = x^3 + (29*x^2)/100 - (1351*x)/100 + 359/50 == 0
Spectrum = vpa(solve(equ, x, 'MaxDegree', 3))
Result
Spectrum =
3.2163511711964122946143841774131 + 3.6734198463196484624023016788195e-40i
- 4.056644260843024929305472877667 + 3.6734198463196484624023016788195e-40i
0.55029308964661263469108870025384 - 7.346839692639296924804603357639e-40i
The solution has a tiny complex part, probably due to numeric errors. You can extract the real part like this
real(Spectrum)
Third
Directly convert to floating-point format using double
syms x
equ = x^3 + (29*x^2)/100 - (1351*x)/100 + 359/50 == 0
Spectrum = double(solve(equ, x, 'MaxDegree', 3))
Spectrum = real(Spectrum)
Result
Spectrum =
3.2164
-4.0566
0.5503
2 Comments
More Answers (0)
See Also
Categories
Find more on Mathematics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!