wrong answer of solve function

조회 수: 2 (최근 30일)
iridium
iridium 2015년 3월 14일
편집: Star Strider 2015년 3월 14일
When I use "solve" to find the root for the equation 1/x+(1/x)^3==1, it returns 3 answers, even including one that's negative. Yet obviously this equation should have unique solution. How should I refine the answer? Thank you!

채택된 답변

Star Strider
Star Strider 2015년 3월 14일
Why should it have a unique solution?
It’s a cubic equation, so it will have three roots. They do not have to be distinct roots, but there have to be three of them:
x =
1.4655712318767680266567312252199
- 0.23278561593838401332836561260997 - 0.79255199251544784832589830065336*i
- 0.23278561593838401332836561260997 + 0.79255199251544784832589830065336*i
  댓글 수: 2
iridium
iridium 2015년 3월 14일
Thank you for your comment! Sorry for not being clear, I was talking about real solutions. Since solve function returns three real answers, I thought it solves for reals.
Star Strider
Star Strider 2015년 3월 14일
편집: Star Strider 2015년 3월 14일
My pleasure!
The solve function (I used vpasolve) doesn’t return three real answers, at least to your polynomial. It returns one real and two complex conjugate solutions.
It solves for all three solutions (as does the roots function if you cast your equation as a polynomial vector). Your equation does have a real solution: 1.46557123.
If you want only the real root, that’s easy enough:
p = [1 -1 0 -1];
pr = roots(p);
real_root = pr(imag(pr) == 0)
produces:
real_root =
1.4656

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by