How to handle symbolic polynomials?
1 view (last 30 days)
Show older comments
lorenzo donadio
on 8 Nov 2016
Answered: Walter Roberson
on 8 Nov 2016
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⁴
0 Comments
Accepted Answer
Walter Roberson
on 8 Nov 2016
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 Comments
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!