2
$\begingroup$

Suppose I have got this polynomial

u=x^12-3x^8-x^4+3

Now, I am trying to collect this polynomial with x^4 terms. I need to write it like this: (-1+x^4) (-3 + x^4) (1 + x^4)

To evaluate it, I used

Factor[u]

(-1 + x) (1 + x) (1 + x^2) (-3 + x^4) (1 + x^4)

and

Collect[%, x^4, Simplify]

3 - x^4 - 3 x^8 + x^12

But, finally I am not able to reach what I need. Could anyone help me to solve this problem?

$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Jun 14 at 11:45
5
$\begingroup$

Still another option is

Factor[u /. x^n_ -> y^(n/4)] /. y -> x^4

(* (-3 + x^4) (-1 + x^4) (1 + x^4) *)
$\endgroup$
3
  • 1
    $\begingroup$ Simpler: Factor[u /. x -> y^(1/4)] /. y -> x^4 $\endgroup$
    – Roman
    Jun 14 at 13:32
  • $\begingroup$ Also, if you want your pattern to match a simple x too (not just higher powers of $x$), you'll need a default pattern: x^n_. -> y^(n/4) (notice the dot after the underscore). $\endgroup$
    – Roman
    Jun 14 at 14:23
  • $\begingroup$ @Roman In this case there is no need "to match a simple x too". I can imagine other computations in which Default would be useful, however Thanks. $\endgroup$
    – bbgodfrey
    Jun 14 at 14:30
2
$\begingroup$

This can be done in several ways. How about this: First,

u = x^12 - 3 x^8 - x^4 + 3;
    
    u1 = Factor[u]
    
    (*   (-1 + x) (1 + x) (1 + x^2) (-3 + x^4) (1 + x^4)  *)

Then

Simplify[Drop[u1, -2]]*Drop[u1, 3]

(*  (-3 + x^4) (-1 + x^4) (1 + x^4)  *)

Have fun!

$\endgroup$
2
$\begingroup$

You could do a SolveAlways to get the values a[i] below, provided you know in advance the number of factors:

prod[x_, n_] := Product[x^4 + a[i], {i, n}]
sol = SolveAlways[x^12 - 3 x^8 - x^4 + 3 == prod[x, 3], x];

prod[x, 3] /. sol[[1]]

(* (-3 + x^4) (-1 + x^4) (1 + x^4) *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.