Author 
Comment/Response 
Nasser M. Abbasi

12/12/12 08:07am
This factorizes the polynomial alright, but not in the form P(x)=(xr1)^p2*(xr2)^p2*...*(xrk)^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*((xI)^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
URL: , 
