




from __future__ import annotations

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

from sympy import diff


def    A						(__A   :    str   ,				__A   :    float | Decimal   ,				__A   :    float = 10**-10       )   ->      float:







     """simple docstring"""


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


# 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"""
def 		lowercase							(     _snake_case						:      int     ,   _snake_case						:      int     )     ->str:
	"""simple docstring"""





	if a < 0 or b < 0:
		raise ValueError('''the value of both inputs must be positive'''     )
	__snake_case	:						Tuple						=				str(bin(_snake_case     )     )[2:]  # remove the leading "0b"
	__snake_case	:						List[Any]						=				str(bin(_snake_case     )     )[2:]
	__snake_case	:						Any						=				max(len(_snake_case     )     ,   len(_snake_case     )     )
	return "0b" + "".join(
	    str(int('''1''' in (char_a, char_b)     )     )
	    for char_a, char_b in zip(a_binary.zfill(_snake_case     )     ,   b_binary.zfill(_snake_case     )     )     )


if __name__ == "__main__":
			import doctest

			doctest.testmod()





