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

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Nasser M. Abbasi
12/12/12 08:07am

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


URL: ,

Subject (listing for 'Polynomial factorization by roots?')
Author Date Posted
Polynomial factorization by roots? Gandalf Saxe 12/11/12 11:08am
Re: Polynomial factorization by roots? Nasser M. Ab... 12/12/12 08:07am
Re: Polynomial factorization by roots? Gandalf 12/18/12 08:58am
Re: Polynomial factorization by roots? Steve Keeley 12/25/12 7:44pm
Re: Re: Polynomial factorization by roots? Steve Keeley 12/26/12 7:30pm
Re: Polynomial factorization by roots? Steve Keeley 12/26/12 7:48pm
Re: Re: Polynomial factorization by roots? Gandalf Saxe 12/28/12 05:36am
Re: Re: Re: Polynomial factorization by roots? yehuda 12/28/12 11:39am
Re: Re: Re: Polynomial factorization by roots? Steve Keeley 12/28/12 12:11pm
Re: Re: Re: Polynomial factorization by roots? Steve Keeley 12/28/12 1:02pm
Re: Re: Re: Re: Polynomial factorization by roo... yehuda 12/29/12 00:17am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic