# Code I get from wolfram isn't working in mathematica

I need to perform the factor as shown here

factor(s^5+32s^4+363s^3+2092s^2+5052s+4320)


https://www.wolframalpha.com/input/?i=factor(s%5E5%2B32s%5E4%2B363s%5E3%2B2092s%5E2%2B5052s%2B4320)

I copy the code for the irreduciable factorization

N[Factor[s^5 + 32 s^4 + 363 s^3 + 2092 s^2 + 5052 s + 4320, Extension -> Flatten[s /. Solve[s^5 + 32 s^4 + 363 s^3 + 2092 s^2 + 5052 s + 4320 == 0, s]]]]


I try to run it on mathematica and its been like 5 minutes and it still isn't not done. I a running Mathematica 11 Student Edition (11.2)

• – Carl Woll Jan 29 '18 at 0:45
• I'm really new to mathematica, I really don't understand why if i copy the code from wolfram to use in mathematica it doesnt work. I don't understand 99% of what is being said in that thread. I'm only using mathematica to verify calculations that I had to do in matlab and labview for a controls class, and its working wonderfully for everything but that factor. – MathWannaBe456 Jan 29 '18 at 1:23
• I have reported this issue to Wolfram. As soon as I have the confirmation that this is a bug (or a solution) I will give an update. – halirutan Jan 29 '18 at 11:23

I believe your question is completely valid and I gave it a big upvote. Assuming that WolframAlpha did indeed use this command to get the result, I'm not sure on what mystical machine they ran it on.

I let it evaluate for several hours on the latest Mathematica version without success and my machine is pretty strong performance wise. I also tested older versions with the same result.

The only thing I can state is that it is indeed supposed to work. You can try a slightly simpler version of this problem by taking out the highest powers

Factor[4320 + 5052 s + 2092 s^2,
Extension -> Flatten[s /. Solve[4320 + 5052 s + 2092 s^2 == 0, s]]]
(*
1/523 (-1263 I + 3 Sqrt[73799] - 1046 I s) (1263 I + 3 Sqrt[73799] + 1046 I s)
*)


If you are really interested in this, then I would write to Wolfram support.

## Edit:

I did not notice that Chip works with the W|A team. Please see his answer which reflects what Wolfram support sent me:

Thank you for contacting Wolfram Technical Support.

As user Chip Hurst (a Wolfram|Alpha developer here) mentioned in his comment, this is an issue with Wolfram|Alpha returning the wrong expression it actually used to obtain the result. We hope to address this W|A issue soon.

We appreciate you taking the time to bring this to our attention. Please do not hesitate to contact us with anything else you come across while using our products.

• that worked perfectly, thank you – MathWannaBe456 Jan 29 '18 at 2:42
• @halirutan i wonder what is up with their quality assurance and testing department – Ali Hashmi Jan 30 '18 at 7:55

You can chalk this up as a W|A bug.

We do indeed try to factor with the approach stated by OP. When that times out, we try a different approach, but fail to update the code provided to the user.

The approach used in the timeout case is essentially

poly = s^5 + 32s^4 + 363s^3 + 2092s^2 + 5052s + 4320;
sols = s /. Solve[poly == 0, s];

N[Times @@ (s - sols)]

((2.04832 - 0.52209 I) + s) ((2.04832 + 0.52209 I) + s) ((5.55913 - 5.16689 I) + s) ((5.55913 + 5.16689 I) + s) (16.7851 + s)


(Remove N to see the exact solution.)

## Edit

This has been fixed now and will appear once W|A hits its next release cycle. The code will be

With[{poly = s^5 + 32 s^4 + 363 s^3 + 2092 s^2 + 5052 s + 4320},
Coefficient[poly, s, Exponent[poly, s]] Apply[Times, s - (s /. Solve[poly == 0, s])]
]


## Edit 2

This has been fixed for a few weeks now: