| Original Message (ID '191138') By yehuda: |
| In Response To 'Re: Re: Polynomial factorization by roots?'
---------
If Solve can find the roots of the polynomial you can use it without guessing that you need Extension->I
for your specific example
p = x^4 + 2 x^2 + 1;
Times @@ Subtract @@@ Flatten@Solve[p == 0, x]
returns what you need
now slower
Solve[p == 0, x]
returns
{{x -> -I}, {x -> -I}, {x -> I}, {x -> I}}
To omit the internal lists you use Flatten
Flatten[Solve[p == 0, x]] (or Flatten@Solve[p==0,x])
Then you replace the x->I etc to x-I etc using Apply at level 1 with the shortcut of @@@
Subtract @@@ Flatten@Solve[p == 0, x]
returns
{I + x, I + x, -I + x, -I + x}
Now replace the outermost head which is a list with Times for multiplication
This is again Apply but at level 0 (replacing the outermost head) using the shortcut @@
Without the shorthand notation this would be
Apply[Times, Apply[Subtract, Flatten[Solve[p == 0, x]], 1]]
HTH
yehuda |
|