how to decompose a polynomial
2 views (last 30 days)
Show older comments
Dear All,
For a given polynomial of the minimum order equals to 1, as follows:
F = mu1^2*x1^6 - 2*mu1*mu2*x1^6 + 6*mu1*mu2*x1^5*x2 - 6*mu1*mu2*x1^4*x2^2 + 2*mu1*mu2*x1^3*x2^3 + mu2^2*x1^6 - 6*mu2^2*x1^5*x2 + 15*mu2^2*x1^4*x2^2 - 20*mu2^2*x1^3*x2^3 + 15*mu2^2*x1^2*x2^4 - 6*mu2^2*x1*x2^5 + mu2^2*x2^6
where m1 and mu2 are coefficients.
Having defined X= [x1 ; x2];, how can I decompose 'F' to the following Structure:
F = X' * M * X; or F =X' * S' * S * X
Where M or S are matrices in terms of the powers of x1 and x2 or constant coefficients;
Is there any special matlac command for doing this?
many Thanks.
1 Comment
Jan
on 14 Dec 2018
Do you need for convert this function only? Then doing this manually is easy. Or is there a reason to perform this automatically?
Answers (1)
John D'Errico
on 14 Dec 2018
Edited: John D'Errico
on 14 Dec 2018
It is not a polynomial, a multinomial is a better description. I'm not even sure that what you ask is well-posed, in the sense that it looks like it does not even have a unique solution.
However, that does not mean you cannot write it yourself. Just extract each additive term of that multinomial sum. The function children can do that.
C = children(F)
C =
[ mu1^2*x1^6, mu2^2*x1^6, mu2^2*x2^6, -2*mu1*mu2*x1^6, -6*mu2^2*x1*x2^5, -6*mu2^2*x1^5*x2, 15*mu2^2*x1^2*x2^4, -20*mu2^2*x1^3*x2^3, 15*mu2^2*x1^4*x2^2, 6*mu1*mu2*x1^5*x2, 2*mu1*mu2*x1^3*x2^3, -6*mu1*mu2*x1^4*x2^2]
C(1)
ans =
mu1^2*x1^6
Now, can you write that single term in the desired form? Lets see, it has no factors of x2. So we can write it in a simpleform as:
[x1,x2]*[mu1^2*x1^4 ,0;0 0]*[x1;x2]
ans =
mu1^2*x1^6
You should see that you can always write any such subexpression of total degree 2 or higher in such a form, but that it is not always unique. In the above case, it was. But consider this subexpression.
C(7)
ans =
15*mu2^2*x1^2*x2^4
If we factor out x1*x1, then we could write it as:
[x1,x2]*[15*mu2^2*x2^4 ,0;0 0]*[x1;x2]
ans =
15*mu2^2*x1^2*x2^4
But we can also write it as:
[x1,x2]*[0 15*mu2^2*x1*x2^3;0 0]*[x1;x2]
ans =
15*mu2^2*x1^2*x2^4
Any bets that I cannot find infinitely many ways to write this? (Never take a sucker bet like that.)
[x1,x2]*[0 7*mu2^2*x1*x2^3;8*mu2^2*x1*x2^3 0]*[x1;x2]
ans =
15*mu2^2*x1^2*x2^4
Regardless, just extract each term of the multinomial. I show how to do that using children. Then pick any of the infintely many possible forms that I showed how to create. The result will be a factorization in the form of a sum that will look like...
[x1,x2]*S{1}*[x1;x2] + [x1,x2]*S{2}*[x1;x2] + [x1,x2]*S{3}*[x1;x2] + ...
But we know that these terms can then be recombined as:
[x1,x2]*( S{1} + S{2} + S{3} + ... )*[x1;x2]
Again, the solution is not at all unique. And yes, you will need to write it, since I seriously doubt anyone has bothered to do so for you.
0 Comments
See Also
Categories
Find more on Logical 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!