How to display all valid results when converting fraction form to decimal form? Specifically when the fraction expression includes roots of negative numbers.
조회 수: 1 (최근 30일)
이전 댓글 표시
For example, (-1)^(1/3)+2 is something what I got from subsituting varibles into a symbolic equation, and I would like to see all the complex results and eliminate ones that have imaginary components.
댓글 수: 0
답변 (1개)
Gargi Patil
2021년 4월 15일
The following code returns all the roots of (-1)^(1/3)+2:
allRoots = 2 + roots([1 0 0 1]);
The following code returns the real root for the expression (-1)^(1/3)+2:
realRoots = 2 + nthroot(-1, 3);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Argument Definitions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!