




"""simple docstring"""






from math import factorial, pi







def      _snake_case			(				lowercase__							,    lowercase__ = 30		):

				if not isinstance(lowercase__							,    (int, float)		):
								raise ValueError('maclaurin_sin() requires either an int or float for theta'		)

				if not isinstance(lowercase__							,    lowercase__		) or accuracy <= 0:
								raise ValueError('maclaurin_sin() requires a positive int for accuracy'		)

				_lowerCamelCase     :			List[Any]    =    float(lowercase__		)
				_lowerCamelCase     :			Union[str, Any]    =    theta // (2 * pi)
				theta -= 2 * div * pi
				return sum(
				    (-1) ** r * theta ** (2 * r + 1) / factorial(2 * r + 1		) for r in range(lowercase__		)		)







def      _snake_case			(				lowercase__							,    lowercase__ = 30		):

				if not isinstance(lowercase__							,    (int, float)		):
								raise ValueError('maclaurin_cos() requires either an int or float for theta'		)

				if not isinstance(lowercase__							,    lowercase__		) or accuracy <= 0:
								raise ValueError('maclaurin_cos() requires a positive int for accuracy'		)

				_lowerCamelCase     :			Optional[int]    =    float(lowercase__		)
				_lowerCamelCase     :			List[str]    =    theta // (2 * pi)
				theta -= 2 * div * pi
				return sum((-1) ** r * theta ** (2 * r) / factorial(2 * r		) for r in range(lowercase__		)		)


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			print(maclaurin_sin(10))
			print(maclaurin_sin(-10))
			print(maclaurin_sin(10, 15))
			print(maclaurin_sin(-10, 15))

			print(maclaurin_cos(5))
			print(maclaurin_cos(-5))
			print(maclaurin_cos(10, 15))
			print(maclaurin_cos(-10, 15))





"""simple docstring"""






from __future__ import annotations

import math

import numpy as np
from numpy.linalg import norm







def      _snake_case			(				lowercase__							,    lowercase__		):
				return math.sqrt(sum(pow(a - b							,    2		) for a, b in zip(lowercase__							,    lowercase__		)		)		)







def      _snake_case			(				lowercase__							,    lowercase__		):

				if dataset.ndim != value_array.ndim:
								_lowerCamelCase     :			Tuple    =    (
								    'Wrong input data\'s dimensions... '
								    f'''dataset : {dataset.ndim}, value_array : {value_array.ndim}'''
								)
								raise ValueError(lowercase__		)

				try:
								if dataset.shape[1] != value_array.shape[1]:
												_lowerCamelCase     :			Optional[int]    =    (
												    'Wrong input data\'s shape... '
												    f'''dataset : {dataset.shape[1]}, value_array : {value_array.shape[1]}'''
												)
												raise ValueError(lowercase__		)
				except IndexError:
								if dataset.ndim != value_array.ndim:
												raise TypeError('Wrong shape'		)

				if dataset.dtype != value_array.dtype:
								_lowerCamelCase     :			int    =    (
								    'Input data have different datatype... '
								    f'''dataset : {dataset.dtype}, value_array : {value_array.dtype}'''
								)
								raise TypeError(lowercase__		)

				_lowerCamelCase     :			Optional[int]    =    []

				for value in value_array:
								_lowerCamelCase     :			Tuple    =    euclidean(lowercase__							,    dataset[0]		)
								_lowerCamelCase     :			Union[str, Any]    =    dataset[0].tolist()

								for dataset_value in dataset[1:]:
												_lowerCamelCase     :			Optional[Any]    =    euclidean(lowercase__							,    lowercase__		)

												if dist > temp_dist:
																_lowerCamelCase     :			List[Any]    =    temp_dist
																_lowerCamelCase     :			List[str]    =    dataset_value.tolist()

								answer.append([vector, dist]		)

				return answer







def      _snake_case			(				lowercase__							,    lowercase__		):
				return np.dot(lowercase__							,    lowercase__		) / (norm(lowercase__		) * norm(lowercase__		))


if __name__ == "__main__":
			import doctest

			doctest.testmod()