Group Abstract Group Abstract

Message Boards Message Boards

0
|
58 Views
|
5 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Fully factor polynomial with complex roots

Posted 1 day ago

How do I get all factors for polynomial with complex roots? For example,

example problem

Thanks so much

Joe

POSTED BY: Joseph Stavitsky
5 Replies
Posted 2 hours ago

Hi,

I have shared an example How do get all factors for polynomial with complex roots?

Given: f(x)=x3−3x2+4x−12f(x) = x^3 - 3x^2 + 4x - 12f(x)=x3−3x2+4x−12

Assume it has a complex root x=1+ix = 1 + ix=1+i

Since the coefficients are real, its conjugate x=1−ix = 1 - ix=1−i is also a root.

Now, factor: 1. Multiply complex conjugates: (x−(1+i))(x−(1−i))=(x−1)2+1=x2−2x+2(x - (1 + i))(x - (1 - i)) = (x - 1)^2 + 1 = x^2 - 2x + 2(x−(1+i))(x−(1−i))=(x−1)2+1=x2−2x+2

  1. Use polynomial division to find the remaining factor by dividing f(x)f(x)f(x) by x2−2x+2x^2 - 2x + 2x2−2x+2. Suppose division gives x−3x - 3x−3, then: f(x)=(x−3)(x2−2x+2)f(x) = (x - 3)(x^2 - 2x + 2)f(x)=(x−3)(x2−2x+2)

So, factors are: • Linear: x−3x - 3x−3 • Quadratic (real): x2−2x+2x^2 - 2x + 2x2−2x+2 • Or linear complex: x−(1+i),x−(1−i),x−3x - (1+i), x - (1-i), x - 3x−(1+i),x−(1−i),x−3

POSTED BY: Kamal Hinduja

Hi Gianluca,

I don't know. My impression is that the documentation has never been complete. From time to time, WRI makes an effort to build out the documentation to include missing descriptions and new behavior, but they never seem to fill in all the missing details. Perhaps initially they are tentative about the behavior of an option value, and a version or two later, when the behavior is finalized, somehow the documentation is not updated.

I usually assume there's some meaning to option settings like None/All, True/False, and Automatic, when the setting makes sense for the option. Perhaps people should submit requests to have it documented, so that it ends up on a developer's to-do list. Especially when you consider the following timings and output sizes:

poly = 2 x^9 - 10 x^6 + 10 x^3 - 2;

Factor[poly, Extension -> ComplexExpand@SolveValues[poly == 0, x]] // 
  LeafCount // AbsoluteTiming
(*  {30.4158, 2239}  <-- slowest, large *)

Factor[poly, Extension -> Last /@ List @@ Roots[poly == 0, x]] // 
  LeafCount // AbsoluteTiming
(*  {12.948, 36343}  <-- slow, largest *)

(p1 = Factor[poly, Extension -> All]; p1) // 
  LeafCount // AbsoluteTiming
(*  {0.002003, 123}  <-- fast, smallest, simplest code *)

(p2 = Last@CoefficientList[poly, x] (Times @@ 
       Subtract @@@ List @@ Roots[poly == 0, x]); p2) // 
  LeafCount // AbsoluteTiming
(*  {0.001257, 123}  <-- fastest, smallest, but complicated code *)

p1 === p2
(*  True  <-- last two factorizations are identical *)

The first example above is your method; the second is a modification of your method (I didn't expect to be so much different, though); the third is mine; and the fourth constructs the factors by hand and is my guess at what Factor[..., Extension -> All] probably does, although I expected the two to be closer in timings.

POSTED BY: Michael Rogers

Another way:

Factor[x^3 + 216, Extension -> All]
POSTED BY: Michael Rogers

Wonderful, but why cannot I find it mentioned in the documentation for Extension?

POSTED BY: Gianluca Gorni

Here is a way:

Factor[x^3 + 216,
 Extension -> ComplexExpand@SolveValues[x^3 + 216 == 0, x]]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard