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 Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by