# Efficient method for factor expressions with square roots

Inspired from this, I tried factor following expressions, Mathematica takes a long time, I couldn't even wait for it to finish. Maple calculating it takes about 5 sec. Can you recommend an efficient method? To get the factored result please click here(generated by Maple 16).

Factor[1 - 216 x^2 - 192 x^3 + 16140 x^4 + 18816 x^5 - 547528 x^6 -
687168 x^7 + 8960886 x^8 + 12394752 x^9 - 67518888 x^10 -
108989760 x^11 + 178031596 x^12 + 374357376 x^13 + 61149384 x^14 -
96214464 x^15 + 3999249 x^16,
Extension -> {Sqrt[2], Sqrt[3], Sqrt[5], Sqrt[6], Sqrt[11]}]

-
Why dou you think just about this Extension -> {Sqrt[2], Sqrt[3], Sqrt[5], Sqrt[6], Sqrt[11]} ? When you have extended the field of the rationals by Sqrt[2], Sqrt[3] you don't have to extend it as well by Sqrt[6] since there is just Sqrt[6], try e.g. Factor[-6 + x^2, Extension -> {Sqrt[2], Sqrt[3]}]. – Artes Jan 25 '13 at 12:57

Unlike your earlier Expand example, I cannot replicate the slowness here.

In[30]:= Timing[
fax = Factor[
1 - 216 x^2 - 192 x^3 + 16140 x^4 + 18816 x^5 - 547528 x^6 -
687168 x^7 + 8960886 x^8 + 12394752 x^9 - 67518888 x^10 -
108989760 x^11 + 178031596 x^12 + 374357376 x^13 +
61149384 x^14 - 96214464 x^15 + 3999249 x^16,
Extension -> {Sqrt[2], Sqrt[3], Sqrt[5], Sqrt[6], Sqrt[11]}];]

(* Out[30]= {0.480000, Null} *)


Factor will use a primitive element, so convert to radicals to go to radicals.

In[31]:= Timing[ToRadicals[fax]]

(* Out[31]= {0.,
157964603341393 + 91200903120336 Sqrt[3] -
4278656335470048 Sqrt[5 - 2 Sqrt[6]] +
89935414457372160 (5 - 2 Sqrt[6]) +
62309081229003360 Sqrt[2] (5 - 2 Sqrt[6]) +
51924234357502800 Sqrt[3] (5 - 2 Sqrt[6]) +
35974165782948864 Sqrt[6] (5 - 2 Sqrt[6]) -
1261240613743683456 (5 - 2 Sqrt[6])^(3/2) -
889994874234520384 Sqrt[2] (5 - 2 Sqrt[6])^(3/2) -
728177624373698496 Sqrt[3] (5 - 2 Sqrt[6])^(3/2) -
513838768562241408 Sqrt[6] (5 - 2 Sqrt[6])^(3/2) +
12323061227178959376 (5 - 2 Sqrt[6])^2 +
8711905205113320960 Sqrt[2] (5 - 2 Sqrt[6])^2 +
7114722584175878784 Sqrt[3] (5 - 2 Sqrt[6])^2 +
5029820909052636480 Sqrt[6] (5 - 2 Sqrt[6])^2 -
88232583176459376768 (5 - 2 Sqrt[6])^(5/2) -
62388546039057394176 Sqrt[2] (5 - 2 Sqrt[6])^(5/2) -
50941106398863376896 Sqrt[3] (5 - 2 Sqrt[6])^(5/2) -
36020043319228734336 Sqrt[6] (5 - 2 Sqrt[6])^(5/2) +
478093358287174151680 (5 - 2 Sqrt[6])^3 +
338062333338701947008 Sqrt[2] (5 - 2 Sqrt[6])^3 +
276027326042542835520 Sqrt[3] (5 - 2 Sqrt[6])^3 +
195180381321361818624 Sqrt[6] (5 - 2 Sqrt[6])^3 -
1997428926525420492288 (5 - 2 Sqrt[6])^(7/2) -
1412395246615804708608 Sqrt[2] (5 - 2 Sqrt[6])^(7/2) -
1153216137412904493312 Sqrt[3] (5 - 2 Sqrt[6])^(7/2) -
815446769474433867264 Sqrt[6] (5 - 2 Sqrt[6])^(7/2) +
6493163212229734802016 (5 - 2 Sqrt[6])^4 +
4591359616509582336000 Sqrt[2] (5 - 2 Sqrt[6])^4 +
3748829510010630067200 Sqrt[3] (5 - 2 Sqrt[6])^4 +
2650822723593059823360 Sqrt[6] (5 - 2 Sqrt[6])^4 -
16446760524212038838784 (5 - 2 Sqrt[6])^(9/2) -
11629615898963258318848 Sqrt[2] (5 - 2 Sqrt[6])^(9/2) -
9495541639814490759168 Sqrt[3] (5 - 2 Sqrt[6])^(9/2) -
6714361852964445470208 Sqrt[6] (5 - 2 Sqrt[6])^(9/2) +
32268730179416053862400 (5 - 2 Sqrt[6])^5 +
22817437911549382464000 Sqrt[2] (5 - 2 Sqrt[6])^5 +
18630360044435013600000 Sqrt[3] (5 - 2 Sqrt[6])^5 +
13173653928269969006592 Sqrt[6] (5 - 2 Sqrt[6])^5 -
48352419038274050377728 (5 - 2 Sqrt[6])^(11/2) -
34190323359888173177856 Sqrt[2] (5 - 2 Sqrt[6])^(11/2) -
27916282124786355016704 Sqrt[3] (5 - 2 Sqrt[6])^(11/2) -
19739792411726278232064 Sqrt[6] (5 - 2 Sqrt[6])^(11/2) +
53964237338898693931264 (5 - 2 Sqrt[6])^6 +
38158478229689721446400 Sqrt[2] (5 - 2 Sqrt[6])^6 +
31156267008017112299520 Sqrt[3] (5 - 2 Sqrt[6])^6 +
22030807639741785308160 Sqrt[6] (5 - 2 Sqrt[6])^6 -
43021093037533864040448 (5 - 2 Sqrt[6])^(13/2) -
30420506556750775984128 Sqrt[2] (5 - 2 Sqrt[6])^(13/2) -
24838239593682148958208 Sqrt[3] (5 - 2 Sqrt[6])^(13/2) -
17563287686455991494656 Sqrt[6] (5 - 2 Sqrt[6])^(13/2) +
22800236715739400232960 (5 - 2 Sqrt[6])^7 +
16122202025212411435008 Sqrt[2] (5 - 2 Sqrt[6])^7 +
13163722830612297722880 Sqrt[3] (5 - 2 Sqrt[6])^7 +
9308157661371798208512 Sqrt[6] (5 - 2 Sqrt[6])^7 -
7001994355390356627456 (5 - 2 Sqrt[6])^(15/2) -
4951157685773279219712 Sqrt[2] (5 - 2 Sqrt[6])^(15/2) -
4042603322067924430848 Sqrt[3] (5 - 2 Sqrt[6])^(15/2) -
2858552225425724940288 Sqrt[6] (5 - 2 Sqrt[6])^(15/2) +
888100660971628040448 (5 - 2 Sqrt[6])^8 +
627981998862511964160 Sqrt[2] (5 - 2 Sqrt[6])^8 +
512745154955400278016 Sqrt[3] (5 - 2 Sqrt[6])^8 +
362565576601493852160 Sqrt[6] (5 - 2 Sqrt[6])^8 -
2470283462936832 Sqrt[2 (5 - 2 Sqrt[6])] -
2470283462936832 Sqrt[3 (5 - 2 Sqrt[6])] -
1426218778490016 Sqrt[6 (5 - 2 Sqrt[6])]} *)


At this point one might attempt denesting. There was a post on this topic in Mathematica.StackExchange maybe a couple of months ago.

-
– R. M. Jan 25 '13 at 15:53