How to display all valid results when converting fraction form to decimal form? Specifically when the fraction expression includes roots of negative numbers.
2 ビュー (過去 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!