How to extract polynomial "p" from symbolic solution "root(p,x,k)"?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
FingersCrossed
el 10 de Jun. de 2022
Comentada: Walter Roberson
el 10 de Jun. de 2022
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 comentarios
Respuesta aceptada
Walter Roberson
el 10 de Jun. de 2022
Editada: Walter Roberson
el 10 de Jun. de 2022
use children() — or findSymType() and then children()
2 comentarios
Walter Roberson
el 10 de Jun. de 2022
children(x, 1)
would be shorter for that use case
Más respuestas (1)
Ver también
Categorías
Más información sobre Polynomials en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!