Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Finding coefficients from factorized polynomial?
2 ビュー (過去 30 日間)
古いコメントを表示
I have a simple factorized polynomial z = (x+y)^n and I'm trying to find the coefficients for any "n", so I wrote the following code:
n = input('n: ');
syms x y
z = (x+y)^n;
c = coeffs(z)
My idea is that I'm trying to find the coefficients for when z is some power (say, n = 3; (x+y)^3), but when I run the script it runs forever and I can't pause/stop it, which then I keep having to force-close MATLAB. I reckon the script isn't running because z is factorized, so is there a way for the coeffs function to work for polynomials in the form (x+y)^n ?
0 件のコメント
採用された回答
John D'Errico
2018 年 6 月 7 日
編集済み: John D'Errico
2018 年 6 月 7 日
I have no idea what you are talking about.
n = 3;
syms x y
z = (x+y)^n;
c = coeffs(z)
c =
[ 1, 3, 3, 1]
It works fine for me. My guess is you have chosen some very large power for n?
What release of MATLAB are you doing this under?
4 件のコメント
Walter Roberson
2018 年 6 月 8 日
Do you have Windows 10? If so see https://www.mathworks.com/matlabcentral/answers/399991-syms-sym-and-mupad-functions-cause-matlab-to-freeze
その他の回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!