


'''simple docstring'''







from __future__ import annotations

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

from sympy import diff




def        __lowercase						(      __SCREAMING_SNAKE_CASE				,  __SCREAMING_SNAKE_CASE				,  __SCREAMING_SNAKE_CASE = 10**-10		)				->					int:
     """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)}""")










'''simple docstring'''







from math import pi, sqrt




def        __lowercase						(      __SCREAMING_SNAKE_CASE		)				->					float:
     """simple docstring"""




     if num <= 0:
          raise ValueError("""math domain error"""		)
     if num > 171.5:
          raise OverflowError("""math range error"""		)
     elif num - int(__SCREAMING_SNAKE_CASE		) not in (0, 0.5):
          raise NotImplementedError("""num must be an integer or a half-integer"""		)
     elif num == 0.5:
          return sqrt(__SCREAMING_SNAKE_CASE		)
     else:
          return 1.0 if num == 1 else (num - 1) * gamma(num - 1		)




def        __lowercase						(      )				->					None:
     """simple docstring"""




     assert gamma(0.5		) == sqrt(__SCREAMING_SNAKE_CASE		)
     assert gamma(1		) == 1.0
     assert gamma(2		) == 1.0


if __name__ == "__main__":
 from doctest import testmod

 testmod()
 SCREAMING_SNAKE_CASE_      =			1.0
 while num:
  SCREAMING_SNAKE_CASE_      =			float(input('Gamma of: '))
  print(f"""gamma({num}) = {gamma(num)}""")
  print('\nEnter 0 to exit...')






