How to solve equation?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Ameer Hamza
le 8 Mai 2020
Modifié(e) : Ameer Hamza
le 8 Mai 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Mathematics dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!