Hello! Does any one knows how can I group a specific term in a long equation?
For example, imagine i have the equation , which is equivalent to .
If I use the factor function, I obtain:
syms xeq = x^2 + 6*x + 9factor(eq,x)ans = [ x + 3, x + 3]
However, I want to group those terms inside the eq itself, so I can keep manipulating the symbolic expression (eq = (x+3)^2). I am asking these because I am solving a Lagrange equation and I need to group the terms in the forma (x + y) and (x – y). Once they are grouped, I want to make a variable change: subs(eq,(x+y),z) and subs(eq,(x-y),w).
Thanks a lot!
Best Answer