


"""simple docstring"""


from math import isclose, sqrt


def _lowerCamelCase      (						_UpperCamelCase       ,					_UpperCamelCase       ,					_UpperCamelCase ):

			'''simple docstring'''




			__lowerCAmelCase							       =     point_y / 4 / point_x
			__lowerCAmelCase							       =     2 * normal_gradient / (1 + normal_gradient * normal_gradient)
			__lowerCAmelCase							       =     (1 - normal_gradient * normal_gradient) / (
			    1 + normal_gradient * normal_gradient
			)
			__lowerCAmelCase							       =     (sa - ca * incoming_gradient) / (ca + sa * incoming_gradient)

			# to find the next point, solve the simultaeneous equations:
			# y^2 + 4x^2 = 100
			# y - b = m * (x - a)
			# ==> A x^2 + B x + C = 0
			__lowerCAmelCase							       =     outgoing_gradient**2 + 4
			__lowerCAmelCase							       =     2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
			__lowerCAmelCase							       =     (point_y - outgoing_gradient * point_x) ** 2 - 100

			__lowerCAmelCase							       =     (
			    -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term )
			) / (2 * quadratic_term)
			__lowerCAmelCase							       =     (
			    -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term )
			) / (2 * quadratic_term)

			# two solutions, one of which is our input point
			__lowerCAmelCase							       =     x_minus if isclose(_UpperCamelCase       ,					_UpperCamelCase ) else x_plus
			__lowerCAmelCase							       =     point_y + outgoing_gradient * (next_x - point_x)

			return next_x, next_y, outgoing_gradient


def _lowerCamelCase      (						_UpperCamelCase = 1.4       ,					_UpperCamelCase = -9.6 ):

			'''simple docstring'''




			__lowerCAmelCase							       =     0
			__lowerCAmelCase							       =     first_x_coord
			__lowerCAmelCase							       =     first_y_coord
			__lowerCAmelCase							       =     (10.1 - point_y) / (0.0 - point_x)

			while not (-0.01 <= point_x <= 0.01 and point_y > 0):
						__lowerCAmelCase       ,      __lowerCAmelCase       ,      __lowerCAmelCase							       =     next_point(_UpperCamelCase       ,					_UpperCamelCase       ,					_UpperCamelCase )
						num_reflections += 1

			return num_reflections


if __name__ == "__main__":
	print(f'''{solution() = }''')








"""simple docstring"""


from __future__ import annotations

import math

import numpy as np
from numpy.linalg import norm


def _lowerCamelCase      (						_UpperCamelCase       ,					_UpperCamelCase ):

			'''simple docstring'''




			return math.sqrt(sum(pow(a - b       ,					2 ) for a, b in zip(_UpperCamelCase       ,					_UpperCamelCase ) ) )


def _lowerCamelCase      (						_UpperCamelCase       ,					_UpperCamelCase ):

			'''simple docstring'''




			if dataset.ndim != value_array.ndim:
						__lowerCAmelCase							       =     (
						    "Wrong input data's dimensions... "
						    f"dataset : {dataset.ndim}, value_array : {value_array.ndim}"
						)
						raise ValueError(_UpperCamelCase )

			try:
						if dataset.shape[1] != value_array.shape[1]:
									__lowerCAmelCase							       =     (
									    "Wrong input data's shape... "
									    f"dataset : {dataset.shape[1]}, value_array : {value_array.shape[1]}"
									)
									raise ValueError(_UpperCamelCase )
			except IndexError:
						if dataset.ndim != value_array.ndim:
									raise TypeError("Wrong shape" )

			if dataset.dtype != value_array.dtype:
						__lowerCAmelCase							       =     (
						    "Input data have different datatype... "
						    f"dataset : {dataset.dtype}, value_array : {value_array.dtype}"
						)
						raise TypeError(_UpperCamelCase )

			__lowerCAmelCase							       =     []

			for value in value_array:
						__lowerCAmelCase							       =     euclidean(_UpperCamelCase       ,					dataset[0] )
						__lowerCAmelCase							       =     dataset[0].tolist()

						for dataset_value in dataset[1:]:
									__lowerCAmelCase							       =     euclidean(_UpperCamelCase       ,					_UpperCamelCase )

									if dist > temp_dist:
												__lowerCAmelCase							       =     temp_dist
												__lowerCAmelCase							       =     dataset_value.tolist()

						answer.append([vector, dist] )

			return answer


def _lowerCamelCase      (						_UpperCamelCase       ,					_UpperCamelCase ):

			'''simple docstring'''




			return np.dot(_UpperCamelCase       ,					_UpperCamelCase ) / (norm(_UpperCamelCase ) * norm(_UpperCamelCase ))


if __name__ == "__main__":
	import doctest

	doctest.testmod()




