How to extract polynomial "p" from symbolic solution "root(p,x,k)"?
1 次查看(过去 30 天)
显示 更早的评论
When using solve() symbolically and a solution of the form root(f(z),z,k) is produced, is it possible to extract f(z) without manually copying and pasting?
For instance, if I assign an example solution to variable x :
x = root(z^2 + z + 1, z, 1)
Can z^2 + z + 1 or its coefficients be extracted from x?
sym2poly() does not seem to recognize root(). I suppose I could bluntly use regexp(), though it seems there must be a simpler solution.
0 个评论
采纳的回答
Walter Roberson
2022-6-10
编辑:Walter Roberson
2022-6-10
use children() — or findSymType() and then children()
2 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!