How to handle symbolic polynomials?

1 次查看(过去 30 天)
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