Need help with writing a code for arctan

Hello, i need to compute the formula y=arctan(x) with Newton’s method.
I already have a code for the Newton method.

Newton[fn_, dfn_, X0_, iter_] := Module[{X1 = X0},  
  Print[StringForm["X0= `` ; Y0= ``",   
    ToString[NumberForm[N[X1], {8, 5}]], ScientificForm[N[fn[X1]], 4]]];   
  Do[{X1 = X1 - fn[X1]/dfn[X1],   
    Print[StringForm["X`1`= `2` ; Y`1`= `3`", i,   
      ToString[NumberForm[N[X1], {8, 5}]],   
      ScientificForm[N[fn[X1]], 4]]]}, {i, iter}]  
  ]

but I need to calculate arctan, how to write it here?
I am not very good with coding, could anyone help, please?

In Mathematica it’s much more direct than you might dream up, in this post Zero crossings and zero-almost crossings a code skeleton was given

 nsZ[f_, x0_, n_Integer: 100] := If[NumericQ[f[x0]],
          FixedPoint[(# - f[#]/f'[#]) &, N[x0], n],(*else*)
          Print["Function f = ", f, " is not numeric at x0 = ", x0]; 
          Return[$Failed]
       ]

f is the function (e.g. ArcTan), x0 is the start value, the result is the zero position x1 (i.e. f(x1) = 0).

It might converge as well as diverge

 In[21]:= nsZ[ArcTan, #, 20] & /@ Range[0.1, 1.5, 0.1]
 Out[21]= {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.67686305871854*10^18082, 7.264574678709*10^111191}

divergency happens if the next Iteration Point has a derivative whose Tangent is more horizontal than the Tangent of the current Iteration Point.


Sorry for the silly capitalization of words, it is done automatically since today …