Pensieve header: A messy algebraic number.

From https://drorbn.net/index.php?title=08-401/Homework_Assignment_8:

Solve[
(x^5)+((2^(1/3))-(3^(1/2)))(x^4)+((Sqrt[7])/(Sqrt[(Sqrt[3])+(Sqrt[5])]))(x^3)-1 == 0,
x
][[1,1,2,1]][x]

PolOf[x_?NumberQ] :=#-x ;

RootsOf /:RootsOf[p_]^Rational[1,n_]:= RootsOf[p/.#->#^n];
RootsOf/:Sqrt[RootsOf[p_]]:=RootsOf[p/.#->#^2];
a_*RootsOf[p_]/;FreeQ[a,#] ^:= RootsOf[p/.{#->1/a*#}];
a_ + RootsOf[p_] /;FreeQ[a,#]^:=RootsOf[Expand[p/.#->#-a]];
RootsOf/:RootsOf[p_]^(-1):=RootsOf[Expand[1/#^Exponent[p,#] p]/.#->1/#];

RootsOf/:RootsOf[a_]*RootsOf[b_]:= Module[
{x,y,pow, dx,dy, rulex, ruley, mat},
pow=1/(x y);
px=a/.#->x; py = b/.#->y;
dx=Exponent[px,x];
dy=Exponent[py,y];
rulex=x^dx->Expand[-1/Coefficient[px,x^dx]*px+x^dx];
ruley=y^dy->Expand[-1/Coefficient[py,y^dy]*py+y^dy];
mat=Table[
pow*=x*y;
pow = Expand[Expand[pow] /. {rulex, ruley}];
Flatten[PadRight[CoefficientList[pow, {x, y}],{dx,dy}]],
{k,0,dx*dy}
];
t=NullSpace[Transpose[mat]];
RootsOf[Sum[t[[1,k+1]] #^k,{k,0,dx dy}]]
];
RootsOf/:RootsOf[a_]+RootsOf[b_]:= Module[
{x,y,pow, dx,dy, rulex, ruley, mat},
pow=1/(x+y);
px=a/.#->x; py = b/.#->y;
dx=Exponent[px,x];
dy=Exponent[py,y];
rulex=x^dx->Expand[-1/Coefficient[px,x^dx]*px+x^dx];
ruley=y^dy->Expand[-1/Coefficient[py,y^dy]*py+y^dy];
mat=Table[
pow*=x+y;
pow = Expand[Expand[pow] /. {rulex, ruley}];
Flatten[PadRight[CoefficientList[pow, {x, y}],{dx,dy}]],
{k,0,dx*dy}
];
t=NullSpace[Transpose[mat]];
RootsOf[Sum[t[[1,k+1]] #^k,{k,0,dx dy}]]
];
RootsOf /: RootsOf[p_]^n_Integer /; n>1 := RootsOf[p]*RootsOf[p]^(n-1);

RootsOf[p_/;!FreeQ[p,RootsOf]] := Module[
{cl,RulePol,RulesCoef={},mat,a,pow=1/#,poldeg=Exponent[p,#],t},
vars={#};
vardegs={poldeg};
cl=CoefficientList[p,#];
cl=cl/Last[cl];
Do[
If[Head[cl[[i]]]===RootsOf,
AppendTo[RulesCoef,
pa=First[cl[[i]]] /. # ->a[i-1];
pad = Exponent[pa,a[i-1]];
a[i-1]^pad->Expand[-1/Coefficient[pa,a[i-1],pad]*pa+a[i-1]^pad]
];
AppendTo[vars,a[i-1]];
AppendTo[vardegs,pad],
a[i-1]=cl[[i]]
],{i,poldeg}
];
RulePol=#^poldeg->-Sum[#^i a[i],{i,0,poldeg-1}];
mat=Table[
pow*=#;
pow = Expand[Expand[pow] /. RulePol/. RulesCoef];
Flatten[PadRight[CoefficientList[pow,vars],vardegs]],
{k,0,Times@@vardegs}
];
t=NullSpace[Transpose[mat]];
RootsOf[Sum[t[[1,k+1]] #^k,{k,0,Times@@vardegs}]]
];
{two, three, five, seven} = RootsOf[PolOf[#]]& /@ {2,3, 5,7}

(two^(1/3))

(two^(1/3))-(three^(1/2))

(1/(Sqrt[(Sqrt[three])+(Sqrt[five])]))

f=First[RootsOf[((#)^5)+((two^(1/3))-(three^(1/2)))((#)^4)+(1/(Sqrt[(Sqrt[three])+(Sqrt[five])]))((#)^3)-1]] /. # -> x

x0= x /. First[NSolve[(x^5)+((2^(1/3))-(3^(1/2)))(x^4)+(1/(Sqrt[(Sqrt[3])+(Sqrt[5])]))(x^3)-1 == 0, x, WorkingPrecision->100]]

f /. x -> x0