How to solve equation?

5 ビュー (過去 30 日間)
dan chen
dan chen 2020 年 5 月 8 日
コメント済み: Ameer Hamza 2020 年 5 月 8 日
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)

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 5 月 8 日
編集済み: Ameer Hamza 2020 年 5 月 8 日
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 件のコメント
dan chen
dan chen 2020 年 5 月 8 日
Thanks!
Ameer Hamza
Ameer Hamza 2020 年 5 月 8 日
I am glad to be of help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by