フィルターのクリア

Find the roots of a complicated expression

1 回表示 (過去 30 日間)
Tim Berry
Tim Berry 2021 年 12 月 27 日
編集済み: Torsten 2021 年 12 月 27 日
Is it possible find the roots of a complicated expression like this:
-190 + 100/(1+0.01+x) + 80/(1+0.02+x)^2 + 20/(1+0.03+x)^3
Is there a way to rearrange this into a polynomial first, and then seek its roots?
(It would be easy if the denominators in the expression were simply (1+x), but in this complicated expression each denominator is different.)

採用された回答

Walter Roberson
Walter Roberson 2021 年 12 月 27 日
format long g
syms x
y = -190 + 100/(1+0.01+x) + 80/(1+0.02+x)^2 + 20/(1+0.03+x)^3
y = 
xsol = solve(y)
xsol = 
double(xsol)
ans =
0.0141995305746602 + 0i -1.01003015681544 + 0i -1.02053169387449 - 0.00181744153124217i -1.02053169387449 + 0.00181744153124217i -1.28839509826828 - 0.204565386093891i -1.28839509826828 + 0.204565386093891i
  1 件のコメント
Tim Berry
Tim Berry 2021 年 12 月 27 日
編集済み: Tim Berry 2021 年 12 月 27 日
Thank you Walter, this is brilliant. In case it is of interest, the background to my question is I am investigating whether complex numbers can occur in various problems. Cheers!

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

その他の回答 (1 件)

Torsten
Torsten 2021 年 12 月 27 日
編集済み: Torsten 2021 年 12 月 27 日
syms x
expr_orig = -190 + 100/(1+0.01+x) + 80/(1+0.02+x)^2 + 20/(1+0.03+x)^3;
expr = expr_orig*(1+0.01+x)*(1+0.02+x)^2*(1+0.03+x)^3;
expr = simplify(expr)
c = sym2poly(expr);
sol = vpa(roots(c));
format long
sol
  1 件のコメント
Tim Berry
Tim Berry 2021 年 12 月 27 日
編集済み: Tim Berry 2021 年 12 月 27 日
Thank you so much Torsten, this is fantastic. In case it is of interest, the background to my question is I am investigating whether complex numbers can occur in various problems. Cheers!

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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by