from numpy import sin, cos, pi
f = lambda x: x + (cos(x)-x)/(sin(x)+1)
x0 = pi/4
x1 = f(x0)
tol = 1e-5
while abs(x1-x0) > tol:
    x0 = x1
    x1 = f(x1)

print(x1)
