symbolic cubic polynomial solver
古いコメントを表示
Cubic polynomial always has a zero point on the real line, so I run something like
syms x a
solve(x^3+x^2-x+a,'real',true)
ans =
sin(atan((2*(1/27 - a^2/4)^(1/2))/a)/3) -...
1/(3*((a^2/4 - 1/27)^(1/2) - a/2)^(1/3)) + ...
sin(atan((2*(1/27 - a^2/4)^(1/2))/a)/3 - pi/3)...
- 1/(3*(a/2 - (a^2/4 - 1/27)^(1/2))^(1/3))...
- sin(atan((2*(1/27 - a^2/4)^(1/2))/a)/3)...
- sin(atan((2*(1/27 - a^2/4)^(1/2))/a)/3 - pi/3) -...
(2*3^(1/2)*cos(atan((2*(1/27 - a^2/4)...
(2*3^(1/2)*cos(atan((2*(1/27 - a^2/4)^(1/2))...
I cut the ... part b/c it's too long, but my point is that Matlab gave me 8 solutions. Can somebody tell me what is going on? Where is the fundamental theorem of algebra?
採用された回答
その他の回答 (1 件)
Andrew Newell
2015 年 3 月 15 日
編集済み: Andrew Newell
2015 年 3 月 15 日
I ran the same code and got 3 solutions:
syms x a
xsols = solve(x^3+x^2-x+a,'real',true);
size(xsols)
ans =
3 1
I think you're interpreting those eight lines as one solution per line, but the triple dots at the end of the line mean that the solution continues on the next line. You are really just displaying one of the three solutions.
4 件のコメント
Sakai
2015 年 3 月 15 日
Sakai
2015 年 3 月 15 日
Andrew Newell
2015 年 3 月 15 日
It appears that in 2014a, the option 'real',true didn't have any effect; but in 2014b, the engine is trying to figure out what parts of the solution are real.
Consider: in complex space, for each value of a (which, as far as solve knows might be complex) you have three complex solutions. Without 'real',true, solve is returning the equations for (real(x), imag(x)) as a function of (real(a), imag(a)) - not a line, but a surface. With 'real',true, it is trying to determine where this surface intersects imag(x) = 0. That could be any number of line segments.
Sakai
2015 年 3 月 15 日
カテゴリ
ヘルプ センター および File Exchange で Common Operations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!