function f(x) return x - math.cos(x) end function fp(x) return 1.0 + math.sin(x) end x = 1.0 n = 5 print( "x0 = ", x ) for i = 1, n do x = x - f(x) / fp(x) print( "x"..i.." = ", x ) end