How to handle symbolic polynomials?

조회 수: 1 (최근 30일)
lorenzo donadio
lorenzo donadio 2016년 11월 8일
답변: Walter Roberson 2016년 11월 8일
Hi, im looking for a way to create a function that takes an integer (k) and a simple but large symbolic polynomial like this :
1+x²+x³+x⁴.......
and returns only the part of the polynomial with a degree lower or equal to the integer k, can this be done?
for example
p= (syms) 1+x²+x³+x⁴+x⁶+x⁹
return=function(p,5)
return= (syms) 1+x²+x³+x⁴

채택된 답변

Walter Roberson
Walter Roberson 2016년 11월 8일
sym2poly(), take the last k+1 entries, poly2sym()
Or use coeffs('all') with two outputs, and take the last k+1 entries of the two outputs, dot product the two (that is, sum of the element-wise multiplications)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by