




from __future__ import annotations

from decimal import Decimal
from math import *  # noqa: F403

from sympy import diff







def SCREAMING_SNAKE_CASE    (	lowercase_			,    lowercase_			,    lowercase_ = 10**-10						)       ->	float:



       """simple docstring"""

       A__							=   a
       while True:
              A__							=   Decimal(lowercase_						) - (
                  Decimal(eval(lowercase_						)						) / Decimal(eval(str(diff(lowercase_						)						)						)						)  # noqa: S307
              )
              # This number dictates the accuracy of the answer
              if abs(eval(lowercase_						)						) < precision:  # noqa: S307
                     return float(lowercase_						)


# Let's Execute
if __name__ == "__main__":
  # Find root of trigonometric function
  # Find value of pi
  print(F'''The root of sin(x) = 0 is {newton_raphson('sin(x)', 2)}''')
  # Find root of polynomial
  print(F'''The root of x**2 - 5*x + 2 = 0 is {newton_raphson('x**2 - 5*x + 2', 0.4)}''')
  # Find Square Root of 5
  print(F'''The root of log(x) - 1 = 0 is {newton_raphson('log(x) - 1', 2)}''')
  # Exponential Roots
  print(F'''The root of exp(x) - 1 = 0 is {newton_raphson('exp(x) - 1', 0)}''')








class     UpperCamelCase_   :

    '''simple docstring'''






    def __init__(      self				:     List[str] ,			UpperCAmelCase__				:     int)						->Union[str, Any]:





           '''simple docstring'''

           A__							=   n
           A__							=   [None] * self.n
           A__							=   0  # index of the first element
           A__							=   0
           A__							=   0


    def __len__(      self				:     List[Any])						->int:





           '''simple docstring'''

           return self.size


    def 	SCREAMING_SNAKE_CASE							(      self				:     List[Any])						->bool:





           '''simple docstring'''

           return self.size == 0


    def 	SCREAMING_SNAKE_CASE							(      self				:     str)						->List[Any]:





           '''simple docstring'''

           return False if self.is_empty() else self.array[self.front]


    def 	SCREAMING_SNAKE_CASE							(      self				:     List[str] ,			UpperCAmelCase__				:     str)						->Any:





           '''simple docstring'''

           if self.size >= self.n:
                  raise Exception('''QUEUE IS FULL''')

           A__							=   data
           A__							=   (self.rear + 1) % self.n
           self.size += 1
           return self





    def 	SCREAMING_SNAKE_CASE							(      self				:     Union[str, Any])						->Any:





           '''simple docstring'''

           if self.size == 0:
                  raise Exception('''UNDERFLOW''')

           A__							=   self.array[self.front]
           A__							=   None
           A__							=   (self.front + 1) % self.n
           self.size -= 1
           return temp


