




"""simple docstring"""







from __future__ import annotations

import typing
from collections.abc import Iterable

import numpy as np

a      =							typing.Union[Iterable[float], Iterable[int], np.ndarray]  # noqa: UP007
a      =							typing.Union[np.floataa, int, float]  # noqa: UP007





def 							lowercase					(snake_case__   : List[Any]      ,       snake_case__   : Optional[int] )     ->  Any:


				'''simple docstring'''






				return np.sqrt(np.sum((np.asarray(snake_case__ ) - np.asarray(snake_case__ )) ** 2 ) )





def 							lowercase					(snake_case__   : Union[str, Any]      ,       snake_case__   : List[Any] )     ->  Tuple:


				'''simple docstring'''






				return sum((va - va) ** 2 for va, va in zip(snake_case__      ,       snake_case__ ) ) ** (1 / 2)


if __name__ == "__main__":





		def 							lowercase					()     ->  List[Any]:


						'''simple docstring'''






						from timeit import timeit

						print("""Without Numpy""" )
						print(
						    timeit(
						        """euclidean_distance_no_np([1, 2, 3], [4, 5, 6])"""      ,       number=10_000      ,       globals=globals()      ,       ) )
						print("""With Numpy""" )
						print(
						    timeit(
						        """euclidean_distance([1, 2, 3], [4, 5, 6])"""      ,       number=10_000      ,       globals=globals()      ,       ) )






		benchmark()











"""simple docstring"""







from __future__ import annotations

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

from sympy import diff





def 							lowercase					(snake_case__   : str      ,       snake_case__   : float | Decimal      ,       snake_case__   : float = 10**-10 )     ->  float:


				'''simple docstring'''






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


# 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)}""")





