"Use Newton-Raphson method to find a root for the function based on a single initial guess. Only one root is found for an initial guess. It may not gaurantee convergence as it dependence on whether the initial guess is close enough to to a root "

"First plot the function and try to find a domain such that you can see the curve cut through the x-axis. Do this via trial and error."
f[x_]:=x^6-x - 1; 
(* f[x_]:=Exp[x]−x−2; *)
(* f[x_]:=x^3+2x^2−3x−1; *)
(*f[x_]:=(1/x) Sin[x];*)
(*f[x_]:=Tan[π x]−x−6;*)

Plot[f[x],{x,-1,1}]

"Define the differentiation of f[x] using Mathematica's powerful Symbol calculation"
D[f[xdum],{xdum}]

"Make the output of D[f[x],{x}] as a function of x via the following command"
df[x_]:=D[f[xdum],xdum]/.{xdum->x};
df[x]
Plot[df[x],{x,-1,1}]

xprev=0.45;(*initial guess *)

(*tolerence*)
epsilon=0.001; 


(*initialistation*)
alpha=10^8;count=0;countvalve=100;

While[alpha>epsilon,
count=count+1;
xnext=xprev-(f[xprev]/df[xprev]);
alpha=Abs[xnext-xprev];
xprev=xnext;
If[count>countvalve,Break[]];(*just in case it does not converge, the while loop can be exited via this 'valve'*)

Print[{count,xprev,xnext,f[xprev],df[xprev],f[xnext],alpha}];

];(*end while*)
Print["While loop exited"];
Print[{count,xprev,xnext,f[xprev],df[xprev],f[xnext],alpha}];
Plot[f[x],{x,xnext-0.1,xnext+0.1}]