# Tag Info

1

You can intersect the results of FactorList to pull out common factors involving h. The setup: b = 3; sS = h/2*Table[PauliMatrix[k], {k, b}]; n = {Sin[\[Theta]]*Cos[\[Phi]], Sin[\[Theta]]*Sin[\[Phi]], Cos[theta]}; sSn = Sum[sS[[k]]*n[[k]], {k, b}] (* Out[62]= {{1/2 h Cos[theta], 1/2 h Cos[\[Phi]] Sin[\[Theta]] - 1/2 I h Sin[\[Theta]] Sin[\[Phi]]}, ...

0

Thank you very much for all your ideas. I have combined them in this solution: poly = x^5 - 3 x^4 + x^2 - 11 x + 6 roots = (x /. Solve[poly == 0, x]) // N gr = x - Join[GatherBy[Cases[roots, n_ /; Im[n] != 0], {Re[#], Abs@Im[#]} &],DeleteCases[roots, n_ /; Im[n] != 0]] /. n_ /; Im[n] == 0 -> {n} Times @@ Chop[Expand[# /. List -> Times & /@ ...

12

As noted, one sticking point is that polynomial roots in general cannot be represented in Mathematica by anything other than Root[] objects. Nevertheless, it is possible to do a few manipulations to factorize a real polynomial into its linear and quadratic factors. decompose[poly_, x_] /; PolynomialQ[poly, x] := Module[{gr, rts}, rts = x /. ...

5

This gathers roots into complex conjugate pairs after solving the system numerically (since factoring a fifth order polynomial analytically is tough): In[1]:= poly = x^5 - 3 x^4 + x^2 - 11 x + 6; In[2]:= Chop[Times @@ Flatten[Expand@*Times @@@ (GatherBy[ NSolve[poly], {Re[x] /. #, Abs[Im[x]] /. #} &] /. Rule -> Subtract)]] ...

3

Times@@Map[x-#&, N[x/.{ToRules[Reduce[x^5-3 x^4+x^2-11 x+6==0, x]]}]] gives the result in factored form and not just as a list of roots or rules (-3.1838+x)(-0.552473+x)(-0.399923-1.4355 I+x)(-0.399923+1.4355 I+x)(1.53612+x)

8

You can find the roots using Solve: sol = Solve[x^5 - 3 x^4 + x^2 - 11 x + 6 == 0, x] // N {{x -> -1.53612}, {x -> 0.552473}, {x -> 3.1838}, {x -> 0.399923 - 1.4355 I}, {x -> 0.399923 + 1.4355 I}} The linear factors are those corresponding to the real roots and the quadratic factors correspond to the imaginary roots. You can get the ...

2

In general, factoring polynomials of order greater than four is tricky, but Mathematica can do it in some cases: Factor[28.35 + 67.545 x - 109.935 x^2 - 66.11 x^3 + 3.1 x^4 + x^5] (* 1. (-7.5 + 1. x) (-0.7 + 1. x) (0.3 + 1. x) (2. + 1. x) (9. + 1. x) *) or NSolve[x^5 - 3 x^4 + x^2 - 11 x + 6 == 0, x] {{x -> -1.53612}, {x -> 0.399923 - 1.4355 I}, {x ...

Top 50 recent answers are included