


"""simple docstring"""
from math import isclose, sqrt







def 						_a				(       _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				Tuple:
							snake_case_           =		point_y / 4 / point_x
							snake_case_           =		2 * normal_gradient / (1 + normal_gradient * normal_gradient)
							snake_case_           =		(1 - normal_gradient * normal_gradient) / (
							    1 + normal_gradient * normal_gradient
							)
							snake_case_           =		(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
							snake_case_           =		outgoing_gradient**2 + 4
							snake_case_           =		2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
							snake_case_           =		(point_y - outgoing_gradient * point_x) ** 2 - 100

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

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

							return next_x, next_y, outgoing_gradient







def 						_a				(       _SCREAMING_SNAKE_CASE = 1.4				, _SCREAMING_SNAKE_CASE = -9.6				)    ->				str:
							snake_case_           =		0
							snake_case_           =		first_x_coord
							snake_case_           =		first_y_coord
							snake_case_           =		(10.1 - point_y) / (0.0 - point_x)

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

							return num_reflections


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







"""simple docstring"""
def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				int:
							if index == number_of_items:
														return 0
							snake_case_           =		0
							snake_case_           =		0
							snake_case_           =		knapsack(_SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, index + 1				)
							if weights[index] <= max_weight:
														snake_case_           =		values[index] + knapsack(
														    _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, max_weight - weights[index]				, index + 1				)
							return max(_SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)


if __name__ == "__main__":
				import doctest

				doctest.testmod()



