Mathematica 9 is now available
Student Support Forum
Student Support Forum > General > > "Polynomial factorization by roots?"

Post Reply:
Email Address:

Please send email when my message is replied to.

Url (optional):
Message: view original message?
Attachment (optional):
Please answer this:1+8 =

Original Message (ID '166412') By Nasser M. Abbasi:
This factorizes the polynomial alright, but not in the form P(x)=(x-r1)^p2*(x-r2)^p2*...*(x-rk)^pk with the r's being roots and p's respective algebraic multiplicities. Is it possible to have Mathematica factor the polynomial x^4+2x^2+1 to (x+I)^2*((x-I)^2)? ------------------------------------ I looked at the documentation and could not find a function. It seems like there should be one. May I missed it. But how about something like (quick hack, make sure to test more) ------------------------------- myFactor[p_, x_] := Module[{g, sol, lis}, sol = NSolve[p, x]; g = Gather[x /. sol, (Re[#1] == Re[#2]) && (Im[#1] == Im[#2]) &]; (x - First[#])^Length[#] & /@ g ] ---------------------- The above gives the factors in a list to use. You can Apply Plus to change the head (or use Total, etc... or anything else you want to do with them. To use: myFactor[x^4 + 2*x^2 + 1, x] // Rationalize // TableForm myFactor[x^8 + x^4 + 2*x^2 + 1, x] // Rationalize // TableForm etc... ps. warning, I am not a math major, so any errors, I am can't be held responsible ;) --Nasser