Output simpler version of symbolic polynomial expression
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
When I run some MATLAB code, I get a symbolic expression that looks like this:
a*x^2 + 2*a*x*y + b + a*y^2
Looking at it, I know I can rewrite this as
a*(x + y)^2 + b
How do I get MATLAB to output the expression as the latter? Is there even a function to do so?
0 comentarios
Respuestas (1)
madhan ravi
el 8 de Oct. de 2020
Editada: madhan ravi
el 8 de Oct. de 2020
syms x y a b
z = a*x^2 + 2*a*x*y + b + a*y^2;
simplify(collect(z, a), 'Steps', 50)
0 comentarios
Ver también
Categorías
Más información sobre Assumptions en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!