Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Finding coefficients from factorized polynomial?

조회 수: 2 (최근 30일)
Emanuele Joy
Emanuele Joy 2018년 6월 7일
마감: Emanuele Joy 2018년 6월 8일
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 ?

채택된 답변

John D'Errico
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
Emanuele Joy
Emanuele Joy 2018년 6월 8일
@Walter, you're godsent. The update fixed my issue, thank you!

추가 답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by